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 interfaces and dependency injection techniques for testability.

Syllabus

  • Unit 1: Refactoring Tight Coupling with Interfaces
    • Order Processing System in Action
    • Class Level Fields for Better Performance
    • Adding New Interfaces and Applying Them
    • Using New Interfaces in OrderProcessor Fields
  • Unit 2: Dependency Injection with Constructors
    • Adding a Constructor to the Order Processor
    • Mocking Dependencies for Order Tests
    • Testing Failed Payments with Mocks
    • Testing Order Processing with Missing Products
    • 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 Interface
    • Configuration Injection for Order Processing
    • Add Constructor for Custom Configuration
    • Mock Testing Order Processing Logic
    • 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.