I consider reuse within a single project to be a sufficient win, so each project gets its own copy of whatever template fragments that project needs. This also allows per-project look-and-feel tweakage.
Fair enough, and definitely a win over hand-coding table
loops wherever they're needed, but:
- Isn't per-project presentation tweakage a CSS problem,
not an HTML problem? (Yes, I'm aware that I'm being a bit
of an ivory-tower theoretician here, and that CSS isn't a
universally applicable solution, but still.)
- Per-project templates don't seem to mix well with
global code (I presume your tableHTML function
is in a module somewhere) -- if your code changes in such
a way that it needs an updated table.tmpl,
you have to remember to change all the template copies, and
that sounds like a monumental pain in the ass if production
code is affected.
Of course, I'm just picking nits here. In general, I like
the idea.
--
F
o
x
t
r
o
t
U
n
i
f
o
r
m
Found a typo in this node? /msg me
% man 3 strfry
| [reply] [d/l] [select] |
if your code changes in such a way that it needs an updated table.tmpl, you have to remember to change all the template copies, and that sounds like a monumental pain in the ass if production code is affected.
That is exactly why I said that this technique is a demonstration of presentation logic seeping back into the application. It's why I argue for a more powerful template language.
Having per-project presentation tweaked solely by CSS is nice in theory, but doesn't cut it in practice. That does not mean you should mix presentational markup into your generated HTML; you should still generate semantic markup and use CSS to style it — the most immediately obvious benefit is that you won't need to touch your templates as often.
Makeshifts last the longest.
| [reply] |
1. Isn't per-project presentation tweakage a CSS problem, not an HTML problem?
CSS is a problem all by itself. But yes, you can do a lot of look-and-feel adjustment by first being careful to emit the right attributes so that you the right hooks to hang CSS on, and then tweaking CSS. But it's not a 100% solution, especially if you decide to do things like emit Javascript for dynamically sorting tables.
2. Per-project templates don't seem to mix well with global code.
I'll cop to a bias here. I used to worry a lot about cross-project code, portable libraries, building frameworks, and so forth. But the time investment never seemed to pay off. Now I worry a lot more about making things usable within a project. YMMV, but worrying about use before worrying about reuse has paid off for me.
| [reply] |
| [reply] |