Warning:
right now this is just a sketch
Contents
What is Erlang Web
Erlang Web is an open source framework for applications based on HTTP protocol. It can be used to build dynamic websites and web services. Erlang Web is a full-stack framework that provides programmers with all the functionality needed to do the job. It supports:
- HTTP handling
- session abstraction
- form building and validation
- database abstraction
- website building using template language
- address dispatching and reverse dispatching
- internationalisation
- caching
Erlang Web utilises strengths of the Erlang programming language, enabling developers to build scalable and robust websites.
should I elaborate more on something in this chapter?
Why should you use Erlang Web
Creating a dynamic website in Erlang has some unique advantages. Erlang makes it easy for developers to build a system that is fault-tolerant and scales well. It is a well-suited language for dealing with IO-bound problems, such as serving websites. Erlang is unique for its support for hot code upgrade, lightweight concurrency and easy distribution.
It is a common practice to provide web-based user interface to various systems. Having both the system and its UI created in the same language saves developers the hassle of frequent language switching.
Erlang Web have clean architecture which makes it easily extensible. It promotes writing reusable code and good practices. It's very easy to distribute Erlang Web websites on multiple machines.
Erlang Web is mature and battle-tested piece of software - it has been in many commercial and high profile projects by its creators - Erlang Solutions Ltd.
What Erlang Web is Not
- Erlang Web is not a web server...
- But Erlang Web - based websites are served by one. Currently, we support Inets and Yaws
- Erlang Web is not a Content Management System (CMS)
- But one can build a CMS on top of Erlang Web...
- It wont make you a coffee...
But RFC 2324 (Hyper Text Coffee Pot Control Protocol) support is in the backlog of our work
High level overview
Erlang Web follows the Model-View-Controller design pattern.
Model is the domain-specific description of data that application handles. It is described by wtypes and persisted in Mnesia database.
View is the part responsible for displaying data to the user. Erlang Web makes it easy to develop views by providing template engine and wparts - reusable tags for generating bits of webpages. There are two kinds of template engines supported at the moment: XML-based and one inspired by Django templates.
Controller's job is to interpret user's actions. Erlang Web is shipped with a generate.erl script that generates basic models and controllers.
A typical Erlang Web dataflow looks as follows: user sends HTTP request to an Erlang Web-based webpage. Then, request is routed according to the rules in config/dispatch.conf file. Request is handled to controller function which does some logic to it. Controller may process model data (using wtype_typename_operation functions), redirect the request, or make the template engine render the webpage that would be returned in response.
Developer can design pretty, meaningful URLs easily using regular expressions in config/dispatch.conf rules. Erlang Web supports Django-style reverse URL dispatching as well.
Erlang Web is build on top of Eptic. Eptic is a library that abstracts out the low level details, such as communication with the web server, session handling and configuration.
Who is using Erlang Web
Some notable users of Erlang Web are:
Next version of Erlang's official website (currently at http://demo.erlang.org).
Comparasion to other frameworks
Erlang Web shares some similarities with Ruby on Rails and Django. Its generate.erl script is quite similar to Django's scaffolding. Like Rails, it uses MVC design pattern.
Like Django, Erlang Web doesn't force programmers to use one particular JavaScript library for writing AJAX-based websites. It makes returning JSON objects very easy, but it doesn't generate any JavaScript helpers. This makes it very different form heavily AJAX-biased Nitrogen, but we don't consider this to be a drawback compared with RoR's poor AJAX support.
Erlang Web's architecture makes it easy to separate buisness logic from page rendering. This is similar to Django's philosophy and very different from what Nitrogen does. <% english:rephrase_me_nicer("we've seen enough of PHP code written by 13-years old fans of mixing SQL queries with HTML markup, thank you") %> .
Unlike most other web frameworks, Erlang Web uses Mnesia to store the data. Mnesia is distributed, scalable, soft-realtime NoSQL database, which makes it significantly different from relational databases used by mainstream web frameworks.
What about PHP and JEnterpriseSomething TM (c)?
Summary
Erlang Web is a framework that utilises the power of Erlang programming language. Its design shares some similarities with Ruby on Rails and Django - two popular web frameworks for dynamic languages.
By utilising the power of Erlang programming language Erlang Web can help developers create scalable and fault-tolerant applications easily.
