r/programming • • May 15 '18

Demystifying functional programming (in a real company)

https://medium.com/building-nubank/demystifying-functional-programming-in-a-real-company-e954a2591504
127 Upvotes

51 comments sorted by

View all comments

53

u/doomchild May 16 '18

We snuck functional programming in by the backdoor. We wrote a useful little extras library in Java that had Maybe, Either, and Validation, and got everybody to use it, then told them they'd been using FP without knowing it.

0

u/[deleted] May 16 '18

[deleted]

14

u/doomchild May 16 '18

I stab people who talk like that. It's a freaking box that aggregates error cases or passes through a successful value. Mathy talk makes me angry.

14

u/[deleted] May 16 '18

so it's not just me?

i remember the first time i went to look up the term 'dependency injection' only to be greeted with articles laid out as a fractal of jargon.

why didn't you say 'we're just going to pass shit in through a parameter'?

4

u/doomchild May 16 '18

It's definitely not just you.

2

u/liuwenhao May 16 '18

IoC CONTAINERZ !!!

1

u/Milyardo May 17 '18

People who are partial to math jargon inclined didn't come up with dependency injection. It's the design everything by committee crowd who came up with that. Computer scientist find dependency injection just as pretentious.

5

u/DonnyTheWalrus May 16 '18

It's fine when you're talking about the literal math side of programming -- type theory, etc., which many users of FP are involved with. One of the main attributes of pure FP is correctness, alongside expressiveness in the type system, both of which are derived from the formal mathematical definitions of the language and its evaluation. But I agree that reliance on this sort of jargon when talking about practical applications is off-putting.

The problem as I see it is there's often no clear delineation between places that talk about the math dimension of FP and those who talk about the practical side of it. A lot of writers on FP topics seem to assume that most FP users are similar in background to themselves. Furthermore, when you do have the background to understand what a monad is, or a monoid, or etc., there's no more efficient way to communicate exactly what you're intending than by using those well-defined terms.

For anyone who's curious about FP but is also put off by this sort of jargon, I've found F# for Fun and Profit to be a good resource; Scott Wlaschin stays away from jargon for jargon's sake and is very focused on the practical. For instance, he has a pretty well known post on what he terms railway-oriented programming, which is essentially about monads, bind, and so on but explained very clearly. It's obviously focused on F#, but F# is basically OCaml/.NET with some extras, so most of it is fairly generally applicable.

1

u/doomchild May 16 '18

I think that's my biggest source of frustration. Not all of us got through all the math required by our college.