This Object Oriented Programming principle states that each module or class should be responsible for only one part of the functionality. By saying this, we are stating that each subsystem, module, class or function should have just one reason to change. How do we accomplish this? By developing small service classes with enclosed objectives. What is it that we want to accomplish through this strategy? More cohesion and less resistance to change. Allow the composition of classes (or class injection) which deserves a extended post in this blog. Avoid duplicity and copy-pasting portions of code. Now, that seems fairly simple but, as with any theoretical principle, the problem is usually visualizing with an example what the theory is suggesting and, even more than that, in which cases should we apply this theory. Of course, it's not the same developing a small online shop for a cousin who produces and sells hand made costume jewelry, than developing an a...
Comments
Post a Comment