- declarative programming sucks horribly
- because you have to, in your brain, understand every fact in the system and how they interact
- this is not how human brains work, we think in narratives, in linear flows
- this is why it's impossible to debug CSS (or Puppet, or XML...)
- there is a fix
- instead of a huge graph of possible interacting facts,
- just eliminate the cascade as much as humanly possible
- there are two ways
- one is to overspecify every property of every node. this is how less/sass work.
- two is to use lots of generic classes, like how css frameworks work (oocss, etc).
- you don't need a css preprocessor
- yes, really. just don't be sloppy and put lots of styles on lots of nodes.
- keep your styles in one place and keep them as orthogonal as possible.
side note: CSS sucks for the same basic reason that GOTO is considered harmful, which is also why global variables suck, and, also, why side effects are carefully managed in functional programs:
- if you can't reason about any part of a system without reasoning about the whole thing,
- and the whole thing is too big to fit in your head,
- then you're gonna have a bad time.
better answer: don't focus on all this junk. just use flexbox.