mardi 21 mai 2019

How can Single Responsibility Principle be achived with good practice? [on hold]

I've been looking into the Single Responsibility Principle (SRP), and I'm not quite sure how to correctly understand it and how to achieve it programmatically. I have been told to think of it as "do one thing well", but how do you define "one thing". All methods do different things and I'm sure that you're not supposed to encapsulate all of them in different classes.

If you want to move a method to its own class, how would you do this? What design-pattern would generally be used to do this? Right now I would probably move the method to a static class to achieve SRP, but it seems so bad practice.

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire