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

OvermindDL1 overminddl1@REDACTED
Thu Feb 23 05:16:38 CET 2012


/* snip */

So I am curious at all this template stuff.  For years now I have been
writing my code as code and html/css/js/whatever as
html/css/js/whatever.  My latest example here at work I needed a
python parser to parse out some nasty SOAP crap from our phone system
and it ended up growing to the point where I actually wrote in a
mini-webserver (I cannot use Erlang here... yet... I am trying!).
Even in this tiny webserver I just take a request and server out json.
 If authentication needs to happen then I just return a 'keycode' that
should be sent with every request that should be authenticated, but
everything sent back in every single request is generated/cached json,
or a file out of the ../web directory (for the html/css/js/whatever).

I do not really have to 'remember' anything on the server side, I just
send what is requested.  Only thing that I really have to remember on
the browser side is the order and entries and such that the json has
when it is sent back.  I just make heavy use of jquery.  All my code
on both the server and the client is *very* simple (practically
stupid-simple for all the 'ooo's and 'ahh's it is getting), very
self-contained, and very easy to modify, as well as it would be easy
to modify the html/css/js/whatever by someone other than me (of which
I have already done by having someone add in jquery ui themes, which
added like 6 lines to each support html file).  Plus I could always
write something to access the servers API directly if I wanted.

But really, why templates?  Just let the server do what it does best,
server dumb files and processing of data to give to those dumb files.
Leave the dumb files to process the data as they wish, there is so
much javascript code and so many pure javascript html templating
languages out there, just let the UI people work their magic on that,
they know that stuff, and they know how to parse json with a jquery
call, that is all they need.  There is even a jquery for mobile
devices.  If you really want to make javascript-less pages, well, then
fall back to the old stuff that no one really uses anymore.  ;)

P.S.  I am *so* looking forward to a REST-style interface for yaws, I
basically keep remaking one of my own for each project.  Good session
management, although the 'capabilities' are not quite powerful enough
for my usage without a *lot* of boilerplate.



More information about the erlang-questions mailing list