My top 10 code smells
A code smell is a code construct that could lead an application to crash or encounter unexpected issues. As I showed in the repository pattern section, it is very easy to leave rubbish inside well-implemented design patterns. Admittedly, most modern continuous integration/continuous delivery (CI/CD) factories ship with code-analysis tools such as SonarQube that analyze code and detect code smells automatically. Nevertheless, here are the top 10 things I consider when reviewing code or assessing the results produced by such a tool:
- Memory leaks will for sure lead to process crashes: The sooner you detect them, the better.
- Improperly disposed objects: While memory leaks are annoying, they are easy to troubleshoot. Conversely, disposed objects that are still used somewhere are harder to find and often lead to erratic behaviors.
- ORM usage: It is great to abstract away the underlying data store but, in some situations (input/output (I/O)-intensive...