Dmitry Grigoriev | 26 Jan 08:02
Picon

Re: lib.web 0.3: welcome to try!

Hello Jack,

> Just out of curiosity - is lightweight the major goal of lib.web? By
mixing HTML with code, you can reduce the number of files in a project
and make the project structure simpler but it's generally believed that
this makes creating and debugging view code more challenging. What's
your experience with lib.web in this regard?

Well, the major goal is to make something useful, convenient and
beautiful. :) And the main point is to keep the whole thing conceptually
clear. Lightweight is just a consequence. When I'll start, for example,
forum written in lib.web, all related reusable stuff would fit into
lib.cms package or so.

My experience with lib.web is currently limited with writing examples
for it. %) As I said in announce, a shift to real project (forum) is one
of my current priorities.

Concerning logic and view separation.

Technically, I don't think that external HTML templates are easier to
debug than language-supported (and thus IDE-supported) stuff. Besides,
external template engine introduces extra indirection level, which is no
good in any case.

Ideologically, I'm pretty sure and ready to repeat on and on that it's
just a matter of programmer's discipline. Whether you define templates
as separate methods or separate files, the essence does not change.
Every second or third template I've ever seen heavily mixes logic and
presentation. I think this is just because the task itself is complex,
and the distinction between view and logic must be considered
individually in every particular case. Take even Lift's templates: they
are really exiting, but they don't forbid you to generate markup in code
and pass it to template. If they did, be sure they'd immediately be
claimed for being too limited. :/

The only advantage of external template files I see is that they can be
edited by "Designers with Dreamweavers" (c). My point is:

- First, anyone can use any template engine with lib.web. Just like with
pure servlets. Here is conceptual clearness and lightweightness. _Maybe_
someday I (or somebody else) will add some "default" template engine to
lib.web.

- Second, me personally will never leave markup for designer. After
years of freelancing, I cannot recall a single project where I could use
designers' markup without fixing or (more often) completely rewriting it
to work with dynamic content. I finally came to taking just designer's
images (cut into pieces and optimized) and making markup myself.

--

-- 
Cheers,
dimgel

http://github.com/dimgel/lib.web — thin, stateless, strictly typed Scala
web framework.


Gmane