Live data from Hacker News

The Web’s Declarative, Composable Future

addyosmani.com

21–30 of 32 posts

Re: The Web’s Declarative, Composable Future

#21

I'm worried about the direction the web is going in right now. I think a lot of the "progress" is being pushed by people whose agenda is building browsers and possibly certain very large and high profile web apps, and not so much by the people whose agenda is simply building good web sites. I also think a lot of the agenda is being pushed by people who want to move fast and break things. The trouble is, the web sucks…

The defects you point to are real, but it sounds like you're speaking to us from 2008. Have you spent any time looking at Clojurescript and David Nolen's work; React; Chrome dev tools; LightTable's integration with the browser; Atom; etc? Smart people are doing smart stuff. One other point I wanted to mention: I've worked with other UI frameworks for developing what you call "serious" applications, such as MFC, Windo…

The defects you point to are real, but it sounds like you're speaking to us from 2008.

Not at all, I just don't accept the premise that newer means better. There is more hype in the (front end) Web development industry right now than I have ever seen in any part of the software development world in several decades of working in the industry, and this is rarely a good sign.

To be specific, I think one of the things that has made the Web successful as a medium for both sites and more recently apps is its relative simplicity. This has allowed for a good degree of ubiquity and portability even when standardisation wasn't perfect. It also, importantly, made the field accessible to many new people. Even relatively non-technical folk could put together a simple web site by reading a few tutorials, and a beginner to "serious" web design/development could get up to speed within a reasonable period.

As we try to do more demanding things with the Web, some increase in complexity is probably inevitable, but that complexity has a cost. The limitations of the underlying foundations become more and more of a drag on progress for the whole industry the further we move in that direction. It will become harder and harder to change course the more people and organisations have committed to the current path. The signs are already there that even the big names can't get this right today -- try using almost any of Google's web apps on an iDevice at the moment, for example -- and it's great that there is so much enthusiasm for fixing the things that don't work well as they are. I just wish there was more interest in whether we've got the right answers to the most basic questions before we get too bogged down in relatively minor details.

Re: The Web’s Declarative, Composable Future

#22
post #12
post #6

Earlier quoted context omitted.

1. http://www.youtube.com/watch?v=hQVTIJBZook around 11:30. This is common knowledge, we should not have to repeat this every time we talk about this topic. 5. Where in npm (I've no clue what that is) can I find: 1. a calendar widget to put on my page? 2. an email, password, confirm password form to put on my page? You're not getting his point.

npm = node package manager. That's for server-side javascript with node.js. Totally different deal from what we're talking about here, which is client-side javascript.

You can use npm modules on the client via Browserify. And there is a dedicated to client-side package manager called Bower.

Re: The Web’s Declarative, Composable Future

#23

I'm worried about the direction the web is going in right now. I think a lot of the "progress" is being pushed by people whose agenda is building browsers and possibly certain very large and high profile web apps, and not so much by the people whose agenda is simply building good web sites. I also think a lot of the agenda is being pushed by people who want to move fast and break things. The trouble is, the web sucks…

I am not concerned in the least about the direction the web is going in right now.

You deride the use of preprocessors and such in other places in this thread, saying that there's a lot of people sinking resources into that, so I have to ask you: do you consider it a hack that you code in Clojure, or Java, or Haskell, or C, instead of coding in assembly? Is it a loss of resources that people are working on compilers for these languages? Is it a hack to code in assembly instead of directly emitting machine code? If the current web stack is the unintended result of a one-night stand between modern C++ and VB6, what is x86-64?

The biggest differences between current web technologies and the above analogies are: - Stuff built on top of current web technologies hasn't been under development for nearly as long as stuff built on top of machine code. - The basis here (HTML/CSS/JS) is actually relatively simple for someone who knows nothing about the web to get started with, to build something they can interact with quickly.

The biggest obstacles to using it properly even as a basis to build new tools and abstractions on top of have been, IMO, limitations in CSS (though with absolute positioning even those have been worked around effectively in tools like GWT) and primitive drawing, and flexbox and related developments + canvas have started to clear the most glaring of those issues up.

“You can't fix the latter using any combination of JavaScript, HTML and CSS, no matter how big a number you put after them.”

Big words. I will give you a challenge: come up with an idea, and I posit folks will come up with a way to implement it on top of these “broken models”.

In short, I have no idea how you're reaching the conclusions you're reaching, or what it is that makes what's there now not a “portable assembly language”. But regardless, without presenting clear ideas on what a better path would be, I'm concerned your complaints aren't truly useful—and are also needlessly difficult to understand. Complaints about the stack aren't new. Improvements are—and there are plenty of people making them, albeit layered on top of what's there.

Re: The Web’s Declarative, Composable Future

#25

I'm worried about the direction the web is going in right now. I think a lot of the "progress" is being pushed by people whose agenda is building browsers and possibly certain very large and high profile web apps, and not so much by the people whose agenda is simply building good web sites. I also think a lot of the agenda is being pushed by people who want to move fast and break things. The trouble is, the web sucks…

I hear my coworker complain about it regularly, talking about how much easier Powerbuilder was to do applications and how far astray we've went. :)

But it's true -- we had nice, established patterns for client-server applications and we go through more and more hacks to give it the same usability as a VB6 app over a decade ago in twice the hours.

To be fair, people have tried to solve it. Remember applets? For some reason, they never caught on. I worked on flex apps, and the only problem was that it depended on the flash plugin, was expensive, and had some maddening incongruities of its own. Others have tried and failed as well, because the web, to most people, is good enough.

We're in a "worse is better" kind of situation now. Plan 9 may have been better than Unix, VAX may have been better, but they didn't win.

Re: The Web’s Declarative, Composable Future

#26

I'm worried about the direction the web is going in right now. I think a lot of the "progress" is being pushed by people whose agenda is building browsers and possibly certain very large and high profile web apps, and not so much by the people whose agenda is simply building good web sites. I also think a lot of the agenda is being pushed by people who want to move fast and break things. The trouble is, the web sucks…

I am not concerned in the least about the direction the web is going in right now. You deride the use of preprocessors and such in other places in this thread, saying that there's a lot of people sinking resources into that, so I have to ask you: do you consider it a hack that you code in Clojure, or Java, or Haskell, or C, instead of coding in assembly? Is it a loss of resources that people are working on compilers…

You deride the use of preprocessors and such in other places in this thread

Strictly speaking that's probably true, but I'd like to be clear that I'm not really deriding the idea of preprocessors, but rather the need to use preprocessors to make up for weaknesses in the underlying technology that shouldn't be there.

Any time you start talking about a build process, you're talking about introducing (and subsequently managing) overheads. If adding that extra step is a big win for some other reason, the overhead is worth it. But if adding that extra step just brings you up to where everyone else was in the first place, your underlying platform isn't good enough.

Put another way, I think it's crazy how often I find a potentially interesting library for building a modern web page/app, but then the getting started page starts with something like "First install package management library P and with that get dependency management tool D, then create configuration file F, featuring dependencies A, B and C, run setup script S to install those dependencies and create scaffolding S', and now you have a complete project ready to go that includes only 3 levels of directory hierarchy and 17 files to start you off so you can follow the 'Hello, world' tutorial." That is an absurd amount of hassle just to get something going in a quick experimental project and see whether it's actually any good, and it amplifies the problems already caused by having so much fragmentation and NIH syndrome in front-end development today.

Stuff built on top of current web technologies hasn't been under development for nearly as long as stuff built on top of machine code.

That's a fair point, but I suggest to you that there is a flip side: when we build new tools today we also have the wisdom of hindsight. We have several decades of general software development experience to draw on that the guys building early tools in languages like C and the guys who developed the first GUI libraries didn't. And this is really the heart of my problem with the current situation: we don't seem to be paying any attention to those lessons, or the flashing neon signs that developers who went before us installed to warn us never to tread this path again.

I will give you a challenge: come up with an idea, and I posit folks will come up with a way to implement it on top of these “broken models”.

I almost rose to that challenge, but then I realised it was missing the point. You can write a word processor in assembler, and some people have, but just because it's possible, that doesn't mean it's an efficient way to do it with the other tools and techniques we have available today.

But regardless, without presenting clear ideas on what a better path would be, I'm concerned your complaints aren't truly useful

The problem with modern web development is that instead of trying to build tools that are comparable with the best we've developed elsewhere, learning from the greater experience of other software developers and DBAs and sysadmins and UI designers and all the rest, we're taking it as axiomatic that we have to build on what's already there.

Why should we do that? The amount of resources being thrown into new web standards and languages and preprocessors and tools across the industrial as a whole is vast, and it already includes several projects on a scale not very far from building the kind of "portable Web assembly language" or "powerful, flexible, extensible layout model" concepts I'm talking about. Just think about all the new rendering engines, JS runtime environments, X-to-JavaScript compilers, X-to-CSS compilers, and so on that have been built in recent years.

I don't claim to be nearly as creative or smart as, for example, the people who developed tools like SASS. But such tools have been developed, and have been very successful, and we can learn a lot from that both in terms of what is possible and how much easier good tools can make the development process. We can also learn a lot from where even those tools haven't been as successful, because as preprocessors they are inherently limited by their target format.

Re: The Web’s Declarative, Composable Future

#27
I quite like the concept of Web Components - operate with elements rather than blobs of JS. Browsers have been doing it for ages defining built-in elements. Now front-end devs have the tools to do the same. I'm excited to see what will come out of it.

If you want to get the gist of Web Components, there's a good 30 min talk by Eric Bidelman: https://developers.google.com/events/io/sessions/318907648

Re: The Web’s Declarative, Composable Future

#28
post #22
post #12

Earlier quoted context omitted.

npm = node package manager. That's for server-side javascript with node.js. Totally different deal from what we're talking about here, which is client-side javascript.

You can use npm modules on the client via Browserify. And there is a dedicated to client-side package manager called Bower.

Those are some pretty cool projects. This sort of thing really needs to be supported natively in the browsers and written into the ECMAScript standards, though. It looks like what both Browserify and Bower are doing is basically a macro expansion that outputs regular Javascript, which is interesting, but really shouldn't be necessary.

Basically the current state is that everyone knows that HTML/CSS/JS sucks (by sucks I mean not adequately productive to work in, relative to the feature demands of modern web applications), so we're building languages that compile to them so that we don't have to write them directly. JS is becoming like the assembly language of the web. Some cool stuff has come out of that, but it doesn't mean we should give up on trying to make HTML/CSS/JS better. They were designed to be written by humans, so we shouldn't need to compile to them in order to be productive.

Re: The Web’s Declarative, Composable Future

#29
post #4

I'm cautiously optimistic about Web Components. It's good to add well-defined interfaces to browser Javascript, and there's a certain logic to using the DOM. The DOM is central, it's queryable, and it itself can gain from expressiveness. Like Addy points out ("not a silver bullet") performance, security, and accessibility are not a given, and those are why I'm cautious. Security-wise, the document is already hard to…

These are legitimate concerns to have. There are many new technologies at play in this space and a lot of new concepts.

> What really remains to be seen is whether this reduces or increases complexity.

One word: scoping

This is an important concept in software development that we've severely lacked on the web. We're used to creating global documents of HTML, CSS, and JS and hoping it doesn't explode. Frankly it's a mess. I'm surprised we've put up with it for so long! The technologies behind web components (Shadow DOM and Custom elements in particular) empower us web devs to be good developers. That is, we can take advantage of patterns like OOP: compartmentalize and scope functionality to a particular problem space.

CSS/DOM encapsulation is an added benefit to tell this story. As a developer, I no longer have to hunt down what CSS is effecting my page. I just look at the element's definition.

The hope with all of this stuff is that there's less re-inventing the wheel and more productivity. Scoping takes us to this happy place. Unlike most new web platform APIs, the web component APIs are purely about developer ergonomics. It's about your productivity. That makes me super happy...both as a web dev and someone who teaches web devs.

> Like Addy points out ("not a silver bullet") performance, security,...

Nothing in web development is a silver bullet :) A best practice today may be an anti-pattern tomorrow. However, with components, we have the opportunity to bake in more for free. For example, accessibility is low on people's radar. If a component set takes care of the details for me, I'm a happy camper.

Nothing changes in regards to security. In fact, the API specs leave it out entirely. When people hear "encapsulation", they automatically think security. IMO, it's better to think about components as "scopes".

> ...one of Polymer's example components was an Ajax call, which I suppose you can fire from the script. Is that really better than putting the ajax parameters in the code?

Web components allow us to rethink what HTML can be; what it can do. We have to unlearn years (possibly) decades of assuming that HTML can provide no useful API. When given a declarative vs imperative API, I suspect 9/10 developers will go the declarative route. It's unquestionably easier.

`` is a good example of providing an a hybrid. It defines an imperative API on its DOM interface and a declarative one by configuring it through attributes and listening for events. Is the declarative route better? Perhaps. The point is that it encapsulates the details of using XHR. I'm excited to never NEVER write that boilerplate XHR code again.

Ajax is also a trivial example. The cognitive load of being a web developer is oftentimes too high. You can imagine more complex APIs and libraries (webrtc, webgl, etc) being offered as declarative custom elements. A declarative option makes those underlying technologies more convenient/approachable to others.

> Does it encourage "globals"-like behavior, where hidden dependencies crop up?

Components encourage the opposite. When used correctly, HTML Imports provides the necessary dependency management. If an element requires script x and element y, those deps can be included/bundled as an Import for the component.

> Are there life-cycle behaviors to the Ajax component that might trigger the request at surprising or frustrating times?

There's nothing stopping component authors from shooting themselves (or their users) in the foot. It's my hope that well-written components will surface to the top of the stack. If a component is naughty, no one will use it.

Re: The Web’s Declarative, Composable Future

#30
post #29
post #4

I'm cautiously optimistic about Web Components. It's good to add well-defined interfaces to browser Javascript, and there's a certain logic to using the DOM. The DOM is central, it's queryable, and it itself can gain from expressiveness. Like Addy points out ("not a silver bullet") performance, security, and accessibility are not a given, and those are why I'm cautious. Security-wise, the document is already hard to…

These are legitimate concerns to have. There are many new technologies at play in this space and a lot of new concepts. > What really remains to be seen is whether this reduces or increases complexity. One word: scoping This is an important concept in software development that we've severely lacked on the web. We're used to creating global documents of HTML, CSS, and JS and hoping it doesn't explode. Frankly it's a m…

Yeah, good thoughts, time will tell. We could go back and forth on some of the finer points, but that's better over a beer than a forum.

The scoping and the interface-definition are certainly the most promising aspects of this. I'm still very skeptical of using the DOM for non-UI purposes, but it could work out and that would be great. But even if not, even if it's just for GUI tasks, it's a win. I know bootstrap's components make life much easier in the common cases, and the concept is similar (but cleaner) here.

Post reply on HN