She says we shouldn't blame the language, but how much of this is because CSS eschews Composition for (incomplete) Multiple Inheritance? And how much of the extra code is an effort to avoid bugs because layout properties are non-orthogonal? At what point do we decide that it's not that "you're doing it wrong", but that there were actually some design choices that, in retrospect, maybe weren't such a good idea? I'd sa…
It might be the language's fault, but that doesn't make the least bit of difference. CSS is here to stay for the foreseeable future, and she's saying we have learn how to use the tools we're stuck with the best we can.
CSS: Our best practices are killing us
51–54 of 54 posts
Re: CSS: Our best practices are killing us
#52My main rule is: Never write a class that you can't use again. I've other rules too, such as "padding is top, margin is bottom". CSS must be modular, not exception-based.
Re: CSS: Our best practices are killing us
#53Earlier quoted context omitted.
Another best practice I have is to place a comment on each closing element, referring to the opening one. So,I have: CONTENTCONTENTCONTENT When you have complex pages, with several nesting levels, this can save much, much time.
Isnt there a danger that someone else working on your code might not respect that rule (or dare I say it, but maybe you're in a rush one day) and you don't update the comment when you update the class. Now you've got comments saying in correct things, and you risk all sorts of confusion. The same rule applies to commenting methods in code really, you don't comment what the code does exactly - just what the intention…
Re: CSS: Our best practices are killing us
#54Earlier quoted context omitted.
"much of this is because CSS eschews Composition for (incomplete) Multiple Inheritance?" Pretty much all of it. I remember being a bit surprised when they first released CSS at just how impotent it was. Over a decade later, I now realize my younger self would have gotten himself stuck in a morass of Turing completeness, but CSS goes too far the other direction. Decoupling styles (which may contain several rules) from…
CSS3+HTML apparently is Turing complete: http://lambda-the-ultimate.org/node/4222