Code smell

Immobile code

Code is immobile when parts of the code that could have been useful in another place can’t be reused because it’s tangled up in some other part of the code.

Rigid code

Cascading changes. Code is rigid when it’s difficult to change because a small change in one place triggers the need for another change in a seemingly unrelated place of the code. The more cascading changes that occurs and the more modules or classes that get affected, the more rigid the code.

A typical example in PHP is when a code in several places refers to array elements by their numerical index, assuming that the array will always have the same fixed number of elements. If some code is changed so that the array is constructed differently, any statement that refers to a numerical element in the array might break. A change in one place leads to a lot of changes in other places.

Note that code can be both fragile and rigid at the same time.

Fragile code

Code is fragile when a small change in one place causes the several other parts of the system to stop fail. Fragile code tends to be difficult to change without introducing lots of new bugs. As soon as one bug is fixed, a slew of new and conceptually unrelated bugs appear. An common cause of fragile code is when it makes can be that the code makes assumptions about the time zone in a way

Note that code can be both fragile and rigid at the same time.


2 Replies to “Code smell”

  1. I precisely wanted to thank you very much all over again. I’m not certain the things that I might have gone through without the actual recommendations contributed by you on this situation. Entirely was the frightening crisis in my circumstances, however , encountering your professional mode you solved that took me to leap over delight. Now i’m thankful for this support and then have high hopes you recognize what an amazing job you are always getting into training people thru your webpage. I am certain you have never come across all of us.

Leave a Reply

Your email address will not be published. Required fields are marked *