Code smell & Refactoring

What? How can code smell?

Well, It doesn’t have the nose but definitely, it stinks!

Have you ever going through a code and feel that oh man, this should not be like this, We can do it in a better way!

Well,  it’s better now then never!

Code smell

Smell is by definition something that’s quick to spot – or sniffable.

When you see a code and your nose twitches and you think something wrong in that code like when you see a method that has more than 20 lines of code, that’s code smell!

According to Martin Fowler,

A code smell is a surface indication that usually corresponds to a deeper problem in the system.

Word was first used by Kent when he and Martin working on a Refactoring book.

Code smells are certain structures in the code that indicate a violation of fundamental design principles and negatively impact design quality.

Refactoring

It is a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior. 

-Martin Fowler

To remove code smells, You need to refactor a code. In upcoming blog post, I will introduce you to different code smells and refactoring techniques to remove them.

Stay tuned!

 

 

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.