[erlang-questions] Thoughts on EHE - the PHP killer

Matti Oinas matti.oinas@REDACTED
Sun Feb 19 21:17:45 CET 2012


On 02/19/2012 09:29 PM, Tim Watson wrote:
> I don't find anything 'elegant' about embedding code inside
> of web pages, and that's not an aesthetic judgement, but one that
> comes from working with medium to large, multi-disciplinary teams,
> where 'sites' might have hundreds or even thousands of different views
> and considerable logic behind many of them. In an environment like
> that, especially when the system(s) are business critical and/or
> customer facing, you fight for your life to keep a strict separation
> of concerns, or you end up failing because of the inherent complexity
> and loose your reputation as a team lead as well as your bonus.
That is true that you want to keep view separated but that is where 
django and others fail. View still contains code like

{%  for  match  in  matches  %}
     <div  style="background-color:
         {%  ifchanged  match.ballot_id  %}
             {%  cycle  "red"  "blue"  %}
         {%  else  %}
             grey
         {%  endifchanged  %}
     ">{{  match  }}</div>
{%  endfor  %}


That is equally ugly with embedded code and it contains logic. Even 
worse is that it added one extra language but still failed to separate 
logic from the view.

Enlive on the other hand uses plain HTML templates which are transformed 
with the help of CSS selectors. There is no logic in HTML template, only 
plain old HTML. Tranformation code defines what elements will be left 
and what elements contains what information.

http://cleancode.se/2011/01/04/getting-started-with-moustache-and-enlive.html

Now we have separated the view from logic and it is really simple to 
change templates. That is a library that I would like to see written in 
erlang.



More information about the erlang-questions mailing list