In this article, I will give an introduction to the object oriented programming and we will see what is the major difference between module based programming approach and object oriented programming.
Unlike C programming language which follows a procedural/modular based approach, C++ follows an object-oriented approach.
Remember, with both modular programming and object oriented programming, the functionality which we offer to the end user is exactly same but the way how we design the system gets changed.
Better system design always makes the product development & maintenance easy.
With OOPS, the entire system can be divided into multiple subsystems called classes and can have the respective functionality separately in each class using the member functions. whereas, with modular based approach we need to have the functionality all together in a functions at the same level which reduces the readability and may be difficult for the new programmers to understand the project/system.
Let’s see an example of designing an application for the bank to manage multiple loan departments.
- House loan
- Personal loan
- Education loan
- Vehicle loan
Modular approach
In the modular-based approach all the departments are at the same level and it may not cause any difference from the end user perspective but for the developers, it would be difficult to maintain such code w.r.t to the readability and understandability when the repo size gets increased.
Object oriented approach
In object oriented based approach, each department will be divided into a sub modules called classes and in each class we can have the respective functionality.
This approach improves the readability and maintenance of the code.