Improve Your Web App with Functional Languages - Alex Payne at FOWA

Posted on Feb 25, 2010

Next up at FOWA Miami 2010 was Alax Payne who was originally part of the platform team at Twitter and he will be speaking about making your web application faster and more secure with functional languages. Alex has been working on Twitter since just a few months after it was conceived. He also co-authored the Programming Scala book for O'Reilly. Alex says, "Its time to learn something new." Tools like Ruby on Rails are new but not "radically new" - he recommends learning a functional language for something completely new.

Most people today are using object-oriented languages. He compares it to "directing a movie" with a cast of characters with a script that they play out. He says it is time-consuming and error-prone. Functional languages are more like walking up to a chalkboard and working through an equation. It is a much more stable and repeatable process - it may be tougher to do at first but the payoff is high.

Alex says functional programming is about "writing what should be done instead of how." Its about finding and using mathematical abstractions to represent programs - not about being a mathematician but about thinking in a mathematical way. Lastly he says it is "value-oriented" - state is transformed rather than mutated. In this way it is a set of strategies as well as a set of languages.

Functional languages provide speed. He says in some cases, functional languages can rival pure C in terms of performance. They offer more stability because they provide high-level and predictable abstractions. Functional languages have tools that allow you to effectively model security problems.

Next Alex shows a slide listing all of the companies that are using a functional language in their stack including Twitter, LinkedIn, Nokia, Yahoo, Yammer, Foursquare and Xerox. The next step is to choose a language. He suggests choosing based upon what you are more comfortable with: dynamic or static languages. Clojure would be the most dynamic and OCaml the most static. You can also choose based upon what you know well. For instance, Java developers might be comfortable in Clojure or Scala. Finally, you can choose by maturity with Erland and Haskell being among the most mature and Clojure only being a few years old. The latter benefit from being smaller communities that you can have a great impact on the development of the language.

After you have picked a language, you can choose a framework. For Scala you might choose Lift, Clojure he shows Compojure and Haskell has HApps, for example. After that, he suggests that you introduce your functional language gradually into your stack. Take some tiny part of your system that needs to be faster and work through integrating a functional language for that rather than taking upon huge tasks from the start. Anything calculation intensive or having to deal with concurrency will benefit the most from a functional language.

Alex says he is advocating this to help people avoid the hard lessons he and the team learned building Twitter. He thinks functional programming has become an essential tool for the success in web programming and the future of the web.

Comments

There are currently no comments for this entry...be the first!

Write your comment



(it will not be displayed)





About

My name is Brian Rinaldi and I am the Web Community Manager for Flash Platform at Adobe. I am a regular blogger, speaker and author. I also founded RIA Unleashed conference in Boston. The views expressed on this site are my own & not those of my employer.