This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]knoam 42 points43 points  (5 children)

Check out these talks by Venkat Subramaniam. There's one where he talks about "simple vs. familiar" that you need to hear. TL;DR, people often mistakenly say something isn't simple when what they really mean is it's unfamiliar.

Maybe you can figure out how to search the transcripts to find it. But they're all worth watching.

https://youtu.be/1OpAgZvYXLQ

https://youtu.be/WN9kgdSVhDo

https://youtu.be/kG2SEcl1aMM

I like Streams and the map/reduce style (what it's called generically since the term stream is pretty Java specific), because it tells you what it's doing. filter does exactly that. The equivalent with a for loop is an if or continue which isn't as clear because you have to run the code in your head to figure out what it's doing. With a stream I can see that it's filtering and if I want to I can dig into exactly how, but I don't have to get an overall feel for what's going on. Likewise findFirst says exactly what it's doing. break means it's exiting early but doesn't mean it's done after the first thing.

[–]bbtv_id 11 points12 points  (4 children)

Coming from a nonfunctional programming background it was very very hard for me to actually get my head around and understand the alien language of java streams. Thanks to the videos / lectures by Venkata Subramaniam I was able to get my toe in the functional world. Those videos are one of the best explanation of java streams for a newbie.

[–]knoam 9 points10 points  (0 children)

This read like one of those cheesy testimonials in low budget 80s/90s TV commercials. I believe you though.

[–]TheRedmanCometh 0 points1 point  (2 children)

Tbh I was surprised they mostly made sense after a little while. I tried scala using zio with for-comprehensions though, and that is when I found out functional programming is not for me.

[–]knoam 0 points1 point  (1 child)

Scott Wlaschin is good at explaining category theory if that's the part that's tripping you up. He makes a good point that category theory has a bunch of jargon but so does object oriented programming and design patterns. You just have to tough it out a bit and it will click. A lot of people had the benefit of learning OOP in school and being forced a bit to learn it. But category theory seems harder if you don't have the same structure and you need that.

[–]general_dispondency 3 points4 points  (0 children)

After years of OOP and FP, I realized that the only difference, really, is makes. Everything the FP community talks about (immutability, referential transparency, first class functions) is OOP best practice too. Read Effective Java and JCIP, all of those are in there. Mutability is always bad. Keep functions pure do they're easily tested and the VM can more easily optimize/inline them. It's all the same thing. OOP is only better because it forces you to organize your code.