4 ms·
I always thought the bigger mess was html and css rather than JavaScript.
by crimsonalucard 7y ago
I always thought the bigger mess was html and css rather than JavaScript.
- warent 7y agoParticularly CSS. There's a lot of ways to apply styles now, e.g. styled components directly in the JS, or using SCSS, etc, and these help, but overall it's still a huge mess.
- CharlesW 7y agoAlthough you can apply styles with JavaScript, it's best not to confuse doing that with CSS. CSS is a reasonably-straightforward DSL. I really don't understand suggestions that it's a "mess".
- warent 7y agoYou're misunderstanding. Styled components is a specific concept that uses CSS within JS: https://www.styled-components.com/ https://www.styled-components.com/ The mess with CSS comes from the difficulty of code resuability once an application becomes complicated. Things start colliding and patterns diverge easily.
- CharlesW 7y ago> You're misunderstanding. Styled components is a specific concept that uses CSS within JS… Thanks, yes, I didn't realize you were talking about a particular framework. I'm not familiar with that one. > The mess with CSS comes from the difficulty of code once an application becomes complicated. Things start colliding and patterns diverge easily. CSS is imperfect, and there are different ways to think about it. But if you find yourself running into design problems often, you may want to rethink how you think about CSS. For example, my approach to CSS used to be thoroughly semantic. Lately I've been enjoying more of a "utility first" approach, which I learned about from an article that you might also find interesting: https://adamwathan.me/css-utility-classes-and-separation-of-concerns/ https://adamwathan.me/css-utility-classes-and-separation-of-...
- crimsonalucard 7y ago>CSS is imperfect, and there are different ways to think about it. But if you find yourself running into design problems often, you may want to rethink how you think about CSS. Any language or system that requires highly disciplined and unintuitive patterns to make work is a flawed system. There is a a sort of catharsis once understanding of a pattern is achieved but you should not be fooled by this. "Rethinking" a concept increases your perception and understanding but CSS was never designed to be thought about from another perspective. What you are mastering when you master CSS is how to use the idiosyncrasies of a flawed system. This is not unique to the front end. SQL is much the same way. Often in SQL there are Optimizations with no rhyme or reason. You just write one permutation of a query and pray that it compiles into something performant. A well designed system is one where good design is emergent from the language itself. A good example of this on the front end is ELM.
- CharlesW 7y ago> Any language or system that requires highly disciplined and unintuitive patterns to make work is a flawed system. Things can seem unintuitive is when one's mental model of something is different than what's actually happening. In that case one can choose to believe that one's mental model is perfect, or one can consider the possibility that one's mental model is incomplete and/or incorrect. But that's learning, no? Everyone's mental map of almost everything is incomplete and/or incorrect. Consider that CSS is generally (the occasional implementation bug notwithstanding) doing what you tell it to do, and that if it's not doing what you'd expect, that there's probably an opportunity learn why your mental model doesn't match the reality of the abstraction. > This is not unique to the front end. SQL is much the same way. Often in SQL there are Optimizations with no rhyme or reason. There's always rhyme or reason (or bugs, sometimes). I have the pleasure of working with some of the foremost SQL experts in the world. When SQL that I've written doesn't work how I'd expect or as performantly as I'd expect, I inevitably discover that the problem is that my mental model is wrong and/or incomplete and eventually walk away with enhanced understanding.
- crimsonalucard 7y ago
- eurasiantiger 7y agoSCSS? Is it 2015?
- warent 7y agoI'm not sure if this was intended to be a joke, it just seems hilarious to imply that something from three years ago should be considered outdated.
- reggieband 7y agoThe DOM layout model is particularly bad, IMO. I have very little to gripe with about Javascript since es6. Now I am using TypeScript and I think that language is pretty good. I was watching videos from the chrome developer conference and there were two young peppy faces beaming that "gap" was now a supported CSS attribute for flex containers. That means in 2 years, if we are lucky, we can space out elements without hacking margins on child elements. Sometimes I almost can't believe what we put up with.
- 12thwonder 7y ago100% agreed. Html and css are for documents not for ui imo. Quite sad that they are becoming the standard for creating ui
- eurasiantiger 7y agoThe entire browser HTML-CSS layout engine is optimized for laying out text.
- rado 7y agoYour online banking balance is just text.