Updated: Aug 29, 2021
Object Oriented Design principles
Object Oriented Design principles help users to write high quality code. Today we will see what are the characteristics or what the design principles give when they are followed. To understand OO design principles you should know at least one OO programming. Here I have chosen to use JAVA. There are several principles and several names of the same principles. Here I will list the most popular basic ones which are well received and well known. I will write what the characteristics are. There are separate blog posts in the space with a detailed discussion for each of the characteristics.
A piece of code, a method or a class needs to be transparent on what it does. It should be easy by reading the name to understand what they do. Any developer who understands the programming language should be able to understand the code even if they are new to the code.
A class or method should exactly do what it should do. They should be kept as precise and small as possible.
Incremental development approach
Developers should take the incremental approach when they are developing functionality. The design and implementation both should be done incrementally. WHile doing so, designers and developers should take care that the code can be extended easily for the next increments to come.
Cohesion or Coherence and Coupling
The classes should be more cohesive and less coupled. In other words the one class should exactly do one thing and the related classes should live in a coherent fashion. The classes which are not related to each other should work independent of each other.
Two classes are said to be orthogonal when one is dependent or uses another but when behaviour of one class changes it should not affect another. For example when we add functionality on one class that is used by another class, the logic in the second class should not break.
The Object Oriented Design principles helps us to achieve all these above characteristics. Each of the above characteristics are explained in detail with examples in individual blogs.