You need to read up on this. Lots of fancy OO mavens think they can explain this better than the last guy, so there’s no lack of information on the interwebs. But I’ll explore a lot of the ideas in S.O.L.I.D. from time to time. I consider the concepts very important. I use them. In brief they are:
Principle | Description |
---|---|
Single Responsibility Principle | An object should do one job. There should be one “owner.” |
Open Closed Principle | You shouldn’t alter the native functions in an object, but you can add to its functions. |
Liskov Substitution Principle | You should be able to use an object if it inherits all the same properties as the object the logic expects. |
Interface Segregation Principle | Don’t put business rules in the page. Or the Web. Or the anything that’s just the face for your program. |
Dependency Inversion Principle | Don’t embed concrete objects in other objects. Instead, use placeholders and let the users pass in the concrete objects. Your code will use the placeholders, but in reality, your code will be using what was passed in. It’s a trick of abstraction. |
Use your research staff[1] to find more about these. Someday I’ll likely expand on a couple of these in other topics.
Just because they make a nice acronym, do not assign a hierarchy to the patterns that come at the beginning over those that come at the end. D is not less important than S.
Reference:[1] Google