82 points · by bkardell · 12y ago · 51 comments
Guess what I spent this afternoon doing.
This is why backend server devs seem to actually make it to middle age, whereas front end types go to burning man one time and never come back.
Yeah, HTML/CSS/JS have lots of warts and hangovers from their respective document-oriented origins. But recent developments have been great, and there are myriad tools to make working with these technologies pretty enjoyable (SASS in particular changes the whole business of styling.)
I think that ultimately, building cross-platform, cross-device apps is always going to involve a fair bit of work. The web's still the best tool for doing that, and it's getting better.
For instance TV set-top boxes very often use the web stack for their GUIs. Though, to be honest, they often use SVG for markup instead of HTML.
HTML/CSS/JS have warts but you have no choice but to use them.
See e.g. http://www.w3.org/TR/html5/references.html#refsURL wherein they add in a non-normative note a link to the WHATWG URL spec, but in the normative reference text instead link to an old, outdated working draft from 2012 which specifies an incorrect algorithm and APIs that do not exist in any browser like getParameterNames() and so on.
It's very tragic, and not at all good for the health of the web.
And rightly so. Being locked into a store worries me much, much less than being locked into using JS and HTML.
That you aren't worried doesn't mean that you're correct.
JS and HTML are about the only things offering freedom on the internet these days.
1) markup languages: 1 choice - HTML 2) client-side scripting languages: 1 choice - JS.
PS: please don't tell me about transpilation, it's crap.
Contrast that to the preferred emacs/vim + terminal tools of your average developer. No one is trying to make this easier for us, and those that are get ignored (like Adobe Muse, maybe?).
But several people seem to insist that's a poor solution. It sounds like they want direct support for other languages in the browser but how can they securely directly support other languages?
compiled html with something that resembles protocol buffer would make webapps much smoother.
I guess I'm a low level nerd.
no no no no no no no no no
You know what a compiled web app looks like? Here:
Content-Encoding: gzip
And presto! It works! It is human readable, and yet the representation the machine sees is compact!You know what makes webapps slow? It's badly-written Javascript. It's bad router and proxy connections. It's creating forty-odd connections to thirty-odd 3rd party CDN and analytics and ad platforms. It's gigantic images that aren't sized correctly. It's badly-written CSS that misuses transforms and graphics commands.
It's not JS implementations being slow. It's not HTML documents being hard to parse. It's not a shortcoming in HTTP.
Your comment suggests a lack of familiarity with the problem domain.
Um, based on what? My browser routinely takes up gigabytes of memory just to show me 'one PDF' worth of content. Analytics scripts steal my CPU time/power that I pay for. HTML/CSS's shitty ambiguous spec without a reference implementation means that no two browsers will ever work alike. And if you're on mobile, all that means you're battery life is screwed. And um.. security?
http://secunia.com/vulnerability-review/browser_security.htm...
The 1/100 of a penny worth of electricity that analytic scripts cost you a year is worse than the security nightmare of java applets and activeX? Come on.
also, http relies on tcp, so it will always be synchronous, there is hardly going back and forth between the client and server. ajax is not something easy to deploy.
The size difference over a wire between gzipped/deflated text and protocol buffers is also usually dwarfed by almost any other asset being loaded on the page (images, fonts, videos etc).
The benefits of human readability and simplicity probably outweigh those size differences, I think.
I do agree there's a lot of room for improvement in the html/css/js combination, though. They were designed for far less dynamic interfaces than those we're trying to build today.
The CSS model in particular is very conceptually complicated for a layout system. I say that having used it for 13 years.
Controlling browser prefetching and load ordering would do much more than rewriting to use a binary format, as would alternative layout options, as would better image formats, as would more performant VMs (e.g. better asm.js support), as would... A near-endless number of things. Text vs. binary for the initial document tree doesn't make an appreciable difference.
It's the increasingly complicated DOM, and CSS3 layout model.
Web Apps go slow, and this gets blamed on javascript because that's the language you happen to be writing in. (or wronging in). But the slowness you get usually comes from the constant triggering and retriggering of giant byzantine relayout and compositing algorithms from what you might think is reasonably written code.
it's THAT problem that facebook's react library is aimed at... fixing? no, reducing. Write reasonable JS, and let the library optimise DOM interactions.
Every new feature of HTML5 and CSS adds some weight to those enormous piles of sand the browser has to shift around.
Binary formats would not fix that. Bytecodes wouldn't fix that. Different languages wouldn't fix that. Javascript is fine. it's the DOM and CSS that need to be fixed.
Is it as fast on low end to medium-priced smartphones ? HN is much less complex than other website you can visit, it's a very minimal design.
Even if you compress it, how really is it to parse a big html page ? How many CPU cycle do you need depending on the size of the page ? Couldn't you optimize a webpage by removing unnecessary tags by compiling or pre parsing it ?
I'm talking about parsing performance though, not the size of one page.
Compiling HTML if done correctly and properly would effectively freeze the design permanently.
How ? And do you mean that as a good or a bad thing ? As a bad thing, I disagree, it could still be backward compatible.
And isn't frozen platform better to work on ? Can't remember the quote about frozen water.
Many modern HTML features exist because old parsers were extremely forgiving or even buggy. Even something as simple as the HTML5 doctype isn't a valid SGML doctype expected by HTML 4 browsers. It is a hack which just happens to produce the correct results on older browsers.
Javascript used to have to be placed in HTML comments so that old browsers wouldn't display the source code as content because the earliest browsers had no concept of client side scripting.
Obviously a frozen platform is better to work on -- that's why people continually suggest such things for HTML. Make it compiled! Make it binary! The current situation is far from ideal. But if someone had done that with HTML 1.0 it would have been a lot harder to make it version 5.0.
I think you're focusing on the wrong part of the problem if you think that HTML parsing is the limitation on web performance - it's not.
I just saw my coworker using Axure for prototyping and I was impressed - it creates working prototypes with clickable buttons that perform functions and calculations. It's basically what making webpages should be. Except it isn't. Why don't they just make that compilable and distribute a viewer to compete with web browsers? Inertia.
That's been done - with Flash, for example.
Azure is suitable for building prototypes. It's not a replacement for the arbitrarily flexible set of visual, semantic and development tools that HTML, CSS and Javascript offers.