4 ms·
The first code iteration in this article could have been deployed to Production before I finished reading the rest of the article. Functional programming defin
by oxfordmale 4y ago
The first code iteration in this article could have been deployed to Production before I finished reading the rest of the article.
Functional programming definitely has its use cases, as side effects can introduce bugs. Unfortunately real world business logics often does require side effects. Often you only find out about side effects later in a project, and then you suddenly need to start hacking your clean functional approach.
- mrkeen 4y ago> side effects can introduce bugs > real world business logics often does require side effects > you suddenly need to start hacking your clean functional approach These are great arguments as to why you need: a) A type system which tracks effects b) A language which makes refactoring safe and easy
- z9znz 4y ago> real world business logics often does require side effects Yeah, all business logic requires side effects, else it is doing nothing :). But following some FP practices, you can push the side effects very far out to ward the edges. Instead of typical OOP, where objects get passed around and mutated anywhere and everywhere (which makes identifying where certain things started to go wrong), with pure, single responsibility functions you can write very simple but thorough tests which give you vastly more confidence about the code. And as a huge added benefit, the lines of test code actually go down because there's so much less setup and teardown (mocking, stubbing, etc.).