DEV Community

Dibyojyoti Sanyal
Dibyojyoti Sanyal

Posted on • Updated on • Originally published at cloudnativemaster.com

What design & build incrementally means in OO design Principle ?

This is one of the Object Oriented Design Principles that helps developers keep the code readable and understandable.

When you try to make the whole design and start implementation that will not work because either you will find your previous assumptions were incorrect or the requirement changed. Therefore, it is better to design in a way that the design can be extended and the same basic design building blocks can be reused in other parts of the code. While designing we also need to adhere to homogeneity, which means similar things should be designed and implemented in a similar way and orientation of similar parts of code should look like the same. This is how we can design and build incrementally, once small pieces at a time.

Example, when you need to implement an HTTP connection and a JDBC connection to a database. The actual code will be very different but you should design it in a way that the same design patterns can be used in both places, the high level method names and the class hierarchy and relation between objects should be similar in both implementations. Though implementation details and the objects itself will be different but the interaction and responsibilities divided in different classes and methods in high level should look similar. It makes the code easy to understand also, as human nature is such that it recognizes the known patterns easily.

You can refer to my blog post for a concreate example.

Top comments (0)