Live data from Hacker News

The Web’s Declarative, Composable Future

addyosmani.com

1–10 of 32 posts

Re: The Web’s Declarative, Composable Future

#2
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 as a platform for developing serious applications, because that's never what the technologies were intended to support. It offers only one major programming language, and that language is horrible. It offers one DSL that was designed to mark up content in simple ways and has been abused to fill some sort of ill-fitting UI description role. It offers another DSL that was designed for basic presentation functions, based on underlying models so bad that almost everyone ignores or overrides them even to the extent of building preprocessing tools to paper over the gaps. It offers limited separation of concerns in terms of content, presentation and behaviour, yet the promotion of web components seems determined to erode that separation even further. It offers almost no tools for modularity or composition in any of the three fundamental pillars everything is built with, and with a small number of exceptions even the various proposals to improve this don't look that promising so far.

We've seen this before, and we know how the story ends, if you just stop pretending the Web is somehow a special thing and look at general software development. The modern web being pushed by the likes of Google and Mozilla looks increasingly like the unintended result of one-night stand between modern C++ and VB6. It's all about papering over the cracks and shoe-horning existing tools into roles for which they are completely unsuited. This approach will get you so far, and then it will fail, as it always does.

We would do much better if we redirected all the recent enthusiasm for improving the Web. We can still recognise what has made the Web successful: essentially, it offers a ubiquitous, readily understood, cross-platform, client-server model for letting normal people interact with services running on someone else's system. But then we can also recognise the forces that are limiting web development today: lack of a real "portable assembly language" and run-time environment that a diverse range of programming languages can use as a stable, secure, reliable foundation; and the lack of a clean, flexible model for presentation and interaction.

You can't fix the latter using any combination of JavaScript, HTML and CSS, no matter how big a number you put after them. Their fundamental models are broken and cannot be repaired. The only way we will really make a big jump in what we can do is to build more suitable replacements that are designed to be fit for purpose from day one. And unfortunately, the organisations best placed to do that today seem determined to ignore all the warning signs from the history of software development and pursue a futile alternative anyway.

Re: The Web’s Declarative, Composable Future

#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 lock down, and so it makes me a little worried to increase the surface area with application-level extensions. Cautiously optimistic.

What really remains to be seen is whether this reduces or increases complexity. This really depends on how well it works to declare data in the document and then interact with that data via the JS. For instance, 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? Does it encourage "globals"-like behavior, where hidden dependencies crop up? Are there life-cycle behaviors to the Ajax component that might trigger the request at surprising or frustrating times?

If you're a Web Components advocate and you're feeling agitated, knock me down here. Fence-sitters are the worst when you're trying to get market-share for an idea, so sorry about that. It looks like Web Components are happening, though, so I'm sure I'll get to wait and see.

Re: The Web’s Declarative, Composable Future

#5

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…

1. What's so horrible about JavaScript? Could you give a few examples?

2. "one DSL that was designed to mark up content in simple ways" - With custom elements, we can extend that simple language to our liking. There are no bounds anymore.

3. "everyone ignores or overrides them even to the extent of building preprocessing tools" - Problem? We write in Sass/Less/Stylus/etc. which are capable languages that are continuously improved.

4. "It offers limited separation of concerns in terms of content, presentation and behavior" - What do you mean? You can separate those things just fine.

5. "It offers almost no tools for modularity" - npm is full of tools for this. You can have modularity in your source code and rely on tasks to package it for production.

6. "the Web is somehow a special thing" - Hm, it's open-standard and fully cross-platform. Looks pretty special to me.

7. "and run-time environment that a diverse range of programming languages can use as a stable, secure, reliable foundation" - Isn't JavaScript just that? I'm not an expert on this, but it looks like the general trend is that more and more languages are being compiled to JavaScript.

8. "to build more suitable replacements that are designed to be fit for purpose from day one" - I think we can all agree that this would be better, but it's just entirely unrealistic. We can't just ditch stuff that has become common. The Web is here to stay.

Re: The Web’s Declarative, Composable Future

#6

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…

1. What's so horrible about JavaScript? Could you give a few examples? 2. "one DSL that was designed to mark up content in simple ways" - With custom elements, we can extend that simple language to our liking. There are no bounds anymore. 3. "everyone ignores or overrides them even to the extent of building preprocessing tools" - Problem? We write in Sass/Less/Stylus/etc. which are capable languages that are continuo…

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.

Re: The Web’s Declarative, Composable Future

#7

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 feel you about the inadequacies and oddities of JS, HTML, and CSS, but who's going to engineer this clean break with the past? What entity or entities are cohesive enough in purpose and broad enough in interest to produce something that could ever hope to rival the existing, impressive-if-frequently-kludgy, broadly-installed functionality of the web platform?

What is so broken ("broken"-broken, not just "hard to do correctly", "inconvenient", or "inconsistent") about JS/HTML/CSS?

You bring up general software development, so I want to say: "custom elements defined with HTML templates rendered in a shadow dom" must just sound like layering crazy on crazy, but it's actually a really old-school idea: encapsulation. Encapsulate the HTML structure, the CSS that styles it, and the Javascript that adds behavior and/or fully elaborates the structure into a single thing and maybe some of the crazy can be controlled.

Re: The Web’s Declarative, Composable Future

#8
post #6

Earlier quoted context omitted.

1. What's so horrible about JavaScript? Could you give a few examples? 2. "one DSL that was designed to mark up content in simple ways" - With custom elements, we can extend that simple language to our liking. There are no bounds anymore. 3. "everyone ignores or overrides them even to the extent of building preprocessing tools" - Problem? We write in Sass/Less/Stylus/etc. which are capable languages that are continuo…

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.

1. JavaScript has "bad parts", yes, but we can just ignore them. Allow me to use an analogy here: Image you have a smartphone that has 100 apps installed, and of those 100 apps, 10 are crapware (e.g. pre-installed vendor-specific apps that are just bad). Does this make the phone horrible? No, of course not. Just ignore that crapware. Even if you can't uninstall it, it's not an issue for you. Use the good apps, install more good apps if you like to (analogy to JavaScript libraries) and ignore the crapware (JavaScript "bad parts").

2. That's literally what web components are for. Read OP's post. We will have and and many more custom elements with plug-and-play functionality.

Re: The Web’s Declarative, Composable Future

#9

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…

1. What's so horrible about JavaScript? Could you give a few examples? 2. "one DSL that was designed to mark up content in simple ways" - With custom elements, we can extend that simple language to our liking. There are no bounds anymore. 3. "everyone ignores or overrides them even to the extent of building preprocessing tools" - Problem? We write in Sass/Less/Stylus/etc. which are capable languages that are continuo…

Javascript has plenty of terrible language features, particularly in the scoping rules, but the biggest problem is the lack of any concept of modules/packages, or namespaces. tags just dump everything into the current page context. So you get stupid issues like name conflicts between all the different libraries that define a "$" function. Refresh the page or navigate to a new page and the context gets wiped out, so you have to store state in cookies to mimic the concept of a session. The 'Back' button often breaks everything. The whole platform was just designed for rendering simple documents and forms, not complex applications. The deficiencies of HTML/CSS/JS are why stuff like ActiveX, Flash, and now PNaCl even exist. They are workarounds, but they are proprietary and break portability, so they are not the way forward.

Yeah, you can make some pretty amazing applications with HTML/CSS/JS, but it's unnecessarily hard, you have to fight against the platform constantly, and the only reason why we do it is because we currently have no good alternative. Don't let the status quo blind you to the possibilities of how much better portable networked applications could be.

Re: The Web’s Declarative, Composable Future

#10
post #9

Earlier quoted context omitted.

1. What's so horrible about JavaScript? Could you give a few examples? 2. "one DSL that was designed to mark up content in simple ways" - With custom elements, we can extend that simple language to our liking. There are no bounds anymore. 3. "everyone ignores or overrides them even to the extent of building preprocessing tools" - Problem? We write in Sass/Less/Stylus/etc. which are capable languages that are continuo…

Javascript has plenty of terrible language features, particularly in the scoping rules, but the biggest problem is the lack of any concept of modules/packages, or namespaces. tags just dump everything into the current page context. So you get stupid issues like name conflicts between all the different libraries that define a "$" function. Refresh the page or navigate to a new page and the context gets wiped out, so y…

ECMAScript 6 modules: http://www.2ality.com/2013/11/es6-modules-browsers.html. The JavaScript language is evolving and the issues you mentioned have been addressed.
Post reply on HN