Re:Ask HN: How to explain functional programming to my 13-ye...
by toast0 on Monday December 14, 2015 @03:21PM
(#10733528)
As someone who has been knee deep in Erlang for four years, functional programming is just like imperative programming except:
a) variables can't vary once set
b) you don't get to have for loops (because variables can't vary); use recursion instead
c) function pointers are not frowned upon
d) there are no objects, which is nice in my opinion because OO is usually awful (exceptions being socket wrappers; it would be great to be able to handle a unix socket, a tcp socket and a TLS socket the same once they're fully connected)
Honestly, I wouldn't necessarily bring up functional programming, unless you're working on something where a functional language excels. I didn't know anything about functional programming (other than I had heard it was weird) until I started a job where we use Erlang, and it wasn't that hard to pick it up.
If you want to write a chat server or something, sure do it in Erlang, and learn about functional programming at that point.
a) variables can't vary once set
b) you don't get to have for loops (because variables can't vary); use recursion instead
c) function pointers are not frowned upon
d) there are no objects, which is nice in my opinion because OO is usually awful (exceptions being socket wrappers; it would be great to be able to handle a unix socket, a tcp socket and a TLS socket the same once they're fully connected)
Honestly, I wouldn't necessarily bring up functional programming, unless you're working on something where a functional language excels. I didn't know anything about functional programming (other than I had heard it was weird) until I started a job where we use Erlang, and it wasn't that hard to pick it up.
If you want to write a chat server or something, sure do it in Erlang, and learn about functional programming at that point.