Posts

Showing posts from May, 2025

Design Principles [ S.O.L.I.D.]

Image
  ----------------------------------------------------------------- Single Responsibility Principle ----------------------------------------------------------------- About : The Single Responsibility Principle is a simple and intuitive principle. This is one of the 5 principles of S.O.L.I.D.. A responsibility in the current context is said to be a reason for change. The single responsibility principle states that if there more than one reasons for a class to change then we say that this class is not proper and it should be divided into further classes. There cannot be more than a reason for a class to be changed. Example : Suppose there is a class called " Customer " and contains a method called as " CalculateBills() " we should call this class has not been written properly. The customer class should only perform the customer related responsibilities. Please see  the below snap shot: There are some observations out of the above snap shot: Customer class should be re...

Why Do We Need Design Principles & patterns?

Image
  What Goes Wrong With The Software? Software applications begin as a vital image in minds of designers Its clean and elegant this time Intention initially is to see the software working As the time passes , the software starts to rot Over the time rotting continues….. Finally this becomes hard to maintain , at times the sheer effort required to make even the simplest change to it  Here is the situation resulting into redesign of the project. Rotting Software Design Over the period of time the software starts rotting. One can sense the symptom of rotting in case he/she finds any of the following in the existing software : Rotting software design-symptoms... Rigidity: Tendency of software to be difficult to change. Every change causes a cascade of subsequent changes in dependent modules A 2-day change to one module grows into many week marathon changes ( in module after module ) When software becomes like this, managers fear to allow engineers to fix non critical problems....