10 ms·
It’s good for users that HTML, CSS and JS are separate languages
- chriszhang 6y agoTotally agree. How I look at this. I want to write simple text posts. I don't care how it looks. Let the browser present the way it wants. I want only HTML. I don't care about CSS or JS. I don't even want to know what they are. I care about how my text post looks. I add CSS. I don't want to care about JS in my language I work with. I want to add dynamic functionality to my page. Maybe it is not a post but an app. Now I want JS.
- austincheney 6y agoThen just use markdown.
- tannhaeuser 6y agoYes, but let's not pretend the trifecta of HTML, CSS, JS is perfect either, or spin a genesis myth of order and purposeful design around it. In theory, JS is for interactivity, but in practice it's used for compensating the many, many shortcomings of HTML. For example, reveal menus used by many modern sites can't be implemented without JS (need to programmatically interrogate scroll position). Who's to say digital text has to stick to a 80s concept of casual academic publishing? Or take lazy loading (needs intersection observer), when the basic concept of assembling larger docs from pieces/text variables has been right there in SGML for over 30 years. The deal that made JS acceptable is that over time, as we learn more about digital text presentation, idioms pioneered using JS can be integrated/consolidated into HTML. Yet HTML is essentially stuck in the 90s or 80s. While CSS has gone nuclear and gained an unhealthy amount of syntax and layout concepts to compensate for it. The result is a media format that is simply unusable for creating acceptable results by a layman, and also doesn't capture essential structure of modern text (such as threads or bubbles of online discourse). Not that self-declared web "standardization bodies" care; web vocabulary activity has essentially stopped in 2017 when W3C published the final HTML spec and cancelled the SVG2 WG, and Mozilla stopped investing into core web tech. The only new proposals since were for example Google's "portal" element to aggregate third-party snippets.
- mdpm 6y agoHTML was for providing declarative markup. CSS was for styling that on a user-agent. JS was for enhancing the capabilities of the user-agent in the context of the markup. We then tried to make what was basically gopher++ into an app framework. Then we wanted all user-agents to behave the same, wanted pixel perfection. This meant we didn't empower user-agents to make their own presentation decisions. Glad you refer to SGML, I thought XHTML was amazing at the time too, then HTML5 broke compatibility with everything. JSON has been inferior in every way, but XML and attendant standards had also blossomed into fractal complexity. Ever try XSL-FO? Everyone can roll a wheel, and imagine a vehicle, but not everyone can build a car, at least not without engaging with some complexity. We need better tools for the middle ground, but need to avoid building new layers of abstraction that pretend the complexity isn't there.
- mirkodrummer 6y ago> HTML5 broke compatibility with everything How? It's backward compatible, it's the first spec that tells the browsers how they should handle errors and introduced new semantics. Semantics that gracefully degrade in non html5 browsers, I find this thing simply wonderful. It's for this same reason sites like https://spacejam.com/ https://spacejam.com/ still renders fine like they did back then.
- mdpm 6y agoHTML5 is no longer XHTML compliant. There were a suite of tools that worked with markup that weren't browsers. This allowed the web to be the input, output, and middle of other chains of tools. It was sort of like removing '|' from the CLI.
- mirkodrummer 6y agoI still don't get it, HTML5 lets you write your documents in XHTMLish way. The spec doesn't care, you just decide. And tools should still work as expected
- kodisha 6y agoI was the biggest advocate of this approach. Then, by chance I landed flutter/dart side project. The power of language where you can mix business logic in presentation files is awesome. You can include your own or 3rd party clients and get full autocomplete and type safety. The styling did feel awkward at first, but even I, being the first time developer managed to create pixel perfect replica of whatever crazy widget style our designer came up with. And using cols/rows made it easy to make app look good on variety of screen sizes. I hope that in some moment in time we get same experience for the web, and I encourage more people to try flutter/dart, you migh be pleasantly surprised.
- mdpm 6y agoStrong IDE support is a feature of a vendor language? Not surprised. The web has a few good IDEs too, but as you're free to use your own compilers, linker, dependency management, etc., it's a little tougher to do this with.
- k__ 6y agoWhile I personally think Flutter is a mess, shouldn't it be easy to port it to the web? Dart was created as a JS replacement and for a time the Dart to JS compiler emitted code that was more performant than vanilla JS.
- neya 6y agoAs someone who is just beginning to learn Flutter, I am interested to know why you think it's a mess. I've been a full stack engineer with a focus on backend for a while now and was just getting my feet wet with app development with Flutter. Is there something else better than Flutter I can give a shot? Thanks (in advance) for your advice.
- k__ 6y agoDon't think there is a real alternative. I personally prefer React-Native, but only because I know JavaScript and think flexbox is a really clean solution for mobile layouts. Flutter draws its UIs in a custom way, which is the exact opposite approach that React-Native takes.
- mwexler 6y agoTitle doesn't quite match the article. The central thesis, that the separation of structure, interactivity, and style is a good thing for users, is a separate need than the need for different languages. Sure, the languages are custom designed for each need, their differences engender separation, and decoupled domains means each can evolve at different rates. But none of that is necessary to separate interaction or style from structure through language constructs.
- neya 6y agoAlways a huge fan of Thomas Fuch's tweet: ~15 years trying to make everyone separate HTML, JS & CSS. And then suddenly everything went south and we’re writing code like this. https://twitter.com/thomasfuchs/status/810885087214637057?lang=en https://twitter.com/thomasfuchs/status/810885087214637057?la...
- tiborsaas 6y agoInteresting that people in the replies are really hostile, like "vomiting" and likes. Now 4 years later it's a standard way to write frontend with JSX.
- sbergot 6y agoFor css this is the best explanation that I can find: https://adamwathan.me/css-utility-classes-and-separation-of-concerns/ https://adamwathan.me/css-utility-classes-and-separation-of-... For react maybe this one: https://medium.com/madhash/rethinking-separation-of-concerns-with-react-7e5de1b5c0f7 https://medium.com/madhash/rethinking-separation-of-concerns... People are confusing separation of concerns with separation of languages. They are also acting as if we are all writing websites like zen garden where the html is fixed and we are changing the stylesheet every week. In reality react & most frontend technologies are used by webapp were UI consistency is achieved with a small css stylesheet and a base set of components (buttons, forms, etc). The css gives the design rules and the html implements them. The component are implemented in some files and the business rules in other files. Instead of making fun of this approach I invite you to try it out.
- mattacular 6y agoI've never worked on a production website or web app that managed to achieve the "small css stylesheet and a base set of components." Especially not in the responsive design era. Can it be done in theory? Sure. But in my experience working as a web developer it's one of those goals that always seems attainable at the beginning of a project but for various reasons never comes to fruition by the time it's launched and certainly not by the time it's being retired after months or even years of extending, iteration, changing development teams and maintenance.
- inglor 6y agoI don't understand... All these things are possible in systems where no such separation exists. What happens in other systems is that you can ask the system for an accessibility tree (for instance) and get a DOM like tree (for example in Android) so stuff like screen-readers still works just fine. Ditto for contrast - all these things are possible if the platform builds its building blocks with them in mind and the users don't have to deal with it. All the things and use cases the post mentions are possible in flutter/dart, Android and iOS. The thing preventing you from "sticking your app in Google Translate" isn't your app in iOS/Android/whatever or the technology - it's Google/Apple.
- swiley 6y agoThe nice thing about the web is that when a page does something stupid or malicious the user can inspect and modify the tree on their own.
- inglor 6y agoThe thing making this easy in web pages is the _tooling_ though. The reason this is harder in Android than in web environments is that web tooling is just _very_ mature. Theoretically nothing is preventing you from exposing this functionality in Android/iOS/flutter/react-native/ whatever. In practice hot-reloading is a lot more valuable and useful since you edit from your IDE (and not the devtools) and all modern UI platforms (flutter/android jetpack/SwiftUI) support it from what I recall.
- swiley 6y agoIs it tooling? I think it's a culture thing. With Android/iOS/flutter/react-native there's an expectation that developers are a separate community from the rest of the users, one that might not even use the apps they right daily. This contrasts heavily to the web where the users and developers are often using the same tools.
- taeric 6y agoIf course, any good you get from them being separate languages is basically lost to how non stable the languages are. Don't get me wrong, progress is good. However, so is stability. And if there is a spectrum between the two, few are holding the stability line. Which is why apps and pages written years ago probably don't work anymore. And that is ridiculously user hostile. Worse, for users, we have made the barrier of entry rather high. Which is silly, as a browser is clearly more advanced than the old qbasic prompt I grew up with. Yet building your own page is something you have to jump elsewhere to do.
- donbrae 6y agoHTML, JS and CSS all have great backwards compatiblity. I have sites that I built in 1997 that still render fine in browsers today. Features are really only ever added; very few are deprecated. If anything, modern tooling raises the barrier considerably for new devs. Getting started with a simple HTML page, including some CSS and JavaScript, then running it in the browser is — by contrast — easy.
- taeric 6y agoI confess the complaint is more geared at JS. That said, I suspect I just burned heavily on the xhmtl fiasco. Combined with how much has been added to CSS, I would more expect that pages made years ago would just violate so many current best practices that are practically required practices. I also favor more direct use of fixed positioning. The rube goldberg machine people make in order to get their squares where they want is borderline crazy. Edit: And, I should say that I agree on the tooling point. I don't see any technical reason it should be hard to make a web page. Getting my kids to create 3 files to get started, though, is less than promising. :D
- timw4mail 6y agoHTML and CSS are pretty stable, and quirks mode still exists for old websites. Javascript is where the majority of the churn and instability lies.
- 6y ago
- im3w1l 6y agoIt's the eternal debate: should you group things based on what they are (/bin, /etc), or by project (date_picker/, progress_bar/)?
- chrismorgan 6y agoI read through the linked Grand Unification Proposal out of curiosity. I’m sure its author means well, but it shows a great deal of ignorance of all parts of the stack (HTML, CSS, JavaScript, accessibility, computer science, &c.) and why they are the way they are, and proposes extremely impractical solutions to the perceived problems, while introducing problems ten times as bad as the ones it solved. It proposes ditching HTML and CSS in favour of JavaScript, but never seems to acknowledge that it also replaces JavaScript with a radically different beast that’s extremely incompatible with JavaScript, integrating an unspecified form of reactivity to the language, and shifting to some unspecified kind of lazy execution semantics. (Greenspun’s tenth rule of programming also applies to this mutation of JavaScript.) It drops the web’s layout system completely, including all text handling of things like wrapping or inline blocks, in favour of something absolutely crippled that accidentally embeds the halting problem and unbounded mutual recursion. Dropping text layout would certainly lead to people reimplementing much of the existing system in user space, and that would be a multi-megabyte library that now everyone would be shipping. (This is not the only case where shifting it into JavaScript is a much bigger deal than people tend to imagine; CSS transitions are surprisingly fiddly to implement correctly in pure JavaScript; in the best case, your single line becomes a dozen obscure lines and some kind of extra state storage.) Its examples of this brave new world are more verbose than the comparable HTML, elide critical details like z-ordering (which looks like it’s been done completely back to front, which would never fly for rendering performance), and get some basics of layout wrong, so that you’ll get collisions on tiny screens where the HTML a sane person would write using grid or flex (and perhaps even some float if they wanted!) would not have fallen over, and would be more maintainable. There’s also a substantial dose of cognitive dissonance: “I cannot stress enough that it is imperative to adopt preexisting and proven concepts rather than reinventing the wheel” and bemoaning the inefficiency of the documents that people write because they have ten times as many elements as it seems they should need, while proposing (a) shifting such fundamentals as layout and even text layout into user space, which is plain insanity; (b) reimplementing hyperlinks in JavaScript, in the `onclick = "open('…')"` style; (c) replacing functioning accessibility and metadata systems with… some vague idea that’s going to be better, or something, but doesn’t actually say anything. (Least of all about the accessibility tree—I get the impression the author may not even have heard of that.) No, I’m afraid this is all up a technically terrible proposal, with no real redeeming qualities at this time: most of the things it says are problems I disagree with, and most of its solutions are actually much worse problems. But I do think the proposer might like to learn some Lisp—you’re never going to convince people to replace the whole web stack like this, but understanding Lisp’s unification of data and code would definitely help develop some of these ideas into more practical things. Certainly any real unification of HTML, CSS and JavaScript would work best with S-expressions rather than some JSON- or JavaScript-like syntax.
- DonHopkins 6y agoNeWS was architecturally similar to what is now called AJAX, except that NeWS coherently: - used PostScript code instead of JavaScript for programming. - used PostScript graphics instead of DHTML and CSS for rendering. - used PostScript data instead of XML and JSON for data representation. https://en.wikipedia.org/wiki/NeWS https://en.wikipedia.org/wiki/NeWS
- tomasreimers 6y agoI think the author is conflating how product-developers write code with the abstraction browsers should consume. For example, the author talks about the benefits of HTML as allowing accessibility features and parsing by other tools: Agreed that this is important, but this is just as possible if developers wrote a single language which declaratively/imperatively outputs a tree representation of the hierarchy they would like to display; in fact, there are even many other platforms that do this and maintain the accessibility benefits stated in the article, such as the view hierarchy on iOS or [blockskit](https://api.slack.com/block-kit https://api.slack.com/block-kit) in slack. Most modern web frameworks (Tailwind / Bootstrap / React) blur the lines between structure/style/scripting aggressively - and today they kind of have to: is a modal a structure or a style thing? Why is responsive design stylistic only? Is it crazy that structure would change when you have less real estate? What if I need to compute some client-side-only value to show the webpage - should I block load? or put a placeholder and update later? I agree that it's important that the browser be able to have those abstractions so it can decide how to ultimately render the page to the user, but that's not the question at hand. The question is whether the current languages are the best ways for developers to express those abstractions. And if developers are already choosing to hack it (by opting for frameworks which work in a way the current web wasn't optimized for because they offer features such as code-locality, component reuse, and modern primitives), shouldn't we optimize the standards to better match reality and offer users a more optimized experience?
- Zelphyr 6y agoI wouldn't mind throwing HTML, CSS, and JS away and replacing it with a single language, perhaps something more functional. I'm imagining writing all my websites and web apps in something like Clojure: (html (head (title "My Website") (style (heading {:weight bold :size 24})) (body (heading {:level 1 :title "Welcome To My Website!"}) (nav (item {:title "Home" :link "/home"}) (item {:title "About" :link "/about"}))) (script (doseq [item nav] (if (= current-page (:link item)) (highlight item))))) Note: Untested code and there's probably better ways of doing it in actual Clojure.
- deergomoo 6y agoYou should check out Elm[0] if you haven’t already. It’s also worth noting that things like JSX and Vue templates are just syntactic sugar over render functions that look very similar to the example you gave (albeit less terse). John Sundell also has a Swift DSL[1] for generating HTML in a similar fashion, though Swift on the server is still very niche. Obviously these all still ultimately produce HTML, but they do offer some nice accordances for the developer. [0]: https://guide.elm-lang.org/ https://guide.elm-lang.org/ [1]: https://github.com/JohnSundell/Plot https://github.com/JohnSundell/Plot