
Explore refactoring to design patterns by starting from the problem domain, transforming a complex subtitle generation tool into a maintainable solution that uses design patterns.
Explore how to name classes and structure namespaces while applying model-view-presenter and domain-driven design, isolate infrastructure concerns, and prepare for behavior extraction with strategies for decoupling.
Learn how to refactor a tightly coupled cleanup call into the strategy pattern by extracting an interface and a LinesTrimmer class, then decouple callers with an Execute method.
Understand the drawbacks of the composite pattern, including how it can create tree-like structures and hidden complexity, and learn how to maintain a linear pipeline when appropriate.
Move functions to objects to enable manipulation and processing through an interface, using composite and decorator patterns to wrap objects and support chainable text processing, leading to the builder pattern.
Learn how to prepare the ground for the builder by refactoring a complex text-to-subtitle process into discrete, timed text objects and a duration-aware pipeline.
Learn how to structure namespaces to prevent circular dependencies across domains, models, and text processing, and keep implementations organized with a clear, directed dependency flow.
Introduce an infrastructure layer to decouple the domain from low-level concerns, and define simple data loading and saving interfaces for dependency injection.
Identify domain rules and convert them into small, isolated objects that collaborate at run time. Explore a rule engine that splits text into sentences and selects the shortest output.
This course begins with examination of a realistic application, which is poorly factored and doesn't incorporate design patterns. The demo application converts text into subtitles for videos, which makes it quite useful in practice. Yet, it is nearly impossible to maintain and develop this application further, due to its poor structure and design.
That is the point at which the course begins. As demonstration after demonstration will unfold, we will refactor this entire application, one function and one class at a time. During refactoring, many design patterns will fit into place almost without effort. By the end of the course, you will know how code refactoring and design patterns - one coding practice and one design practice - can operate together and help each other create great design.