4 ms·
I wasn't arguing in favor of separation of view and functionality as gospel. On the contrary, bringing them together can often be more performant _if done corre
by henriquez 7y ago
I wasn't arguing in favor of separation of view and functionality as gospel. On the contrary, bringing them together can often be more performant _if done correctly._ However, in the context of adding layers of abstraction, I believe it should be a one way trip, ie. we can abstract code functionality from the view, but we should not abstract view functionality into code (and then back into the view at render time). That's like crossing the street twice and ending up where you started.
- seanwilson 7y ago> I believe it should be a one way trip, ie. we can abstract code functionality from the view, but we should not abstract view functionality into code (and then back into the view at render time). That's like crossing the street twice and ending up where you started. Can you give an example to illustrate this approach?
- henriquez 7y agoThe OP gives a good example: https://seek-oss.github.io/braid-design-system/components/Stack/ https://seek-oss.github.io/braid-design-system/components/St... This is overengineering, something that should be handled in a view with a CSS class, instead of an abstraction that ends up translating back into a CSS class after the overhead of parsing the abstraction. I think in the case of your original comment to me, you're arguing something different. You want to bold the first word of an article or apply a line break after the first two words. For a use like that, there's nothing you can do other than to put some kind of view-related functionality in your code, and I agree. But handling that in code isn't fixing something for the sake of fixing it, because there's no way that it could be handled natively by the view in the context of whatever data you pipe into it dynamically. A CSS class that provides margins to items in a div can be handled natively by the view and should.
- cercatrova 7y agoI get type safety with that example, I don't with CSS.
- henriquez 7y agoType safety for a CSS class? What?
- cercatrova 7y agoType safety for CSS properties. See TypeStyle for instance: https://github.com/typestyle/typestyle https://github.com/typestyle/typestyle
- henriquez 7y agoNow I've seen everything. Clearly I'm past my prime. I'm going to give up web development and go live in a cave or something.
- cercatrova 7y agoI'm curious, what don't you like about CSS type safety?