This note will list few things you should try to avoid in your design. Please also see notes on SOLID Principles and summary of additional design principles and best practices.
Run-Time Type Identification (RTTI)
Design that require you to check for the actual type of the reference object should be avoided (e.g. if(type(something) = something, do something).
Cyclomatic complexity (CC)
It directly measures the number of linearly independent paths through a program's source code (e.g. the number of if-else-if statements in a function).
Note that for every path you need to add at least one additional test case to your unit test cases.
As a good practice, we should avoid this as much as possible or limit this to less than 10.
Swiss knife syndrome
‘Swiss Army Knife’ is often used to describe a collection of useful items or tools that are able to perform well in multiple scenarios.
The more complex a piece of code or software gets, the less value it provides, and it will be more difficult to maintain.
An example is the usual util class. This is the opposite of SRP.
Only use as a last resort as in the case of caching.
Bidirectional coupling and cyclic coupling
Create maintenance nightmares
A class that does everything should be avoided.
God class will need a God Man, who is the only person who can understand and modify that class.
Latest version of this note can be found @ http://codingarchitect.com/things-to-avoid-in-your-object-oriented-design.
Searches whole web. Use the search in the right sidebar to search only within javajee.com!!!