> I struggle to even move buttons around (if I fail to update all constraints right, the whole layout collapses)
I would say that accurately describes my experience with CSS. Any selector has the potential to mess up the entire page.
With NSLayoutConstraints, not only does it match my mental model of how layout ought to work, but I know that in a properly-factored layout, constraints can only mess up their local section.
Globals make debugging tough in any context, and I wouldn't blame the language simply for allowing their use.
> Any selector has the potential to mess up the entire page.
That's true, but the modern web stack has several solutions to this. If you don't mind "CSS-in-JS", I've been using the excellent styled-components [1] library for my company's React app. I believe Vuejs supports scoped styles out of the box [2]. And if you'd prefer to just write plain CSS, CSS modules [3] will mangle the classnames in your CSS files so you don't have to worry about collision.
No. Even in perfectly factored CSS, one bad selector still can mess up the whole page, no? That's why all those nifty tools (mentioned in a sibling comment) exist.
I would say that accurately describes my experience with CSS. Any selector has the potential to mess up the entire page.
With NSLayoutConstraints, not only does it match my mental model of how layout ought to work, but I know that in a properly-factored layout, constraints can only mess up their local section.
Globals make debugging tough in any context, and I wouldn't blame the language simply for allowing their use.