Showing posts with label Articles. Show all posts
Showing posts with label Articles. Show all posts

Sunday, August 24, 2014

SOLID Programming principles - Introduction

In this article, I will discuss 5 SOLID programming principles, which are considered corner stone of well designed applications. Here, I will just define them and later on, we will slowly start using them in our programs. S.O.L.I.D is made of 5 alphabets as shown below.

  • S for Single Responsibility
  • O for Open-Closed Principle
  • L for Liskov substitution Principle
  • I for Interface Segregation Principle
  • D for Dependency Inversion Principle 
Single Responsibility Principle:
"Every class should have only one reason change" in other words "Every class should have only one responsibility"

Open-Closed Principle:
"Classes should be open for extension but closed for modification"

Liskov Substitution Principle:
"Use any derived class in place of parent class & have it behave exactly in the same manner without modification"

Interface Segregation Principle:
"Split the methods of contract into groups of responsibilities and assign interfaces to these group"

Dependency Inversion Principle:
According to this principle,
"Isolate the classes from concrete implementation and having these depends on abstract classes or interfaces"