OOP设计模式
Software Architecture & Engineering · 26 notes
- Object-Oriented Design Patternshistorical
What design patterns are and the three main categories: creational, structural, and behavioral.
- Singleton Patternhistorical
A class has one and only one instance, with Java and Go implementations including eager, lazy, DCL, static-inner-class, enum, mutex, and sync.Once approaches.
- Proxy Patternhistorical
The proxy pattern adds functionality around an existing class or function without changing the original code, with static, dynamic, AOP, Go, and cache-proxy examples.
- Template Methodhistorical
The template-method pattern applies when the overall algorithm steps are fixed while some parts vary, with Java and Go implementations and a combined template/factory/strategy example.
- Factory Methodhistorical
The factory-method pattern uses multiple factory classes and delays concrete product creation to subclasses.
- State Patternhistorical
The state pattern selects different processing logic according to the current state, with Java and Go examples.
- Builder Patternhistorical
The builder pattern constructs a complex object from many smaller parts; the builder creates the parts and the director assembles them.
- Strategy Patternhistorical
The strategy pattern selects one of several algorithms for accomplishing the same task according to a type or context, with Java and Go examples.
- Observer Patternhistorical
The observer pattern broadcasts state changes from a subject to observers, with Java, Go, and application examples.
- Decorator Patternhistorical
The decorator pattern adds new functionality to a class or function without changing the original code, with Java and Go examples.
- Chain of Responsibilityhistorical
The chain-of-responsibility pattern links handlers that can process the same type of request, with Java, Go, and filter-chain examples.
- Adapter Patternhistorical
The adapter pattern is used to make an old-system interface compatible with a new interface, with Java and Go examples.
- Prototype Patternhistorical
Prototype-pattern notes with UML, Java and Go clone examples, plus a generic DAO example that returns cloned data.
- Abstract Factory Patternhistorical
Abstract-factory notes showing related product families and a Go implementation with engines, wheels, factories, and a client.
- Simple Factory Patternhistorical
Simple-factory notes in Java and Go, followed by a generic template-method + simple-factory + strategy example.
- Design Patterns I Have Usedhistorical
A short interview-style note on where singleton, prototype, factory, builder, facade, decorator, template method, state, strategy, and proxy patterns were used.
- Flyweight Patternhistorical
Flyweight-pattern notes with UML and a Java example using a chess-object pool.
- Facade Patternhistorical
Facade-pattern notes with UML plus Java and Go examples that wrap a complex process behind one interface.
- Bridge Patternhistorical
Bridge-pattern notes for class hierarchies with multiple varying dimensions, with UML and a Java brand/device example.
- Composite Patternhistorical
Composite-pattern notes for tree-shaped whole/part structures, with Java and Go file-tree examples.
- Mediator Patternhistorical
Mediator-pattern notes with UML, a Java department example, and a Go computer-component example.
- Command Patternhistorical
Command-pattern notes with a Java Course example, command objects, and a command invoker.
- Memento Patternhistorical
Memento-pattern notes showing how to save an object's state and restore it later.
- Visitor Patternhistorical
Visitor-pattern notes separating data structures from operations, with a Java course example.
- Iterator Patternhistorical
Iterator-pattern notes showing Java and Go implementations for traversing aggregate objects.