All Code Smells Summarized as Time-Saving One-Liner

Arnold Abraham
8 min readAug 25, 2022

Is it a smell or not? Get a quick answer by One-Liner Code-Smells

Image Made By The Author Via Canva.com

Code smells are certain indicators of problems in code and express that something is wrong. It is important to pay attention to code smells.

These aren't dogmas but indicate that values may be under threat.
Values in terms of evolvability, correctness, production efficiency, and continuous improvement.

It is important to take action if a code smell makes code unchangeable.
Hence I made a list from A to Z to be used to quickly identify code smells.

Afraid To Fail

When you add extra checks to a method (outside its scope) to avoid exceptions.

Solution: A method that can fail should fail explicitly.

Alternative Classes with Different Interfaces

Two separate classes provide one or many method/s for an identical action.

Solution: Don't Repeat Yourself by merging or outsourcing.

Base Class Depends on Subclass

If a child class adapts, the parent class needs adaptation too.

--

--

Arnold Abraham

JavaScript, TypeScript and C#/.NET Tutorials/News/Best Practices by a German Software Engineer - Fun helps you to learn on the fly --> arnoldcode.com