Introduction
The main goal of Object Oriented Design is to decompose the system into modules, that is identifying the software architecture so that it should maximize the cohesion and minimize the coupling. It also involves in identifying the module dependencies like inheritance, composition, uses relationships among different modules, determining the form of inter-module communications and providing well defined module interfaces to the user of the System.
Principles of Object Oriented Class Design
The Open Close Principle (OCP)
A module should be opened for extension but closed for modification. It states that, write the module such a way that, it can be extended with out modifying the existing code. It will make sure that user of the Module wont be affected by we extending our Module for additional requirements.
The Liskov Substantiation Principle (LSP)
Subclasses should be substitutable for their base class. That is user of a base class should continue to function properly if a derived class object of that class is passed to it.
The Dependency Inversion Principle (DIP)
Depend upon abstractions. Do not depend on concretions. The implication of this principle is, every dependency in the design should target an interface or abstract class.
The Interface Segregation Principle (ISP)
Many client specific interfaces are better than one general-purpose interface. Rather than keeping all the interfaces that are used by some user in one class, create many specific interfaces/classes inheriting from this abstract class, which does specific functions for the user.
> C++ Design and Coding Tips
> C++ Design and Coding Tips
> C++ Design and Coding Tips