DoMoreWithLess in an OO context means the following:
- All attributes should be private. All methods should be public or protected.
- If a class has more than 3 attributes, consider reducing the number of attributes by creating more classes (grouping few attributes) and adding relations among those classes.
- If a class has more than 10 methods, consider reducing the number of methods by moving them up in the hierarchy.
- When the methods can't be moved up, consider creating an intermediate class (in the inheritance relation) to hold some attributes and methods. That intermediate class should have a meaningful name so that it could be inherited by other classes.
- Similar methods should have similar names.
- When two or more classes have the same methods, create a class than has those method and make the other inherit from the new class. If inheritance is not an option, use delegation.
- Make each class have one and only one responsibility. If a class has two responsibilities, divide it.
- Each method should have no more than 10 */ non-comment /* lines. Else consider creating new methods that group some lines. One liners are okay.
This will proliferate the number of classes. I think this is a minor problem if all classes are organized in a single thin and deep tree. By knowing the first 10% of the levels of the tree, you can manage the complexity of the system.
How do you know if your ClassModel? is OO? Only if your ClassDiagram is good.
-- GuillermoSchwarz
This seems to be a direct contravention of DoTheSimplestThingThatCouldPossiblyWork.