编程范式
Software Architecture & Engineering · 40 notes
- Functional Options Patternhistorical
The functional-options pattern supplies default configuration and changes selected properties through option functions. These notes examine that construction approach.
- Function Types as Interfaceshistorical
An interface function is a function type that implements an interface, allowing ordinary functions and struct implementations to participate in the same interface-based calls.
- Event Sourcinghistorical
Event sourcing persists data changes as events. These notes start with traditional CRUD limitations and examine recording state changes through events.
- Publish–Subscribe Patternhistorical
Publish-subscribe involves publishers, an event center, and subscribers. Subscribers register interest in events and receive messages through the event center.
- Producer–Consumer Patternhistorical
Producers place data in a queue and consumers retrieve it for processing. These notes introduce the producer-consumer pattern through those three roles.
- Open–Closed Principlehistorical
The open-closed principle favors extension without modifying existing code, reducing the risks introduced by maintenance changes.
- Liskov Substitution Principlehistorical
The Liskov substitution principle requires subclasses to preserve the meaning and expectations of parent-class methods. These notes examine inheritance and extension through it.
- Dependency Inversion Principlehistorical
Dependency inversion favors interfaces over implementations and avoids direct high-level dependence on low-level details. These notes examine extensibility through that principle.
- Single Responsibility Principlehistorical
The single-responsibility principle keeps a class's responsibilities focused. These notes examine readability and maintenance through that idea.
- Interface Segregation Principlehistorical
Interface segregation keeps interfaces focused on clear responsibilities. These notes examine decoupling and readability through that requirement.
- Law of Demeterhistorical
The Law of Demeter asks a class to know as little as possible about other objects' internals, reducing coupling.
- Composition Reuse Principlehistorical
Composite reuse favors composition or aggregation over inheritance. These notes examine code reuse and extension through that principle.
- Object-Oriented Design Principleshistorical
Object-oriented design principles aim to improve maintainability, extensibility, and reuse. This page links notes on the individual principles.
- Object-Oriented Design Patternshistorical
Design patterns are reusable solutions to recurring problems. These notes organize patterns into creational, structural, and behavioral categories.
- Singleton Patternhistorical
The singleton pattern restricts a class to one instance. Implementation examples examine how that instance is created and accessed.
- Proxy Patternhistorical
The proxy pattern adds functionality through a proxy object without mixing unrelated logic into business code. These notes record implementations through examples.
- Template Methodhistorical
When an algorithm's overall steps are fixed but details vary, the template method keeps the process in a parent class and delegates variable parts to concrete implementations.
- Factory Methodhistorical
Factory methods delegate concrete-product creation to corresponding factories so callers depend on a creation interface. These notes compare them with simple factories through code.
- State Patternhistorical
The state pattern chooses behavior according to an object's current state. These notes compare it with the strategy pattern through examples.
- Builder Patternhistorical
The builder pattern assembles objects with multiple parts and complex construction steps, using a builder to organize construction.
- Strategy Patternhistorical
When a task has several possible approaches, the strategy pattern separates the algorithms and selects an appropriate strategy.
- Observer Patternhistorical
The observer pattern notifies observers when a target object's state changes. These notes introduce the notification relationship through those two roles.
- Decorator Patternhistorical
The decorator pattern adds functionality while retaining existing code by wrapping an object with additional behavior. These notes record the approach through examples.
- Chain of Responsibilityhistorical
A chain of responsibility links handlers for a type of request and passes requests along the chain. These notes illustrate it through scenarios such as Servlet filters.
- Adapter Patternhistorical
The adapter pattern translates between interfaces so an existing implementation can work through a different interface. These notes record that compatibility approach through code.
- Prototype Patternhistorical
When object creation requires substantial preparation, an existing object can be copied and adjusted. These notes introduce the prototype pattern through that idea.
- Abstract Factory Patternhistorical
An abstract factory creates families of related products. These notes examine factory responsibilities through scenarios requiring multiple product components.
- Simple Factory Patternhistorical
A simple factory separates object creation from usage, selecting and creating concrete instances. These notes illustrate that division through examples.
- Design Patterns I Have Usedhistorical
Questions and answers review design patterns used in practice, starting with singleton implementation and linking code with usage scenarios.
- Flyweight Patternhistorical
The flyweight pattern reuses many identical or similar objects to reduce repeated creation. These notes examine shared-object organization through examples.
- Facade Patternhistorical
The facade pattern places a complex process behind a unified entry point so callers can access internal functionality through a simpler interface.
- Bridge Patternhistorical
The bridge pattern handles class structures that vary along multiple dimensions. These notes use examples to show how to separate and combine those dimensions.
- Composite Patternhistorical
The composite pattern represents parts and wholes in a tree so callers can access leaf and container nodes consistently.
- Mediator Patternhistorical
Direct interactions among objects can create complex coupling. The mediator pattern places coordination in an intermediary, illustrated here through examples.
- Command Patternhistorical
Examples involving courses and command interfaces demonstrate the command pattern and how requests are wrapped as objects for execution.
- Memento Patternhistorical
The memento pattern stores an object's state for later restoration. These notes examine saving and retrieving state through scenarios such as undo.
- Visitor Patternhistorical
The visitor pattern separates data structures from operations into different classes. These notes use code to examine how operations act on the structure.
- Iterator Patternhistorical
Iterators provide a way to traverse aggregate objects separately from their structure. These notes record the pattern and its use in the JDK.
- Object-Oriented Programminghistorical
This page collects object-oriented programming topics, connecting design principles with creational, structural, and behavioral patterns.
- Programming Paradigmshistorical
Programs can be organized under different paradigms. These notes list procedural, event-driven, and object-oriented approaches and link their related topics.