Object-Oriented Programming

  1. Design Patterns in Object-Oriented Programming
    1. Creational Patterns
      1. Singleton
        1. Intent and motivation
          1. Implementation details
            1. Pros and cons
              1. Handling lazy initialization
                1. Thread safety issues and solutions
                2. Factory Method
                  1. Purpose and applicability
                    1. Implementation variants
                      1. Advantages over direct object instantiation
                        1. Use cases in large systems
                        2. Abstract Factory
                          1. Definition and structure
                            1. Comparison with Factory Method
                            2. Builder
                              1. Purpose of separating object construction from its representation
                                1. Applicability in building complex objects with numerous configurations
                                  1. Implementation using step-by-step construction
                                    1. Real-world usage examples
                                    2. Prototype
                                      1. Cloning existing objects to create new instances
                                        1. Deep vs. shallow copying
                                          1. Use cases in reducing cost of resource-intensive creation
                                        2. Structural Patterns
                                          1. Adapter
                                            1. Bridging incompatible interfaces
                                              1. Object adapter vs class adapter variations
                                                1. Practical applications in system interfaces
                                                2. Bridge
                                                  1. Separating abstraction from implementation
                                                    1. Use in preventing proliferation of subclasses
                                                      1. Examples in graphic rendering systems
                                                      2. Composite
                                                        1. Treating individual and composite objects uniformly
                                                          1. Structure and hierarchy of tree-like structures
                                                            1. Applications in user interface frameworks
                                                            2. Decorator
                                                              1. Dynamically adding responsibilities to objects
                                                                1. Comparison with subclassing
                                                                  1. Use in extending or modifying behavior of objects
                                                                  2. Facade
                                                                    1. Providing a simplified interface to a complex subsystem
                                                                      1. Role in reducing client dependency on subsystem classes
                                                                        1. Example scenarios in large-scale applications
                                                                        2. Flyweight
                                                                          1. Minimizing memory use by sharing common data
                                                                            1. Ideal use cases for this pattern
                                                                              1. Examples in managing large numbers of similar objects efficiently
                                                                              2. Proxy
                                                                                1. Controlling access and managing object creation
                                                                                  1. Types of proxies: Virtual, Remote, Protection, etc.
                                                                                    1. Implementation details and benefits
                                                                                  2. Behavioral Patterns
                                                                                    1. Chain of Responsibility
                                                                                      1. Passing request along a chain of handlers
                                                                                        1. Decoupling sender and receiver
                                                                                          1. Use cases in UI and event handling
                                                                                          2. Command
                                                                                            1. Encapsulating request as an object
                                                                                              1. Supporting undo, redo operations
                                                                                                1. Practical implementations for user actions
                                                                                                2. Interpreter
                                                                                                  1. Defining grammatical representation for language and interpreter
                                                                                                    1. Use in parsing and executing language syntax
                                                                                                      1. Effectiveness in domain-specific languages
                                                                                                      2. Iterator
                                                                                                        1. Access elements of a collection without exposure
                                                                                                          1. Various iterator patterns: internal vs. external
                                                                                                            1. Examples in traversal of data structures
                                                                                                            2. Mediator
                                                                                                              1. Reducing complexity by controlling interactions
                                                                                                                1. Decoupling colleagues through central mediator
                                                                                                                  1. Use in managing complex conversation logic
                                                                                                                  2. Memento
                                                                                                                    1. Capturing and externalizing object state
                                                                                                                      1. Supporting rollback operations
                                                                                                                        1. Usage scenarios where undo functionality is crucial
                                                                                                                        2. Observer
                                                                                                                          1. Establishing dependency and update relationships
                                                                                                                            1. Use in event-driven systems
                                                                                                                              1. Challenges with observer chains and performance
                                                                                                                              2. State
                                                                                                                                1. Allowing object behavior change with state variation
                                                                                                                                  1. State-specific interface realization
                                                                                                                                    1. Real-world applications in protocol design
                                                                                                                                    2. Strategy
                                                                                                                                      1. Defining family of algorithms and making them interchangeable
                                                                                                                                        1. Encapsulating algorithm variation
                                                                                                                                          1. Implementations in sorting algorithms and routing
                                                                                                                                          2. Template Method
                                                                                                                                            1. Defining skeleton of an algorithm in the superclass
                                                                                                                                              1. Deferring implementation to subclasses
                                                                                                                                                1. Use in code reuse and capturing invariants
                                                                                                                                                2. Visitor
                                                                                                                                                  1. Adding new operations to complex structures
                                                                                                                                                    1. Double-dispatch mechanics
                                                                                                                                                      1. Applications in traversing composite structures and code parser