2 ms·
Depends on what this dev would be building, if you have to build framework or you build a library then I agree. If you build next off the mill "business" system
by ozim 8y ago
Depends on what this dev would be building, if you have to build framework or you build a library then I agree. If you build next off the mill "business" system then...
Single responsibility principle, yes nice but we have deadlines and no time to argue if that one function should be somewhere else, fix it when we have some slack.
Open closed principle, you don't have to think about if you use DI and have interfaces.
Liskov substitution is useless, you should not use inheritance but composition.
Interface segregation, you have to think about it but it is a lot like SRP.
Dependency inversion, interfaces plus DI framework takes you far enough.
So IMO if one senior guy sets up project with DI framework and gives general direction, someone who can't formulate SOLID still can be good OOP developer.
- Sharlin 8y ago> Liskov substitution is useless, you should not use inheritance but composition. Liskov substitution is more about interface inheritance than implementation inheritance, really. LSP basically says that the implementer of an interface must obey the contract the interface specifies. As a real-world example, throwing UnsupportedOperationException in a method implementation is an LSP violation. Of course, this makes it vital to get the interfaces themselves right, carving the solution space at its joints.
- ozim 8y agoOk yes, it is about subtypes and interface is quite of an abstract base class. But if you have interface as in Java or C# and maybe 2 or 3 implementations without complicated type hierarchy under it, it is not an issue in practice to be not strict about contract, because you can spot deviation from it and fix it quick (ideally you also have integration tests to spot it for you).
- jschwartzi 8y agoI think the point is to forget about specific language features for a moment and think about interfaces the same way a mechanical or electrical engineer does -- as things to be glued together.
- ozim 8y agoNo, Liskov substitution is much more abstract level, if you go with physical interface definition it does not work at all. It is not about attaching things but about type hierarchy. Thing you describe does not account for Covariance and Contrvariance and then it also goes into generic types which also huge abstraction which does not fit in physical world.