dimanche 25 novembre 2018

How to follow Single Responsibility Principle in set of actions

I have a windows service application that read some files and does some modification and upload to a web API.

In here I followed the single responsibility principle as much as possible.

In this app, I have 3 classes that read files' content, apply business logic and upload that modified content to the server.

class GetFileContent { 
// in here there is a method to return the file content
}

class ApplyBusinessLogic { 
// in here there is a method to get that file content as param and apply business logic
}

class UploadContent {
// get the modified content and upload it
}

Now my question is if I added a new class as DoMyActions and create objects of above class and call theres methods for doing those task, is that violation of the Single Responsibility Principle? For make clear of my question I am tring to do something like below.

class DoMyAction { 

GetFileContent content = new GetFileContent();
// call the method in above class and get the content

ApplyBusinessLogic doMyThing = new ApplyBusinessLogic();
// do my stuff using that file content

UploadContent uploader = new UploadContent();
// upload the content
}

Is there a better approch on this?

If I continuously want to use DoMyAction class how to follow the Single Responsibility Principle?

Aucun commentaire:

Enregistrer un commentaire