Wednesday, 10 May 2020
Hello tod@s,
You may wonder, what is a code smell or what is a God-class?
Well, in this Autana blog post, I will explain what each of these terms is.
Code smell: As you might have guessed, a code smell refers to code that “stinks”, this comes to mean a code that although technically not bad, and, therefore, does not contain bugs, it does contain code that fails in the design and therefore generates problems of refactoring, understanding the code, reuse, performance, etc.
Specifically I’m going to talk about the best known Code smell (probably), the God-class. The God-class is a class that contains ALL or almost all the functionality of the program and is supported by other classes that only contribute data surely while you learned to program you will have created a class that did everything. This in itself is not bad, there are times when centralization and a slight increase in performance is preferable over the problems generated by this code smell.
The problems:
– Limits the possibilities to modify the code, for example to add some functionality, without affecting the rest of the program.
– It is usually very inefficient, difficult to test and debug and to reuse any part of the code.
– And it will also use too many resources for any operation, no matter how small, that you want to perform.
The solution of something as complex as this code smell can become usually involves a refactoring.
Greetings and you know, be careful when designing your program do not create a God-class!

