first seeds planted

This commit is contained in:
Lukasz Skotarek 2023-01-29 13:16:41 +01:00
parent fa52922077
commit 965776fde3
22 changed files with 126 additions and 222 deletions

15
_notes/solid for fp.md Normal file
View file

@ -0,0 +1,15 @@
---
title: SOLID for FP
---
<status>Status: 🌱 </status>
I have OOP brackground and used SOLID and other OOP techniques to make my code better.
Since then I switched to FP and feel like there's not enough `guidelines` for writing FP code. At the same time I have a hunch that some of the OOP wisdom can be applied here.
- **S**ingle Responsibility Principle - this one is easy and free to take. Just make sure that your methods have "one reason to change" - a single responsobility. Make them small and specialized. Anything with `and` in name can be a sign that there's too much going on
- **O**pen Close Principle - this one is trickier, but if we say that refactoring is flow of making code open to extension - this makes things easier to adapt. Basically you want to be able to add new functionalities withtout altering existing code - and this can be achieved in FP.
- **L**iskov Substitution Principle -
- **I**nterface Segregation Principle -
- **D**ependency Inversion Principle - can be argued to go with "top level module" as main dependency, instead of more specialized ones.