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.
Overview
Syllabus
- Unit 1: Breaking Dependencies to Improve Code in C++
- Understanding and Reviewing the Order Processing System
- Improving Object Management in OrderProcessor
- Creating Interfaces for Database and Payment Dependencies
- Refactoring OrderProcessor to Use Interfaces
- Unit 2: Dependency Injection in C++: Enhancing Flexibility and Testability
- Implementing Dependency Injection with the Null Object Pattern
- Preparing Mock Objects for OrderProcessor Tests
- Testing Failed Payment Handling in Order Processing
- Testing Order Processing with Missing Products
- Testing Exception Handling in OrderProcessor
- Testing Order Processor with Varied Product Prices
- Unit 3: Method Dependency Injection in C++: Enhancing Flexibility and Testability
- Add Optional Dependencies to Process Order Method
- Testing Order Processing with Mock Dependencies
- Testing Order Processing with Non-Existent Customer
- Testing Non-Existent Product Handling in OrderProcessor
- Add Test for Payment Processing Failures
- Testing Exception Handling in Order Processing
- Unit 4: Refactoring Global State in C++: Enhancing Modularity and Testability
- Creating Order Configuration Interface and Implementation
- Integrating OrderConfiguration with OrderProcessor
- Add Configuration Injection Constructor to OrderProcessor
- Unit Testing the OrderProcessor with GoogleMock
- Testing Bulk Order Discounts with Mock Configuration
- Testing Orders Below Bulk Threshold