5 ms·
I guess you don’t have to maintain those projects. You’re coupling the style to the view so tightly that any updates in the future will be serious effort.
by robin_reala 11y ago
I guess you don’t have to maintain those projects. You’re coupling the style to the view so tightly that any updates in the future will be serious effort.
- eterm 11y agoAs a counter-point, the "style" is usually heavily coupled to the "view". It's rare to see a re-style which wouldn't also require a reworking of the view anyway. I like the idea of purist separation of "style" and "view" but it's unrealistic to think it needs to be a point of dogma. There are clearly cases where you would want most your styling to be separate, particular for client-specific branding, but there is likely "functional" css such as css that gets date pickers etc working and those can't really be cleanly separated from the view. A lot of CSS isn't really "style", it's actually far more functional than that. Try turning off CSS and see what happens to fancy date-pickers or rich text editors or other controls, they don't degrade cleanly they just break.
- robin_reala 11y agoI’m not talking about a complete rebrand, but let’s say your a/b testing discovers that users react better when there’s 20% more whitespace between elements. If you’ve got all your margins contained in your CSS (or better yet a global SASS variable to control default gutter sizes) then it‘s trivial to update and push. If you have to search through every view in your project to see where you might have snuck in some inline styles… well, you’re just not going to bother. Which means you’re throwing user need / conversion away.
- rickhanlonii 11y agoIn the react style he was talking about, you would import reusable styles so you can still change just one variable to update the gutter size.
- deleted 11y ago[deleted]
- BigJono 11y agoCan you elaborate? The design is modular. Reusability of styles is implicit in the re-use of components, it's not like you duplicate styles all over the place (or at all). In my experience maintenance changes have been easier, since it's a piece of cake to nail down exactly what component the styles belong to by quickly scanning the code, eliminating the need to inspect the DOM to discover which selectors are impacting a certain element.
- robin_reala 11y agoYou can get the same functionality by structuring your SASS into a components/* tree that maps to your components. That way your styles can use global style variables that are shared throughout your project, which in turn reduces the maintenance load. (to be fair, React doesn’t seem to solve more problems for me than it creates - quite the opposite - so I’ve never built anything past toy apps in it)
- lomnakkus 11y ago> can use global style variables that are shared throughout your project, ... which you can just as easily do in React. It's JS after all, so you just use JS modules -- and I hasten to add that there are probably-better-than-plain-JS solutions out there[1]. [1] Here's one example: https://github.com/gajus/react-css-modules https://github.com/gajus/react-css-modules . (Dislaimer: haven't actually used this, I'm using scala.js)
- JustSomeNobody 11y agoWait, the style and view typically are coupled. There needs to be a happy medium. Projects that go to extremes to decouple everything are a) a waste of much effort for little gain. b) as big a pain to work with as code that is completely coupled.
- collyw 11y agoYes, I think one way coupling isn't really a problem - your controller knows about your model layer, but not the other way around.