Refactoring and code smells
Somewhere along the way code goes from good to bad. It's usually a combination of many small factors that when allowed to take hold in your project, makes it hard to work with and downright frustrating. Your code starts to smell... bad...
Open presentation slides
Focus of this lesson
In this workshop you'll work together in a team. You'll get to know some of the most common code smells and how to fix them. After this workshop you'll know the basics of clean code and how to refactor your smelly code with test coverage.
What you need
- IntelliJ Community Edition: IntelliJ Community Edition
- Java dev kit: Java SE Development Kit
How to get started
- Start by cloning this repository into a folder on your computer. If you've never used git before, you can alternatively use the the "Download ZIP" button to the right.
- Although you have this
README.mdfile on your computer it's easier to read it on GitHub, so we recommend you keep this page open with the exercise tasks.
Exercise
Go to Exercise - Fix the smelly code to get started.
Helpful resources
- IntelliJ User interface
- IntelliJ interactive training course
- IntelliJ for Eclipse users
- IntelliJ testing
See smells.md for a shortlist of code smells and how to fix them.
Symbols and notation used in exercises
Icons with special meaning
- ✏️ - A task you should do
- 📖 - A section of text to read (no tasks, just information).
- 💡 - Additional information.
- ❗ - Something important.
- ❓ - Open-ended question for the reader ("What do you think would happen if...")
- 💩 - Bad practice (don't-do-this)
- ⭐ - A bonus task (not required)
Keyboard keys
Will look like this:
CTRL + ALT + C
Diff blocks
Emphasizes how lines of text should change.
- this text was removed + and replaced with this text