Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/davidraab/functionalpatterns
OO Design Patterns in F#
https://github.com/davidraab/functionalpatterns
design-patterns fsharp functional-programming oop
Last synced: 7 days ago
JSON representation
OO Design Patterns in F#
- Host: GitHub
- URL: https://github.com/davidraab/functionalpatterns
- Owner: DavidRaab
- License: mit
- Created: 2022-07-04T13:59:25.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-07-05T14:38:30.000Z (over 2 years ago)
- Last Synced: 2023-09-29T14:20:50.842Z (about 1 year ago)
- Topics: design-patterns, fsharp, functional-programming, oop
- Language: F#
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Overview
This project shows different OO Design Patterns and how I solve them
in F### Builder
Instead of directly creating functions with a string output i use a data-structure.
Using a data-structure has many advantages. For example you need only one
function to create proper HTML code with escaping and user rules. Instead of
re-doing this, again and again.You also can create structures that can be easily re-used.
## Decorator
* Decorator1.fsx - Example from Video - I would change nothing
* Decorator2.java - A "good" Java Example of Decorators
* Decorator2A.fsx - Solution with DU and plain functions
* Decorator2B.fsx - Solution with a common Record## Factory
* Factory1.fsx - PHP CarFactory example re-written in F#
* Factory2.fsx - Wikipedia IPerson example re-writte in F#
* Factory3.fsx - My own Example showing Partial Application
* Factory4.fsx - A Java Example with Shapes converted to F### Interpreter
* Interpreter1.fsx - A simple Calculator
## Strategy
* Strategy1.cs - C# Example from Wikipedia
* Strategy1A.fsx - A more direct conversation of the C# version
* Strategy2B.fsx - An extended version that creates a data-structure## Further Resources
I started this project by watching a video, but then it turned into something different.
Here are various resources I used to create this project.* Functional Patterns: https://youtu.be/XiG-uuNKzF8
* Decorato2.java: https://www.philipphauer.de/study/se/design-pattern/decorator.php
* Factory1.fsx: https://www.ionos.de/digitalguide/websites/web-entwicklung/was-ist-das-factory-pattern/
* Factory2.fsx: https://en.wikipedia.org/wiki/Factory_method_pattern#C#
* Factory4.fsx: https://www.tutorialspoint.com/design_pattern/factory_pattern.htm
* Strategy1.fsx: https://en.wikipedia.org/wiki/Strategy_pattern#C#