I’m senior software engineer specialized in declarative designs and S.O.L.I.D. and Agile lover.
Are we done on code smells? Probably never!
We see several symptoms and situations that make us doubt the quality of our development.
Let's look at some possible solutions.
Most of these smells are just hints of something that might be wrong. They are not rigid rules.
Functions, lambdas, closures. So high order, nondeclarative, and hot.
Closures and anonymous functions are very useful to model code blocks, promises etc. So It'd difficult to tear them apart.
Humans read code. Software works ok with anonymous functions but
maintainability is compromised when multiple closures are invoked.
Object-oriented programming increases the value of these metrics by
managing this complexity. The most effective tool available for dealing
with complexity is abstraction. Many types of abstraction can be used,
but encapsulation is the main form of abstraction by which complexity is
managed in object-oriented programming.
Do you need help? Who are you gonna call?
Notice static methods.
Or we can make the former Helper stateless for reuse...
Code naming standards should forbid classes with this name on them.
This is a well established cultural name and a legacy habit from structured programming.
Most developers are reluctant to let old habits go.
We must be aware of the damage this kind of names are bringing us.
Do you check who are you talking to?
Since type checking methods are well known it is very easy to set up a code policy checking the uses.
Booleans should be just True and False
This is a language feature. Some strict languages show warnings with this magic wizardry.
Some languages encourage doing some magic abbreviations and automatic castings. This is a source of errors and a Premature Optimization warning.
We should always be as explicit as possible.
It is not the language that makes programs appear simple. It is the programmer that make the language appear simple!
Patterns are awesome. With great powers comes great responsibility
It would be very difficult to create automatic detection rules.
A class name with more than one pattern on it, is a warning.
Chose when to apply a pattern solution. You are not smarter for using too many patterns. You are smart if you choose the right opportunity for everyone.
When you have a hammer, every problem looks like a nail.
Will it be the end? Are we done? Guess not!
Create your free account to unlock your custom reading experience.