Hello everyone and welcome to my blog! This week I decided to write a blog on design smells. In programming, we write a lot of code and even a small mistake in the code tends to break the whole program which brings down the efficiency of the code. Design smells refer to the mistakes in the code that had to do with the way the programmer wrote the code which then tends to make a lot of problems due to the design on how the code is written. Design smells are structures in the design that indicate a violation of fundamental design principles and negatively impact design quality. If a programmer focuses less on code design, later the program tends to break easily even if a small feature needs to be added to it. In the article, Mr. Fowler says code smell is a surface indication that usually corresponds to a deeper problem in the system. Design smells are easy to spot if we know about them and what they are, hence, some of the common design smells are:
Rigidity: The program breaks if a single change is made in the code, hence had to go back, and make several changes to make the code work.
- Immobility: the parts of the code if can be used in other system can’t be moved because of the high risk of breaking the original code.
- Fragility: changes in the code that could make error in the different unrelated parts to the program, hence making it difficult to even change small section of the code.
- Viscosity: Making the changes in the program in a right way is harder hence, code is easy to be broken.
- Needless Complexity: having the code that is not useful and make the code hard to understand.
- Needless Repetition: Various Repetition of functions in the code can be removed by refactoring the program.
- Opacity: The functionality of a system or feature is unclear, or the code is unclear and very difficult to understand.
I choose this article because as a programmer above things are something we don’t want in our code, by learning about design smells one can know where to find it in the code and once you find it following the best practices such as refactoring can help solve design smells. As a programmer in the future knowing about these design smells helps me later in my everyday task in my job.