The knowledge sharing zone -

What is OOD Principle

This tutorial contains the details about OOD Principles like - What is OOD principle, What are the advantages and disadvantages, List of all the principles with examples.
  • Related Topics:

OOD Principle

  • It's software design principles represents a set of guidelines to avoid having a bad design.

Following are the very important list of OOD principles with their advantages and use of it:

  1. Minimize the accessibility of classes and members

    • As per this principle, You should always check for the scope of your classes & its members.
    • Minimize the accessiblity using more private members which would indirectly help to reduce unexpected bugs.
    • You can use following OOP concepts to minimize the accessibility of classes and members :
      1. Abstraction
      2. Encapsulation
      3. Information Hiding
      4. Use Accessor & Mutators
  2. Favor composition over Inheritance
    • This principle emphesizes on use of Composition (has-a relationship) instead of Inheritance (is-a relationship).
    • This is many advantages during implemention or coding in OOP languages like Java, C# etc..
  3. Program to an Interface, Not an Implementation
    • As per this principle, Always setup contract and contract implementor.
    • Here contract means Interface, And Its implmentor concrete classes.
    • Always use reference variables of type Interface, So your implementation logic won't be hard code to particular contract implementation.
    • By using reference of Interface, Later you can easily switch to any other concrete class (contract implementor class).
  4. The Open-Closed Principle (OCP)
    • As per this principle, Software entities should be open for extension, Yet closed for modification.
    • OCP says that try to design modules that never need to be changed.
  5. The Liskov Substitution Principle (LSP)
    • LSP says that, Functions that use the references to Base / Super classes must be able to use objects of derived classes without knowing it.
    • This principle is just an extension of the Open Close principle, To make sure that new derived classes are extending the base classes without changing their behavior.
  6. The Single Responsibility Principle (SRP)
    • SRP principle says that "Class should have only one reason to change".
    • Each responsibility should be a separate class because each responsibility is an axis of change.
  7. The Interface Segregation Principle (ISP)
    • ISP principle says that Clients should not be forced to depend upon interfaces that they don't use.
    • When we design an application we should take care of How we are going to make abstract module which contains several sub-modules.
  8. Dependency Inversion Principle (DIP)
    • DIP principle says that, High level modules should not depend upon low level modules, Both should depend upon abstractions.
    • Abstractions should not depend upon details, Details should depend upon abstractions.

You would also like to read:

Comments :

Name :
Email :
Comment :
Verify Text :
capch image, refresh page if not loaded somehow