top | item 34569794

(no title)

adamkl | 3 years ago

It’s true that people don’t do it, because of language conventions, but there is no barrier to entry when it comes to writing functions (or methods in these languages) that operate solely as transformations of inputs to outputs. You then orchestrate these “pure” functions with simpler side-effectful methods that handle the external dependencies (data fetching/writing etc).

There’s no pushback because of “strange” FP patterns, code looks just like normal imperative code, but the tricky logic can be isolated in pure functions. The push back is only because of the strong OOP conventions.

discuss

order

badpun|3 years ago

> but the tricky logic can be isolated in pure functions

That's not really FP though. In FP, you only have pure functions and not a mix of pure and impure.

adamkl|3 years ago

Perfect is the enemy of good. I’ll take any percentage of pure functions that I can get.

dack|3 years ago

creating and transforming immutable data structures can be a big pain in some languages though, and that's it's own barrier. java is a good example but it's getting better with record types etc