Upcase header logo small

Learn with thoughtbot
Menu
×
Clean code

Clean Code

Refactoring

Refactoring is improving the quality of code without changing its behavior. Refactoring often is one key to keeping development speed high.

Exercise

Explaining Variable

Learn how to simplify a method by breaking it down using explaining variables.

Exercise

Replace Variable with Query

Learn to replace variables with query methods.

Exercise

Extract Method

Extracting methods makes complicated code clearer and encourages re-use. It also also encourages you to name a collection of operations, which tends to improve readability.

Exercise

Extract Class

Learn how to safely split up classes in small steps.

Exercise

Null Object: Part One

Learn to encapsulate logic surrounding nil by introducing Null Object classes.

Exercise

Null Object: Part Two

Take your Null Object skills to the next level by completing this additional exercise.

Exercise

Extract Value Object

Learn how to simplify a class by extracting a value object.

Exercise

Introduce Parameter Object

Learn how to replace a long list of parameters with a single parameter object.

Exercise

Extract Validator

Learn how to extract a validator into its own class with this exercise.

Exercise

Cleaning up a Controller

Slim down a controller that's gotten a bit bloated.

Exercise

Replace Conditional with Polymorphism

Learn how you can interact with entities of different types by replacing conditionals with polymorphism.

11 steps remaining

Exercises

Explaining Variable

Learn how to simplify a method by breaking it down using explaining variables.

Replace Variable with Query

Learn to replace variables with query methods.

Extract Method

Extracting methods makes complicated code clearer and encourages re-use. It also also encourages you to name a collection of operations, which tends to improve readability.

Extract Class

Learn how to safely split up classes in small steps.

Null Object: Part One

Learn to encapsulate logic surrounding nil by introducing Null Object classes.

Null Object: Part Two

Take your Null Object skills to the next level by completing this additional exercise.

Extract Value Object

Learn how to simplify a class by extracting a value object.

Introduce Parameter Object

Learn how to replace a long list of parameters with a single parameter object.

Extract Validator

Learn how to extract a validator into its own class with this exercise.

Cleaning up a Controller

Slim down a controller that's gotten a bit bloated.

Replace Conditional with Polymorphism

Learn how you can interact with entities of different types by replacing conditionals with polymorphism.