3 ms·
Functional programming. At the very least, systems where all logic heavy code is handed off to a functional language and the imperative language serves as the g
by zaptheimpaler 14y ago
Functional programming. At the very least, systems where all logic heavy code is handed off to a functional language and the imperative language serves as the glue (with something like Scala, we won't need even that much). Seriously, that post reminded me of the same thing.
Also, by functional, I DONT mean just map/reduce/filter. The advantage of FP is really in being able to define types and mini DSLs very easily, the kinds of patterns higher order functions allow you to capture, the simplifications afforded by immutable types add up to make functional code the cleanest representation of the problem itself, without any of the cruft.
Try learning Scala, Clojure, or another functional language, and write some serious code in it. Go through a book or a course though, because if you try to pick it up by google and blog posts, you might end up writing basically imperative code in the language, which defeats the purpose.
Personally, writing functional code for the first time opened my eyes to how many problems that I thought were more or less fundamental were just artifacts of the level of abstraction being too low.
- 31reasons 14y ago(())()()(()) Parentheses in FP makes me dizzy, is there an IDE based solution to that ? FP almost feels like speaking a very long statement while running out of breath!
- tsm 14y agoParens are a Lisp thing, not an FP thing. Languages like SML and Haskell (especially point-free Haskell) are very light on them.
- tikhonj 14y agoThere is an IDE-based solution! It's called Paredit and can be combined with something like SLIME. (All this for Emacs, of course, but Emacs has all the capabilities of an IDE, especially for Lisp.) After a while of using paredit, I actually grew to rather like the parentheses. At the very least, it lets me edit in a slightly more semantic fashion: I can navigate, select and modify code based on its structure because the structure is defined by the parentheses. That said, I actually do prefer not having nearly as many parentheses, which is why I like ML-style syntaxes. Especially Haskell. Idiomatic Haskell is very light on parentheses and braces and brackets--it's a surprisingly minimalistic syntax. I love it.
- zaptheimpaler 14y agoI used rainbow parentheses for vim (https://github.com/kien/rainbow_parentheses.vim https://github.com/kien/rainbow_parentheses.vim) when working with Clojure, I don't know about IDEs. Also, only LISPs are parens heavy. Try something like SML or Scala if that turns you off. Side note: I'm writing some Java code to practice for interviews.. I miss sum types so much. Another thing that FP got right.