Sunday, May 10, 2009

Deadly sins of Design (Symptoms of rotting Design)



Every software is designed for a business need. When software is designed it starts with a clear thought process in mind of the developers. At this point the software is in its best shape and in a condition which can be maintained very easily. But there are always changes in business needs and business plans. Your software should be able to meet the business needs and business plans. You start making changes to the code. Slowly you realize that the code is not that maintainable which found earlier and it is not very easy plug new thing into the code. Then your software starts rotting. It continues to a point where it fails completely and you think of re-designing the entire software again. In reality you really get a chance to re-design the entire software and also these re-designs hardly succeeds. So what is the thing which causes the software to rot? Well there are four design symptoms which rots the software if not taken in to consideration from the beginning. They are

• Rigidity
• Fragility
• Immobility
• Viscosity


Rigidity

A software can be called a rigid when it is difficult to change even in a sample way. Every change causes subsequent changes in all the other dependent modules. What begins with a simple two days change in one module grows into changes for weeks as the engineer changes module after module.
Let us consider a defect tracking system. Let us say it is an N-tier architecture product. Let’s say the defect tracking system has a severity dropdown having values like “Critical, Major and Minor”. Now it was decided by the client that there can not be any other values for severity other then “Critical, Major and Minor” The developers have decided to hard cord the values in the UI layer. So every layer has been hard cored with the values and the product has been released to the client. The first release was successful and the client it happy with it.
After a year the client has decided to add “Normal” as one category and remove “Minor” from the category list. The manager felt that this is a simple label change and can be done very easily and has made the commitment accordingly. This has been communicated to the new developer and the developer started looking into the issue. Now the developer realized that since the values have been hardcoded he/she has to go and change each and every layer. Also the developer started exploring all the places where the values have been hard coded. So the commitment to the client can not be met. So what has started with a small change has become an ocean of changes now.
So while designing software it is the responsibility of the architect to make sure that the software is not rigid.


Fragility


Fragility is very closely related with rigidity. Fragility is the tendency of the software to break in many places every time there is change in the software. Often the breakage occurs in areas that has no conceptual link with the changed area. As the fragility of the software increases the chances of breaking increases with time. Such software is difficult to maintain. Every fix that has been introduced will cause more problem than solved.


Immobility


Immobility is the inability to reuse the software from other projects or parts of the same project. This comes when the system engineer finds that the same functionality which needs to be implemented is already available in a different part of the same project or in a different project. However often the modification to make it generic comes with a heavy price. So the engineers decide to re-write the entire code instead of reusing.

Viscosity
Viscosity of software comes in two forms 1. Viscosity of the design 2. Viscosity of environment. Whenever a change is being requested for a software engineers has multiple ways to implement it. Some of the ways preserver the existing design and some do not. Implementing in a way to preserve the design difficult and hence the viscosity is very high. Implementing without preserving the design is very easy and hence has low viscosity.
Viscosity of environment comes when the engineers compromise the design with development environment. For example when the engineers find that the recompiling the entire code takes time, the skip the recompiling of code compromising the design.
The four systems Rigidity, Fragility, Immobility, and Viscosity are the signs of a poor architecture. Software starts rotting after sometime if these points has not been covered properly while designing the software. What causes the software to rot? Well one of the main reasons for the software to rot is change in requirement.

No comments: