Thursday, July 18, 2019

On resilience


I'm "on the bench" at the moment, so I've been catching up with my reading. Resilient Web Design, by Jeremy Keith, is an online book, a very elegant one I must say, that I'd come across before, but I thought I'd go over it again. When your job requires you to spend time in the JavaScript frameworks trenches, it's good to step back and get a bird's-eye view of the whole web design circus from time to time. In any case, you have to love a book that uses The Book of Kells to make a point about web design.

Near Kamaroti, Laganas Bay
Not so resilient. On the other hand, at least it's still standing, kind of. Near Kamaroti, Laganas Bay

The book goes over familiar web philosophies such as Mobile First, Responsive Design, Progressive Enhancement, and Feature Detection, and it explains the history of how, first JavaScript, then AJAX took the web by storm. Along the way Jeremy (if I may be so bold) relates the sorry, misguided attempt, in the form of XHTML, to strip HTML of its superpower - its tendency to stay calm and carry on in the face of errors.
"[XHTML]'s theoretical purity was roundly rejected by the people who actually made websites for a living. Web designers rightly refused to publish in a format that would fail completely instead of trying to recover from an error."
Despite all that, the fragility of today's JavaScript world means we all seem to have forgotten the reason HTML conquered the world in the first place (I'll accept my fair share of blame for that).

One thing in particular, though, resonated with me as I read the book this time around. In the second chapter, Jeremy talks about the principle of 'material honesty', a phrase he borrows from the world of architecture. This principle counsels against using one material as a substitute for another. Use things the way they're supposed to be used. Stop using HTML tables, which should of course only be used to present tabular data, to layout your pages. Use CSS instead. Of course, this hasn't always been that easy, but it sure is now. But that doesn't mean that most devs are using CSS Grid, for instance. Or rather, they may well be using it, but they're doing so indirectly. By, for example, handing over control to a layout framework like Bootstrap or Material.

Like everyone else, I've used Bootstrap's grid system to get around the problems of responsivity for years. In that time I allowed myself to become completely reliant on it, and to instinctively write the bloated, div-happy HTML it requires. But I've always tried to keep up with developments in CSS that relate to layout, like Flex and Grid, along the way. Now CSS Grid is here, and there's no excuse not to use it. I notice, however, a lot of devs curiously unequipped to make the natural move of adopting it, and in so doing throwing out Bootstrap, or Kendo, or whatever they use. Why? Why don't they want to do their layout with the honest material of CSS, getting clean HTML in the process? I think it's because they've learned to be helpless. Constantly using frameworks to do what you could do yourself has just made them Bootstrap developers, not web ones (no doubt it's the same with me when it comes to some of the JavaScript platforms and libraries I (over)use).

So, I don't know if this particular gripe of mine has much to do with resilience per se or not. I do feel, however, that this lazy dependency we have on third party frameworks for basic layout, not to mention the breeding of developers who barely know anything about one of the most exciting developments in CSS, one of the three core technologies of the web, makes for more complicated codebases, as well as code that varies from project to project, with Material here, and Bootstrap there, when a web standard for layout now exists. And excessive complexity and a lack of standards adherence are not going to make for a resilient website.

No comments:

Post a Comment