Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

CodeSignal

Refactoring by Leveraging Your Tests with Go & Testify

via CodeSignal

Overview

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.

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

Reviews

Start your review of Refactoring by Leveraging Your Tests with Go & Testify

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.