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

CodeSignal

Breaking Dependencies to Improve Code

via CodeSignal

Overview

Breaking dependencies is crucial in existing systems to make them more testable, maintainable, and extensible. By reducing coupling and isolating functionality, developers can introduce changes incrementally while minimizing risks. In this course we focus on removing coupling with traits and dependency injection techniques for testability.

Syllabus

  • Unit 1: Refactoring Tight Coupling with Traits
    • Order Processing System in Action
    • Class Level Fields for Better Performance
    • Traits for Better Code Design
  • Unit 2: Dependency Injection with Constructors
    • Adding a Constructor to the Order Processor
    • Mocking Dependencies for Order Tests
    • Testing Failed Payments with Mocks
    • Handling Missing Products in Order Processing
    • Testing Exception Handling in Order Processing
    • Testing Order Totals with Different Prices
  • Unit 3: Dependency Injection with Methods
    • Optional Parameters for Dependency Injection
    • Mocking Dependencies for Order Processing
    • Testing Order Processing with Missing Customer
    • Testing Missing Products in Order Processing
    • Testing Failed Payments in Order Processing
    • Testing Error Handling in Order Processing
  • Unit 4: Removing Global State
    • Create Order Configuration Trait
    • Configuration Injection for Order Processing
    • Testing for Maximum Item Limit
    • Testing Bulk Discount Order Processing
    • Testing Orders Without Bulk Discounts

Reviews

Start your review of Breaking Dependencies to Improve Code

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.