Snippets created by Tao Liu

  • 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).

    81 people like this

    Posted: 11 years ago by Tao Liu

  • Observer pattern

    Observer pattern in F#

    34 people like this

    Posted: 11 years ago by Tao Liu

  • State Pattern

    the interest rate is decided by the internal state: account balance

    34 people like this

    Posted: 11 years ago by Tao Liu

  • Command pattern for Redo-Undo

    Command pattern for redo-undo scenario.

    47 people like this

    Posted: 11 years ago by Tao Liu

  • Singleton Pattern

    singleton pattern in F#

    39 people like this

    Posted: 11 years ago by Tao Liu

  • Proxy Pattern

    Proxy pattern is a class functioning as an interface to something else.

    37 people like this

    Posted: 11 years ago by Tao Liu

  • WPF / SilverLight Converter II

    version 1 is http://fssnip.net/62. This new version support convert from any existing function to a converter function by using composition and pipeline. The convert function is to make the function signature agree to the IValueConverter interface. You can add new functions in the FunctionLibrary module and reuse the class definition to reduce the coding effort. The first sample is to show how to make the converter pipeline work, the second one is a debugger converter used to debug the data binding problem.

    87 people like this

    Posted: 11 years ago by Tao Liu

  • Template 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: 11 years ago by Tao Liu

  • WPF Command in F#

    demonstrate how to use object expression to create a WPF/Silverlight command.

    22 people like this

    Posted: 10 years ago by Tao Liu