marp | theme | style | footer | backgroundImage |
---|---|---|---|---|
true |
mytheme |
section.small li {
font-size: 20pt;
}
|
Workshop Design Patterns | 2022 |
url(xitasoblack.png) |
Thomas Ziemek & Alex Rampp
- Introduction
- Hands-On
- Pause
- Hands-On
- Discussion
SOLID
- Creational
- Structural
- Behavioral
- Factory
- Builder
- Prototype
- Singleton
- expose interface
- concrete type is only implementation detail
- seperate construction from usage
- contain dependencies needed for construction
- construct complex objects step by step
- construct object trees
- TestDataBuilder
- use Director to hide builder steps
- copy existing objects
- object itself is responsible
- ICloneable
- mitotic cell devision
- one instance
- public accessible
- threading :-(
- tests :-(
- Adapter
- Proxy
- Decorator
- Bridge
- Composite
- Facade
- Flyweight
- Anti-Corruption-Layer, DAL
- not a POCO
- using 3rd party libs or objects you can't change
- different interface
- lazy initialization
- access control
- api client
- same interface
- attach new behavior
- extension of a wrapper
- don't break the flow of request (-> CoR)
- enhanced interface
- composition over inheritance
- multi platform frameworks
- switch implementation at runtime
- ORM "wrapper"
- tree structure
- common interface
- i.e. price/space calculation
- simplified interface
- web API
- Chain of Responsibility
- Command
- Mediator
- Memento
- Observer
- State
- Strategy
- Template Method
- short circuit
- support hotline
- ASP.NET Core request pipeline
- request as standalone object
- contains all information
- supports undoable actions
- queue/schedule operations
- reduce dependencies
- reduce cohesion
- event notification through subscription
- dynamic changes
- coupling!
- save and restore previous state
- own object is responsible
- can access private fields
- history
- finite state machine
- skeleton in base class
- specify certain steps of an algorithm
- based on inheritance
- describe different ways of doing the same thing
- similar classes with different behavior
- isolate business logic from implementation details
- based on composition
We want to develop a Task API in an agile way.
- As a user, I want to add Task items.
- A Task item has a title.
- As a user, I want to retrieve indiviual tasks.
- As a user, I want to update the title of a specific task.
- As a user, I want to mark a task as completed.
- As a user, I want to add Project items.
- A Project item has a title, a description, an assigned user (eMail) and a deadline.
- As a user, I want to retrieve indiviual projects.
- As a user, I want to update the individual properties of a project.
- As a user, I want to add a task to a project.
- A task can only be assigned to one project.
- As a user, I want to retrieve a list of all projects with their title, deadline and status.
- A project is complete, when all tasks are complete.
- As a user, I want to add another type of task to a project, a Goal.
- A Goal has a title, a description and a due date.
- I want to execute the same actions as for a task.
- When a project is complete a mail should be sent to the assigned user.
- Singleton
- Service Locator - Anti-Pattern?
- Strategy
- Command
- Specification
- Primitive Obession/Value Objects
- Anemic domain model - Anti-Pattern?
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand" - Martin Fowler
Principles are rules or guideline
- define conditions or boundaries
- Code conforms to them or is wrong
Properties are qualities or characteristics
- define a goal or centre to move towards
- Code is closer to or further from the centre
Properties should be
- practical (easy to articulate, easy to access, easy to adopt)
- human (from the perspective of people, not code)
- layered (guidance for beginners, nuance for experienced)
- Composable (plays well with others)
- Unix philosophy (does one thing well)
- Predictable (does what you expect)
- Idiomatic (feels natural)
- Domain-based (in language and structure)
Dan North https://dannorth.net/2021/03/16/cupid-the-back-story/
Response from Uncle Bob https://blog.cleancoder.com/uncle-bob/2020/10/18/Solid-Relevance.html