https://github.com/josestg/poc-validate
https://github.com/josestg/poc-validate
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/josestg/poc-validate
- Owner: josestg
- Created: 2022-12-31T04:23:58.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-31T04:28:35.000Z (over 2 years ago)
- Last Synced: 2025-01-31T06:47:29.932Z (3 months ago)
- Language: Go
- Size: 8.79 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Proof of Concept: Builder Pattern using Functional Programming Style
The Builder Pattern is a design pattern that allows the construction of complex objects step by step, through a flexible and customizable process. In object-oriented programming (OOP), the Builder pattern typically uses setters to modify the object's state. However, in functional programming (FP), we do not have object state, so we need to use a different approach. One approach is to use function composition (just like function composition in math), which involves using a function that returns a function. This returned function acts as the builder, allowing us to customize the construction of the complex object through a series of functions. This approach is inspired by the lambda calculus (a little, that why you will find function name like Indentity 😆), which is a formal system for defining functions and evaluating expressions.