7 ms·
Actually there are "real systems" being written in FP e.g. Clojure @ SoundCloud. They just aren't architected the same way. Instead of a monolithic WAR you end
by threeseed 12y ago
Actually there are "real systems" being written in FP e.g. Clojure @ SoundCloud.
They just aren't architected the same way. Instead of a monolithic WAR you end up with a series of micro services. FP is actually more suited than OO for micro services since it naturally forces developers down the "do one thing well" approach.
So I would stop with the "OO is what real people use" nonsense if I were you. Because languages like Scala and Clojure are rapidly taking over from Java in the enterprise space and you may find yourself on the wrong side of history.
- _pmf_ 12y ago> Because languages like Scala and Clojure are rapidly taking over from Java in the enterprise space Let's see how much of the momentum these languages keep after Java 8. Default methods, the new stream API and lamdas provide much what most developers need without introducing baroque features and orthogonal infrastructure.
- agumonkey 12y agoDoesn't change the point. It's called JAVA but with lazy streams and closures, everything Java culture built prior that will be moot and that's what the article is pointing at. Same thing happened in PHP land, people say PHP is great now, but what is PHP ? PHP5, which is a perlish javaesque thing ? or the regex craze html implicit template system that was PHP4 ? ... OOP is too verbose by it's essence compared to closures. I tend to see curried functions as anonymous objects (old lisp koans joke on their duality).
- pjmlp 12y ago> OOP is too verbose by it's essence compared to closures. Then CLOS is too verbose?
- agumonkey 12y agoCLOS is a layer on top of CL, it's optional. Also, LISPs are as verbose as you want them too. If you identify boilerplate you macro it away. It's part of the culture. Some systems (php/symfony2, eclipse/emf) go out of their way to generate unnecessary temporary files, templates and such but it's still cumbersome. To be honest, CL shows its age (mapc, mapl, do, dotimes, loop ...), more functional approaches like sml are very tempting, for the small size of their core in which you define all other patterns. I'd love to see a blend of lisp and ml (racket maybe?).
- pjmlp 12y agoTalk about workarounds.
- agumonkey 12y agoLisp macros ? (first-class and generic, not bad for a workaround)
- pjmlp 12y agoNo, faced with the fact that CLOS is also verbose, although in a language that is all about closures, you started to present workarounds how to simplify its verbosity.
- agumonkey 12y agoI don't find CLOS verbose. Private slots by default, accessors as option ... I find LISPs quite succint in general, sure lots of parens, but usually the bare minimum of information is required. This contrasts with the large amount of useless code you can see in Java class definition that amount to nothing (setting fields, toString, manual get/set).
- sjolsen 12y agoCLOS is verbose if all you're doing is encapsulating some state. If, on the other hand, you plan on doing anything remotely interesting, it's very succinct and expressive. Trying to emulate the functionality of CLOS' multiple dispatch and mixins in Java or C++ is hell beyond hell. As for verbosity, I'll take ":accessor foo" over methods "getFoo" and "setFoo" with inane, useless autogenerated comments any day of the week.
- sigmaml 12y ago> OOP is too verbose by it's essence compared to closures. Could you comment on Smalltalk's blocks?
- agumonkey 12y agoI never used ST, I thought a block == closures, but according to http://c2.com/cgi/wiki?SmalltalkBlocksAndClosures http://c2.com/cgi/wiki?SmalltalkBlocksAndClosures there were differences until they wanted to make blocks real closures. edit : I should have said closures + curryfication so you can partially augment the creation of a final callable entity that binds many parameters (similar to an object constructor arguments)
- eitland 12y ago> Same thing happened in PHP land, people say PHP is great now, but what is PHP ? PHP5, which is a perlish javaesque thing ? or the regex craze html implicit template system that was PHP4 ? ... Get the facts straight please. As much as I don't like everything about PHP, PHP means PHP5 and it has been like that for a few years.
- agumonkey 12y agoI'm talking about languages evolution. PHP5 got a Javaesque Object System, closures, generators. The idioms that will emerge will be close to other language with similar features, and what made php php is becoming less and less so.
- _pmf_ 12y agoPHP is actually the perfect example to disprove my point (pig with new lipstick). I'll reflect on that.
- agumonkey 12y agoPHP is a funny thing, started very very low (https://twitter.com/agumonkey/status/488432654577303554 https://twitter.com/agumonkey/status/488432654577303554), and nowadays it's got a lot of very positive improvements (linguistic features, faster interpreter, principled community). Who knows how long it will survive ...
- threeseed 12y agoIf you think those features change anything then you must have a poor understanding of FP or why people are moving to Scala/Clojure. It is a fundamentally different way of developing code that is starting to look really appealing to the enterprise. The iterative development with a REPL approach deployed with micro services lends itself well to Agile development where big bang architecture simply doesn't work.
- dmacvicar 12y agoI did the two FP courses from Mr. Odersky using Scala as the main language and then continued playing with the language for small experiments. While the language is awesome in general, I would not recommend it at work.
- wtetzner 12y agoAny particular reason you wouldn't recommend it at work?
- deleted 12y ago[deleted]
- dmacvicar 12y agoAs the author of this post mentioned the culture of the Java developers, the "architect" thing and the frameworks, Scala has its own similar problems: it attracts a group of academics on type systems and creates over-engineering in a completely different direction. Also, while I think Scala is simple at its core concepts and syntax, it gets complex because it has too many features and tries to support all features present in other programming languages. Why do you want structural typing there?. Also, I hated sbt.
- frowaway001 12y ago> it gets complex because it has too many features and tries to support all features present in other programming languages Which things do you have in mind? > Why do you want structural typing there? Isn't that a simplification? Instead of saying "here are types which you can use as e. g. parameter types, and here are types which you can't use (like in Java)", it says "all types work the same way".
- dmacvicar 12y agoI understand what it is. I don't see the need of it if you already have a class-based system. Go uses structural typing. But it is the only thing they have. Rust has traits, and it is the only thing they have. I can't think now of more stuff but I remember you could even write xml in the language.
- seanmcdirmid 12y agoI worked on Scala for two years seven or so years ago (2005-2007), and I'm not really worried about it (Scala is a great OOP language, and a soso FP language). Compared to Scala, Clojure has a minuscule user base (as one would expect for a Lisp).
- threeseed 12y agoWell there is an overwhelming trend towards Scala/Clojure both in the enterprise and for large internet sites. When companies like Twitter, LinkedIn, Foursquare, Netflix, eBay etc start embracing FP languages you can be sure the rest of the world takes notice. My point was that serious companies are doing serious work with FP languages.
- frugalmail 12y agoreferences? http://www.google.com/trends/explore#q=java%2C%20clojure&cmpt=q http://www.google.com/trends/explore#q=java%2C%20clojure&cmp...
- seanmcdirmid 12y agoScala isn't really functional, its more like a better Java that happens to include some FP abstractions (like C# does with Linq). Its actually a good OOP language, better than Java and even C#. Clojure is a Lisp, its niche. There will always be some people around who want to program in a Lisp, and many of them are just choosing Clojure today. Nothing new really.
- reitzensteinm 12y agoI'm a Clojure fan, and the syntax has nothing to do with it. The pervasive immutability, persistent data structures, ease of threading and STM mechanics are the good bits as far as I'm concerned. The language could have a Python skin on it and still maintain much of what makes it pleasant to work in. I'd probably even prefer it. Furthermore, the reaction to Clojure by the lisp community in general seems to be quite negative, like it's some inferior lisp that doesn't even have things like reader macros, and it makes no sense why it's getting traction when CL never did. Which is all to say, I think the answer to what makes Clojure compelling is actually quite nuanced, and you're painting over it with a broad brush. Maybe with the wrong color.