25 ms·
Too me this sounds he came back from over-using the "hammer". However, I really like his article because he applies some prioritisation which of the concepts a
by je42 12y ago
Too me this sounds he came back from over-using the "hammer".
However, I really like his article because he applies some prioritisation which of the concepts are more important.
(i.e. reducing dependencies and SRP ).
However, the other concepts of SOLID are still good to know and to apply. You should just not apply them as a only resolution to your problem.
And you will get into deep trouble if you violate LSP. Please don't.
I think in general you should not use depth-first to search for a tool to solve a problem.
- Mix in some reasonable breadth first search (i.e. try a few other tools that could fit the problem. ).
- Then look at the space, pick the best solution found so far, apply it, reevaluate.
- If necessary refactor after learning more.
Also, i believe one of the most important problem resolution strategies that is missing:
is to reformulate the problem into a problem that is easier to handle.
- delinquentme 12y agoLSP: two users: an admin, and a common user. CLEARLY we can see these two should not have the same functionality, thus a GOOD design pattern. Yet clearly in violation of LSP. Esplain please.
- erdeszt 12y agoThe admin user don't necessarily have to inherit from the common user. They can extend the same base class or implement the same interface. Afaik LSP doesn't say anything about the abstract methods(it doesn't make sense to call them on the base class anyway). So you put the common methods(e.g. getName) in the base class, you won't break those in the different roles, and make the role dependent methods abstract.