Snippets tagged Design Patterns
Chain of responsibility
The following sample wants to make sure the person’s age is between 18 and 65, weight is no more than 200 and tall enough (>120).
70 people like this
Posted: 1 years ago by Tao LiuObserver pattern
Observer pattern in F#
34 people like this
Posted: 1 years ago by Tao LiuState Pattern
the interest rate is decided by the internal state: account balance
31 people like this
Posted: 1 years ago by Tao LiuAdapter pattern
Invoke the methods from incompatible types
88 people like this
Posted: 1 years ago by Tao LiuCommand pattern for Redo-Undo
Command pattern for redo-undo scenario.
44 people like this
Posted: 1 years ago by Tao LiuComposite pattern and Visitor Pattern
use composite pattern to construct a tree and visitor pattern to bring back the traverse result.
32 people like this
Posted: 1 years ago by Tao LiuSingleton Pattern
singleton pattern in F#
35 people like this
Posted: 1 years ago by Tao Liu
Factory Pattern
Factory pattern in F#
68 people like this
Posted: 1 years ago by Tao LiuDecorate pattern
implement the decorate pattern in F#. The decorate pattern is to add new featuures to an object at runtime.
36 people like this
Posted: 1 years ago by Tao LiuProxy Pattern
Proxy pattern is a class functioning as an interface to something else.
37 people like this
Posted: 1 years ago by Tao LiuChain of responsibility II
Unlike the previous chain of responsibility, this version use the pipeline to chain responsibilities.
93 people like this
Posted: 1 years ago by Tao LiuCommand pattern for Redo-Undo II
This command redo-undo implement group the command under Do/Undo category.
60 people like this
Posted: 1 years ago by Tao LiuStrategy pattern
Strategy pattern in F#
68 people like this
Posted: 1 years ago by Tao LiuTemplate pattern
Template pattern is a behavior-based pattern. Realized the importance of high order function, this is a way to use high order function. Still keep the type structure to organize my code.
38 people like this
Posted: 1 years ago by Tao Liu