Why Do We Need Design Principles & patterns?

 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.
  • When this fear becomes acute , an official rigidity sets in
Fragility:
  • Tendency of the software to break at many places every time it is changed
  • Often the breakage occurs in the areas that have no conceptual relation with the area where changes were done
  • This troubles a lot. Every time a manager authorizes a fix he/she fears that software will break in some unexpected way
  • Finally this software is found impossible to maintain [As every fix makes it worse , introducing more problems than are solved]
Immobility:
  • Immobility is inability to reuse software from other projects or from the parts of same project
  • Often happens when one engineer discovers that he needs a module similar to the one that another engineer wrote
  • After giving thought on it he is going ahead but finds that the work and risk required to separate that desired part is really difficult
Viscosity:
  • Viscosity come in two forms 
    • Viscosity of the design
    • Viscosity of the environment
  • While working for a fix , engineer finds that there are more than one ways to make the changes. The one that preserves the design (that are difficult) and other that doesn’t ( hack and they are easier ) 
  • Engineer takes the easier approach and does changes
  • Viscosity of environment comes into the picture when development environment is slow and inefficient.  (example : if compile times very long engineers will be tempted to make changes that don’t force large recompiles)
  • If the source code control system takes hours to check-in just a few lines/files, then engineers will be tempted to make changes that requires a few check-in as possible regardless of whether design is preserved. 
The above discussed four symptoms are the signs of poor architecture. Any application that exhibits them suffering from a design that is rotting. 

What causes the ROT to take place?
There are many reasons which cause a software to start rotting. Below are some of the factors :
  • Changing Requirements
  • Dependency Management 
Changing Requirements :
  • The requirements have been changing in a way the initial design did not anticipate
  • Often the changes made very frequently and engineers who are not familiar with the original design , somehow violates the original design 
  • We know that the requirements document is the most volatile document in the project  and hence we cannot ignore it
  • If our designs are failing due to the constant rain of changing requirements , its our designs that are at fault ( We must somehow find the way to make our designs resilient to such changes)
Dependency Management :
  • Changes that introduce new and unplanned dependencies
  • Either of the 4 symptoms ( mentioned above) caused directly or indirectly by improper dependencies between modules
  • Dependencies between modules must be managed in order to forestall the degradation of dependency architecture
  • This can be done by creating dependency firewalls  - across these firewalls dependencies don’t propagate
“Object Oriented Design backed with principles and techniques can be used to deal with such situations”

Thanks for reading !! You may post your queries/questions if any...

Comments