SOLID Principles of object oriented design

        S.O.L.I.D   is an acronym for the five basic principles of object-oriented programming and design identified by Robert C. Martin (Uncle Bob) in the early 2000s. The principles when applied together intend to make your code easy to maintain and extendable.

    1- Single Responsibility Principle:

every object should have a single responsibility, and that responsibility should be entirely encapsulated by the class.

    2- The Open-Closed Principle:

the class should be open for extension but closed for modification .

    3- Liskov substitution Principle:

it states that derived class should be substitutable for their base class. which means that if  I substitute the derived class to its base class every thing should work with the same behavior and give me the same output .

   4- Interface Segregation Principle:

it states that clients should not be forced to depend on methods they do not use . Don’t build fat Interfaces, only small cohesive interfaces to be matched with the client needs.

     5- Dependency inversion Principle:

it states that high-level classes should not depend on low-level class. both should depend on abstraction. and abstraction should not depend on details but details should depend on abstraction. which means that you should depend on a concept not on an implementation.

Advertisements

2 thoughts on “SOLID Principles of object oriented design

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s