4 ms·
Yes, but the 40 lines of CSS puts the logic in the right place. The point is that a person reading system logic shouldn't need to be distracted by layout, and
by frognumber 3y ago
Yes, but the 40 lines of CSS puts the logic in the right place.
The point is that a person reading system logic shouldn't need to be distracted by layout, and a person worried about styling shouldn't need to think about code.
Whether that matters depends on the specific system and the types of abstractions used, but it can be very important to making code maintainable, and in some cases, org structures practical (where the team maintaining the CSS might not be the same as the team maintaining the system logic).
- sdflhasjd 3y agoThe big thing you didn't mention is accessibility. Unless you know exactly what you're doing, just a few lines of javascript will let you break a user interface in so many subtle ways.
- andrewstuart 3y ago>> puts the logic in the right place There’s no “right place”. It’s a web browser. You program it in whatever way you like that you enjoy that makes sense to you. Use whatever approach you need to get the job done. Mix and match. Come up with new ways. Do it simple. Do it sophisticated. Combine JS and CSS. It’s all valid. Don’t listen to people who try to tell you how to program.
- rado 3y agoJS for UI is wrong, because there will be FOUC, and if you preload JS, the page will be slower. Of course, if something is impossible with CSS, JS is fine.
- andrewstuart 3y ago>> JS for UI is wrong Yeah that’s showing an incomplete understanding of web application development.
- rado 3y agoYeah, the 90% of web apps whose UI is broken, I don't understand them. Haven't we all seen multimillion $ airline mega web apps that can't present a decent form?
- frognumber 3y ago> Don’t listen to people who try to tell you how to program. This worked for me: * DO listen to people who tell you how to program * Listen to many types of them (Microsoft programmers, functional programmers, Unix systems wizards, digital logic designers, UX designers, etc.) * Do what they tell you for at least long enough to understand why they're telling you what they're telling you to do. This requires a very open mind. A Unix programmer stepping into a Microsoft shop or vice-versa will find many things which go against their most core values. * Understand the underlying, fundamental, first principles their best practices derive from (keeping in mind some of those first principles are incorrect -- especially within the Microsoft community), and different ways people have figured out how to structure code, the upsides and downsides of each, and how they mix-and-match. * From then on, program from first principles when you have time, from best practices when you don't, and quick-and-dirty hacks when you really don't, or are just having fun.
- Capricorn2481 3y agoJavascript on the frontend is not for "systems" logic, it's for small changes to the layout without reloading the page. This myth that HTML, CSS and JS are all separate "systems" that need to be isolated has to die.
- ImPostingOnHN 3y agoJavaScript on the frontend is not intended for "small changes to the layout without reloading the page", it's intended for changes to content. CSS is one of the tools intended to manage layout and appearance. Is it possible to use one for the other? Of course.
- nfw2 3y agoAll the examples in this blog post use CSS to implement the functionality of the widget, not just appearance of them. By your own reasoning, that should be handled by JS, not CSS