views:

1166

answers:

5

Django is to Python as Rails is to Ruby. What is the current front-runner for Erlang?

Recent Erlang web activity has resulted in many new frameworks but they are all still moving targets. ErlyWeb is very far along but now seems to be dead.

If you were to invest significant capital into a new web product (i.e. not a hobby, you use your own money and you use other's investment in you with expectation of payback), would you choose Erlang as a web platform? If so, what framework and technologies would you choose?

+1  A: 

I'm not an expert with Erlang. But when I did create a website with it I used Erlyweb: http://erlyweb.org/

I know that it's home page suggests that it hasn't been updated since Oct 2008 but for the project I was running it was feature complete enough for us.

As to the other question you asked about would you use Erlang over other languages out there then I'd have to fall back on what Joel said in one of the stackoverflow podcasts where he talked about if Ruby, python, etc were ready for prime time.

I'd put Erlang's webframe works in the not ready for prime time use category right now. Erlang as a language I'd say is definitely ready but the web frameworks all seemed to be too new and missing features compared to what some other webframeworks(asp.net, Rails, Django) have. So I probably wouldn't use it over Rails, Django, asp.net all other things being equal.

Disclaimer, the last time I surveyed Erlang's web frameworks was early 2009.

chollida
+2  A: 

A summary of a few Erlang web frameworks (The original link is dead, this is from Google cache).

Vijay Mathew
great link, though it's from Dec 2008 so some things may have changed since then:)
chollida
The only 2 thing really wrong there is that Nitrogen now has a basic routing system. And that the Nitrogen documentation has greatly improved.
Jon Gretar
Link is dead now :(
samoz
@samoz Thanks for reporting the dead link! I have updated the link to point to the copy in Google cache.
Vijay Mathew
The Google cache link is dead now too.
Bill the Lizard
A: 

It of course depends on what features you are looking for, but I am currently working on a Webmachine based site. I use HTML/CSS/jQuery on the front end and JSON to communicate with the Erlang back end. I am using Riak as a DB which allows me to store data as JSON as well, but CouchDB would work too.

The disadvantage of this setup is a lack of some of the usual conveniences modern web frameworks provide. however, with no impedance between the view, logic and db data, many of them (like ORM) are unnecessary anyway. I am probably going to write a very simple templating system to embed the initial JSON data in the page, which will then get updated by a jQuery function. User interaction with the page causes no reloads, but an AJAX call reloads the resulting JSON via the same function.

I have put together a very basic Facebook-ish clone this way in a couple weeks (and I am still learning Erlang). I may just be enjoying how completely different it is to what I have used in the past, but so far it seems much cleaner and simpler. More importantly I have a web platform that will scale linearly with no code changes.

Chris Duesing
+2  A: 

An important step in understanding how to develop a website or service in Erlang is making the distinction between your applications that contain business logic and the web interface layer. In Erlang, it is very reasonable to have several OTP applications and internal services that handle the business logic of your web service/site. For my projects, I've usually got a 'front-end' application that spawns a mochiweb process that handles http connections and delegates incoming requests. It has worked extremely well for me because I try to keep things as simple as possible.

tl;dr Don't use a huge framework. If you do, Nitrogen is pretty slick and well documented.

Disclaimer: I've written a number of web applications and web services using Erlang. They range from internal tools to large, feature complete and high-user Facebook applications.

Nick Gerakines
+4  A: 

I recently put together a comparison chart for the major Erlang web frameworks (BeepBeep, Erlyweb, Erlang Web, Nitrogen, Zotonic, and my own Chicago Boss):

http://www.chicagoboss.org/compare.html

If you're looking for a DB-driven application, your choices are Zotonic, Erlang Web, Erlyweb, and Boss.

  1. ZOTONIC. Zotonic seems to be the furthest along in terms of features. It's a framework and a CMS, so it might be a good choice for content-rich websites (the equivalent of building a site with Drupal, I guess). The major downsides are

    1. There's no development mode, i.e. you have to manually recompile with every code tweak

    2. It ties you to a SQL database, which will hamper long-term scalability.

    The developers seem to be focused on making life easy for "the front-end guys"; for example, Zotonic has a lot of JavaScript/AJAX generation tools. For the views, Zotonic uses a modified version of ErlyDTL (a template compiler that I wrote with Roberto Saccon in 2007), and I've incorporated a number of their changes back into the ErlyDTL project.

  2. ERLANG WEB. Erlang Web also has a lot of features and an extensive API. It also has an ErlyDTL option for templating, although it originally shipped only with an XML-ish templating language called WPart. Erlang Web is a "pure" framework (i.e. it's not part of a larger CMS), and it gives you a couple of options for the database backend: Mnesia and CouchDB. These databases are more scalable than Postgres (maybe?), although I'm not sure why people think databases written in Erlang is such a grand idea. Anyway, the design of Erlang Web feels a lot like Java frameworks circa 2004 to me, the type where it takes a week just to learn all the moving parts.

    As with Zotonic, you have to manually recompile your Erlang Web project with every code tweak. Unlike Zotonic, there's no built-in admin interface, so you'll have to write basic CRUD pages even for things only site administrators see. Overall, Erlang Web seems like a heavyweight "Enterprise-y" choice. It includes built-in systems for caching, testing, and validation, but it seems to have missed the Rails-inspired programmer productivity revolution.

  3. ERLYWEB. Erlyweb was a pioneer in Erlang web frameworks, and I learned a ton from reading Yariv's code. The guy is brilliant and it's too bad he left Erlyweb for dead (er, for Facebook). Erlyweb automatically recompiles your code and does a lot of code generation to make the developer's life easier. I would have used Erlyweb for my own projects, but a few things stopped me:

    1. The template language struck me as weird; for instance, code to be executed inside a for loop must appear after the for loop in a separate function call

    2. All of the database options are schema'd (Mnesia, MySQL, PostgreSQL), and if there's one thing in this world I hate, it's running an ALTER TABLE command in production

    3. The model ORM was a little more verbose than I wanted (e.g. house:porch(House, Porch) instead of House:porch(Porch)... nitpicky I know, but hey it's my code/my choice.)

    4. I forgot why, but I didn't like the required server, Yaws

    Erlyweb is definitely more of a barebones "hacker's" framework than either Zotonic or Erlang Web. I would have used it if I didn't think I could fix all its problems at once by writing a new framework...

  4. CHICAGO BOSS. Chicago Boss is in the mold of "hacker" frameworks rather than enterprise or CMS frameworks. Boss has been criticized for requiring Tokyo Tyrant and for its extensive use of parameterized modules, but I consider these to be features. Also, be aware that Boss is missing important features, like data validation (whoops) and internationalization. That said, Boss is designed around two key principles:

    1. Programmer productivity, with a built-in admin interface, automatic recompiling, pretty error printing, and lots of code and documentation generation

    2. Scalability, with a schema-less Tokyo Tyrant database (woohoo, no migrations!)

    I used Rails for years (and before that, Apache PageKit), and for me developing apps with Boss takes less time than with Rails. Boss views and controllers are about the same size as their Rails equivalents, and writing models is actually easier because you don't have to futz with CocoaMySQL or whatever.

    Admittedly, Boss hasn't been "put to the test" with any large famous websites, but then neither have the other Erlang frameworks mentioned here. We're still in the Wild West my friend, but in my humble opinion Boss is a solid piece of work and it'll scale up like Spiderman.

Investing into any Erlang framework entails a certain amount of risk, but I'd say the only real risk is in hiring programmers who can't fix bugs in open-source projects should you run into them. Having worked as an operations engineer at a Very Large Internet Retailer, and as a software engineer at a Prominent Lean Startup, and having delved into the deepest darkest depths of Erlang, it is my opinion that Erlang is a viable platform for "investing significant capital" as you say. That said, the web toolkit for Erlang is small compared with other languages, and as with any emerging technology, you'll need better-than-average engineers who can fill in the gaps that you find, and accommodate the rapid pace of change.

Emiller