4 ms·
Can someone explain why they use CSS and HTML? Why are two presentation frameworks used with a language called Javascript bolted on top, rather than a powerful
by mcartyem 14y ago
Can someone explain why they use CSS and HTML?
Why are two presentation frameworks used with a language called Javascript bolted on top, rather than a powerful programming language?
- clyfe 14y agoBecause one would end up implementing HTML and CSS in that "powerful programming language". Funny, have a friend that does desktop dev because he "hates web dev", built his own UI building framework on top of Swing : menu.addChild(item) ... Now he's building an XML dtd to automate it...
- mcartyem 14y agoYou seem to be saying that the reason to use HTML+CSS+Javascript is that without them one would need to use HTML+CSS+Javascript. That you use it because you need it. Well, are you sure you need all three? An alternative would be to use a more powerful language that would let you express the kinds of things you often need with CSS as macros and have no CSS at all.
- angersock 14y agoMore like, without them you will likely reinvent (badly) some subset of HTML+CSS+JavaScript. The problem is that you want to organize the content of the document (HTML+DOM) with annotations and whatnot, and then style it to look pretty or position it just-so (CSS), and then finally maybe add some goofy runtime logic or updating (Javascript). We've got tools that have evolved already to solve these three problems, so why not use them? One of the happiest days in my life was getting to do UI development on the web instead of an AWT/SWT/Swing behemoth (CAD software in Java) or really clean but subgreat visualization/menu framework (C with OpenGL, C++ with rendering interface, various other toolkits over time).
- mcartyem 14y agowhy not use them? Because they are not powerful enough.
- saraid216 14y ago> An alternative would be to use a more powerful language ...can you show us an alternative?
- andybak 14y agoBecause a declarative syntax makes sense for documents but not for writing logic.
- angersock 14y agoA powerful programming language here could be assembly or Lisp--that hardly makes it a good tool to use to do the things we expect for making user interfaces. Simple declarative DSLs (such as CSS) are head-and-shoulders above a general-purpose programming language, especially in a situation where logic is not really needed or required. CSS, fugly though it can be, very neatly and thoroughly solves the issue of "How do I style this content?" without adding the complexity of a programming language. Not all things want to be programmable and flexible.
- mcartyem 14y agoYou'll be surprised how often logic is needed. Can you automatically compute pixels or colors with CSS based on values of other elements in CSS? Or combined with values coming from a user's preferences? Seemingly trivial logic can reduce presentation complexity enormously. With a powerful programming language you have a better grip over the complexity than you do with CSS.