I’m senior software engineer specialized in declarative designs and S.O.L.I.D. and Agile lover.
Yet more code smells? Aren't them enough?
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.
RegEx are a wonderful tool, we should to use them carefully and not to look smart.
Regular expressions are a valid tool. There's not much automated way of checking for possible abusers. A whitelist might be of help.
Regular expressions are a great tool for string validation. We must use them in a declarative way and just for strings.
Names are very important to understand pattern meanings.
If we need to manipulate objects or hierarchies, we should do it in an object way.
Unless we have a conclusive benchmark of impressive performance improvement.
A Perl program is correct if it gets the job done before your boss fires you.
Compilers and warnings lights are there for help. Don't ignore them.
Most languages have warning levels. We should turn most of them ON.
We should run linters to statically analyze our code for potential problems.
If we ignore warnings and the code moves on sooner or later it will fail.
If the software fails later it will be very difficult for us to find root cause.
Defect will likely be near first warning and far away from the crash.
If we follow the Broken Windows Theory, we should not tolerate any warnings, so a new issue will not pass unnoticed in a sea of tolerated warnings.
One man's crappy software is another man's full time job.
Inheritance. Concrete classes. Reuse. A fantastic mix up.
Overriding a concrete method is a clear smell. We can enforce these policies on most linters.
Abstract classes should have just a few concrete methods. We can check against a predefined threshold for offenders.
Accidental sub-classification is the first obvious advantage for junior developers.
More mature ones find composition opportunities instead.
Composition is dynamic, multiple, pluggable, more testable, more maintainable and less coupled than inheritance.
Only sub-classify an entity if it follows the relationships behaves like.
After sub-classing the parent class should be abstract.
Software is a gas; it expands to fill its container.
Compilers are smarter than us. On a Friday night production deploy they betray us.
Many of this vicious are encouraged by languages themselves.
We should be very declarative and explicit and don't abuse language accidental magic solutions.
Programmers pretend to be smart by exploiting language features.
They feel they belong to community standards that enforce bad behaviors like a sect.
Hackers are arrogant geek romantics. They lack the attentive spirit of inquiry.
Methods should be interchangeable if they do the same.
This is a semantic mistake. We could add a warning for similar method names on Polymorphic classes.
Naming is very important. We need to name after concepts and not after accidental types.
If you have three pet dogs, give them names. If you have 10,000 head of cattle, don't bother. Nowadays, the idea of giving a name to every file on your computer is ridiculous.
We are done for now. But we are pretty sure we will come across even more smells very soon!
I keep getting more suggestions on twitter, so they won't be the last!
Create your free account to unlock your custom reading experience.