mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-04 09:11:39 +00:00
Wasey's Submission - Gilded Rose Refactoring Design
This commit is contained in:
parent
9bcc8af37d
commit
ee14bca666
34
python/GildedRose_Design_Document.md
Normal file
34
python/GildedRose_Design_Document.md
Normal file
@ -0,0 +1,34 @@
|
||||
# Gilded Rose Design
|
||||
|
||||
**Pattern Used:** Strategy Pattern
|
||||
|
||||
---
|
||||
|
||||
## The Problem
|
||||
|
||||
The original code is a mess of nested if-statements. Hard to read, hard to change.
|
||||
|
||||
## The Solution
|
||||
|
||||
Give each item type its own class to handle updates:
|
||||
|
||||
- **NormalUpdater** - normal items degrade
|
||||
- **BrieUpdater** - gets better with age
|
||||
- **BackstageUpdater** - special concert rules
|
||||
- **SulfurasUpdater** - never changes
|
||||
- **ConjuredUpdater** - degrades 2x faster
|
||||
|
||||
## Why This Works
|
||||
|
||||
1. **Easy to add new items** - just make a new updater class
|
||||
2. **Easy to read** - each class does one thing
|
||||
3. **Easy to test** - test each updater separately
|
||||
|
||||
## Drawbacks
|
||||
|
||||
- More files to manage
|
||||
- Factory needs updating for new items
|
||||
|
||||
---
|
||||
|
||||

|
||||
BIN
python/gilded_rose_uml.png
Normal file
BIN
python/gilded_rose_uml.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 607 KiB |
Loading…
Reference in New Issue
Block a user