Overview

Have you ever had the feeling, when looking at some code, that it just “isn’t great”, even when there isn’t a particular error or problem? This is often because the code is ‘smelly’, i.e. there is just something off about it. Today we’ll be focusing on formalizing this feeling and what tends to be wrong with code that has this feel to it and how to fix it.

Basic Learning Objectives

Before class, you should be able to:

  • Explain the idea behind ‘code smells’ and how to identify them

Advanced Learning Objectives

After class, you should be able to:

  • Identify and fix common ‘smelly’ code issues

Readings

To achieve the basic learning objectives, read the following in Clean Code:

  • Ch 17 (you can skip the Java specific ones, though you might find them interesting)
  • (Optional) Specific Code Smells from Refactoring Guru

Checks

You don’t need to memorize all these code smells, but you probably spotted a few that you are particularly likely cause. Make a list of the code smells from this chapter that you think are most important for you to remember.