---
layout: post
title:  code smells episode 1: that shit is vile
date:   2018-06-25
tags: [ruby]
---
Mapping code smells and how to get rid of those dank odors.

| Smell | Conditions | Spells  |
| ----- | ---------- | ------- |
| **Duplicated code** | Same expression in two or more methods of the
same class | `Extract Method` |
|                     | Same expression in two sibling subclasses |
`Extract Method`, `Pull Up Method` |
|                | Similar expressions but not the same | `Extract
Method`, `Form Template Method` |
|                | Methods that do same thing with different approaches
| `Substitute Algorithm` |
|                | Same expression in the middle of two or more methods
| `Extract Surrounding Method` |
|                | Same expressions in two or more unrelated classes |
`Extract Class`, `Extract Module` |

---
layout: post
title:  code smells episode 1: that shit is vile
date:   2018-06-25
tags: [ruby]
---
Mapping code smells and how to get rid of those dank odors.

| Smell | Conditions | Spells  |
| ----- | ---------- | ------- |
| **Duplicated code** | Same expression in two or more methods of the
same class | `Extract Method` |
|                | Same expression in two sibling subclasses | `Extract
Method`, `Pull Up Method` |
|                | Similar expressions but not the same | `Extract
Method`, `Form Template Method` |
|                | Methods that do same thing with different approaches
| `Substitute Algorithm` |
|                | Same expression in the middle of two or more methods
| `Extract Surrounding Method` |
|                | Same expressions in two or more unrelated classes |
`Extract Class`, `Extract Module` |
| **Long method**  | Too many temporary variables | `Replace Temp with
Query`, `Replace Temp with Chain` |
|                | Too many method parameters | `Introduce Parameter
Object`, `Preserve Whole Object` |
|                | Still too many method parameters | `Replace Method
with Method Object` |
|                | Conditional expressions | `Decompose Conditional` |
|                | Conditional expressions | `Collection Closure
Methods` |

Add options for refactoring long methods
Add options for refactoring long methods
