Templates
28 templates
- Hexagonal architecture: the orders moduleKeep the business rules in a core that declares ports, and plug HTTP, storage and providers in as adapters.TypeScriptIntermediate
- Hexagonal architecture: the orders moduleKeep the business rules in a core that declares ports, and plug HTTP, storage and providers in as adapters.GoIntermediate
- CQRS: the customer order historyChange orders through commands, and answer reads from read models that projections keep up to date.TypeScriptAdvanced
- CQRS: the customer order historyChange orders through commands, and answer reads from read models that projections keep up to date.GoAdvanced
- Event sourcing: the life of an orderStore what happened to an order as events, and rebuild its current state by replaying them.TypeScriptAdvanced
- Transactional outbox: publishing order eventsSave each event in the same transaction as the order, and let a relay publish it to the broker.TypeScriptAdvanced
- Transactional outbox: publishing order eventsSave each event in the same transaction as the order, and let a relay publish it to the broker.GoAdvanced
- State machine: the order lifecycleReplace status booleans with explicit states and one table of allowed transitions.TypeScriptIntermediate
- Single responsibility: placing an orderSplit a class along its reasons to change, so each change touches one small piece.TypeScriptIntermediate
- Open/closed: discount rulesAdd a new discount by adding a rule, without editing the code that computes prices.TypeScriptIntermediate
- Liskov substitution: shipping productsA subtype must keep every promise of the type it stands in for, or not claim to be one.TypeScriptIntermediate
- Interface segregation: payment methodsGive each client an interface with only the methods it calls, so no implementation has to fake the rest.TypeScriptIntermediate
- Interface segregation: payment methodsLet each client declare an interface with only the methods it calls, so no implementation has to fake the rest.GoIntermediate
- Dependency inversion: confirming an orderMake the business code own the interfaces it needs, and let the infrastructure plug into them.TypeScriptIntermediate
- Dependency inversion: confirming an orderMake the business code own the interfaces it needs, and let the infrastructure plug into them.GoIntermediate
- Strategy: shipping optionsPick an algorithm at runtime without the caller knowing which one runs.TypeScriptIntermediate
- Strategy: shipping optionsPick an algorithm at runtime without the caller knowing which one runs.GoIntermediate
- Observer: reacting to an orderAnnounce that something happened and let any number of subscribers react, without knowing them.TypeScriptIntermediate
- Observer: reacting to an orderAnnounce that something happened with the platform's EventTarget, and let any number of subscribers react.JavaScriptIntermediate
- Decorator: sending notificationsAdd behaviour to an object by wrapping it in another object with the same interface.TypeScriptIntermediate
- Decorator: sending notificationsAdd behaviour to a function by wrapping it in another function with the same signature.JavaScriptIntermediate
- Decorator: sending notificationsAdd behaviour to a value by wrapping it in another value with the same interface.GoIntermediate
- Factory Method: shipping parcelsLet subclasses decide which object to create, inside an algorithm the base class keeps.TypeScriptIntermediate
- Adapter: taking paymentsWrap a foreign interface in one class that speaks the interface your code expects.TypeScriptIntermediate
- Adapter: taking paymentsWrap a foreign interface in one type that speaks the interface your code expects.GoIntermediate
- Composition vs inheritance: a product catalogueBuild objects from small, swappable parts instead of a tree of subclasses.TypeScriptBeginner
- Composition vs inheritance: a product catalogueBuild objects from small, swappable parts with a factory function instead of a tree of subclasses.JavaScriptBeginner
- Composition vs inheritance: a product catalogueBuild values from small, swappable parts instead of a chain of embedded structs.GoBeginner