Hacker News new | ask | show | jobs
by berkes 477 days ago
> The real leaky abstraction for HTML is string templating

With actual XML and JSON (or csv etc) I would agree: for that you need a serializer, not a string templating env.

But for HTML, especially when used to build GUIs, string templating makes sense - to me -.

What I meant with "leaky abstraction" is that when I write a web-app, my goal is to write certain HTML, the actual strings, to a browser. I'll have my developers console open, inspect DOM/source and then modify the code of the app until the DOM/source matches what I want or need it to be. The closer my "code of the app" is to this actual DOM/source, the less I need to think through layers.

I prefer to just "move this UL out of the DIV and next to the H2¹" rather than manipulating the structure in a tree of objects. To each their own, I guess, but I rather prefer to stay "as close to the metal" as possible, especially if that metal isn't complex or difficult.

¹ I realized I wrote my HTML elements in capitals. I am that old; and I don't anymore, but old habits creap in, I guess :)