Identifying code smells
So, how do you know whether your code has issues?
How do you know whether food has spoiled, clothing needs to be washed, or a diaper needs changing? It turns out that it just smells bad.
There are some metrics about what constitutes “good” and “bad” code, and we’ll explore them in Chapter 12: Code Analysis in Visual Studio and Chapter 16: Adopting Code Standards. Smelly code can be subjective to some degree or another. A developer who wrote a section of code or frequently modifies that portion of code may find the code to be more tolerable than a developer encountering the code for the first time.
While not all pieces of technical debt are identical, it turns out that many pieces of legacy code share a set of common symptoms.
These symptoms are commonly referred to as “code smells” and can include the following:
- It’s difficult to understand what it does or why it does it
- You or people...