Programming Can Be Fun Again
blog.polyglotprogramming.com
blog.polyglotprogramming.com
Joyless heavyweight frameworks and flabby design patterns are definitely the problem, but Dean's survivalist-style head back to basics and raw SQL isn't going to let us build rich complex software in 2011.
I think the key lies in how easy is it to look at your code and trigger the pathways in your brain associated with elegance. No offence to Java, it gets the job done but due to boilerplate, the likelihood of your code resulting in such triggers is much less than say clojure or scala. Consider the popularity of CofeeScript, node.js, python, ruby. These are not idiomatically functional languages but due to reduced boilerplate they too also make it easier for your code to be appreciated on an aesthetic level. What is the gain in this?
I have a belief that an appreciation for elegance is the natural outcome in a universe with a principle of least action. Prefer the explanation which takes less energy to unfold. So anways what happens is that your brain rewards you for writing code that tries to be elegant and turns aesthetic knobs. Pushing you for more and more of a hit. And you start to become more motivated to write code that rewards you thusly and a side-effect being programming is more enjoyable and you are more likely or encouraged to write code that is appreciable. Since code is meant for humans, as a start, optimizing in this way is ideal. Train yourself to appreciate algorithmic and mathematical elegance and you reap the rewards there too.
Want to develop web applications? Nothing from the functional programming camp comes even close to the polished experience of using Ruby on Rails. Yes, I know about Play and other web frameworks for Scala, Clojure, and Haskell, but - and I repeat - they aren't even remotely close to the level of support, libraries, plugins, and documentation that you can get from the Rails world.
Want to develop mobile apps for iOS or Android? That's typically Objective-C or Java territory. Yes, you can develop Android in Scala, but you are a pioneer then (and you are virtually on your own if you encounter any issues with the stack, as very little documentation and community support is available for it).
Want to develop desktop applications? Again, functional programming languages are rarely the best supported option. C#, Objective-C, C++, or even Object Pascal (Delphi) are all fine choices. Opt for Scala, Clojure, or Haskell and you'll find little documentation and support, and in the case of the first two, you'll have GUIs that look anything but native.
So what are these functional programming languages good for? So far I've only found them to be good at doing heavy lifting in the back-end or in GUI-less scripts. An important spot for sure, but not the most prominent one to justify adopting either as my main tool.
I love functional programming languages and I wish I could drop everything and write web apps in Clojure or Haskell. But the hustler in me wants to get stuff done and cannot justify the world of pain and waste of time I'd experience, especially when there are already tools that are simply better suited for the task at hand.
Should a project of mine scale to the point of needing a fast functional programming language for core functionality in the back-end, I'll be happy to employ it there.
Backend web dev? There are lots of nice simple frameworks or you could build your own. Do you really need everything rails / django offers -- I find minimal and lightweight is best. You are essentially building an service that can interpret http.
Devices? If you want to do iOS or Android you can use javascript, css, and html instead of the native approach (see phonegap et al.). Javascript is a functional language -- in that it supports higher-order functions like scheme. (See http://yuilibrary.com/theater/douglas-crockford/crockonjs-3)
"...world of pain and waste of time experience..." or getting shit done in what I know how to do is not a good approach for a programmer.
edit to add links:
https://github.com/basho/webmachine
The RAM Cloud database is really natural to use; it eliminates problems like object-relational mismatch and SQL injection by letting you do everything in idiomatic Haskell.
Plus, the type-system, monads, and algebraic datatypes make it much easier to write clean, correct code. Albeit, only once you've passed the learning curve.
That's exactly what happened to me.
Even though I mostly program in C# (at work) and Ruby (for personal projects) these days, my code and my team's is full of functional idioms, mostly thanks to LINQ, lambda support in C# and lazy evaluation (IEnumerable generators).
Now our code is much shorter, way more readable and much safer compared to what it used to be. We avoid mutability and state changes (meaning, we don't use mutable variables or flags), most functions are testable by themselves, code reuse is much better, objects are much thinner, and even 17 old interns are fluent on such idioms by now. In fact, most new hires already come with LINQ experience, which is cool.
I don't know why the "fun" factor was increased so much, but it did for me. I believe it is because we're forced to think in a straight, linear way that produces the cleanest, safest code possible. It is like some kind of puzzle. It's just like working in Haskell: you have to think before you code.
Well, also it helps a lot that mundane tasks such as calculating the largest number in a list is reduced to list.Max()...
Functional programming encourages beautiful code (although it certainly can be ugly.) A consequence of this is that people, even if they're not skilled enough to write pretty code, actually read code-- not because they need to, because they want to-- and become better programmers as a result.
Functional programming, for a passionate programmer, refines the aesthetic sense and 2-4 years of it will give most people the skill to be a passable software architect (whether they are passable or great depends on talent IMO). Not so with C++ or Java. You can spend 10+ years in those languages and get really, really good at optimization but still have no aesthetic sense.
You also learn faster when using FP languages because you can do more in them. You get to see the consequences of your architectural decisions long before the project goes multi-developer and is handed off to someone else or a team.
Functional programming is not a great career move. It makes you a difficult fit for 90% of jobs that are out there, and it makes a lot of people think you're a hipster jackass. But it's rocket fuel for your skill as a programmer.
It is why I'm an alcoholic now. Java makes me drink as I wait for Ocaml to be main stream
sUnless you happen to be doing greenfield development, this is a dealbreaker -- I like using scala, but it has to call / manipulate the enormous api surface from 1.5mm lines of existing java. And for that, I need tool support.
C++ is no longer fun for me.