This course focuses on the Refactor step in TDD, teaching developers to spot code smells and resolve them through refactoring. Using real-world examples, you'll identify common issues, apply refactoring techniques, and ensure functionality is preserved with existing tests.
Overview
Syllabus
- Unit 1: Eliminating Duplicated Code: Extract Functions and Refactor Magic Numbers
- Refactor Duplicated Code in the Tests
- Refactor Tests using Parameterization
- Extract Function: calculateItemCost
- Refactor duplication between calculate functions
- Refactor Magic Numbers to Constants
- Unit 2: Refactoring Long Methods with the Extract Method Technique in Go
- Extract user validation logic
- Extracting validation into smaller functions
- Extract data normalization code
- Setting our sights on the DataStore
- Unit 3: Long Parameter List: Introduce Parameter Object
- Streamline Parameters with a Parameter Object
- Introduce a CoursePolicy parameter object
- Re-order parameters for cohesion
- Provide defaults for most parameters
- Unit 4: Feature Envy: Move Method Refactoring with TDD
- Extract StudentGrade Logic
- Refactor: MoveMethod CalculateFinalGrade
- Eliminate the GradeAnalyzer
- Eliminate Feature Envy from the Student
- Unit 5: Large Class: Extract Class
- Extract a CartItemCollection
- Extract the PriceCalculator class
- Extract a DiscountCalculator class
- Write Tests for Extracted Classes