Extensible Web Summit Berlin: notes and thoughts on some of the sessions

As mentioned on this previous post, I attended the Extensible Web Summit past week in Berlin, where I also gave a lightning talk.

We collaboratively wrote notes on the sessions using this etherpad-like installation. Question: how are we going to preserve these notes? who owns OKSoClap?

Since writing everything about the summit in just one post would get unwieldy, these are my notes and thoughts on the sessions I attended afterwards.

Extensible web, huh?

This was held on the main room, as we felt that it was important to establish what “Extensible Web” meant before we continued discussing anything else.

I am not sure we totally established what it meant, but at least I came to the conclusion that “Extensible Web” is one where we can use its own low level APIs to build and explain the essential HTML elements. Once you can do that, it means that developers have equal “powers” as browser vendors, and we’re level for experimenting with new components / features / elements / patterns / APIs that might be included in the browser natively once they have been validated by the community.

For example, Chris Wilson used the example of being able to build the <audio> tag using Web Audio (and other bunch of APIs and techs, of course). Domenic talked about a project that tries to build all existing HTML elements using Web Components, and how that highlighted that some/many aspects of native HTML elements are not specced.

As a developer this is the aspect that excites me most about the notion of the extensible web. Give me the same powers browsers have, so that I don’t need to wait on Vendor X to get its act together and implement the ABC API. Maybe I’ll come up with something that everyone likes, and it becomes a universal pattern, or a universal tag.

There were discussions about how to “standardise” components, and how do we choose the one that is “better”. Speaking from experience, I can tell you the winner API/library/whatever will be the one which is easier to adopt and has the better README/documentation/examples. You can write a super efficient maths library but if all you offer to people is a JS file in a ZIP file in a server that is not available all the time, people won’t adopt your work. Instead they will go for the maybe less efficient maths library hosted in GitHub with a complete README and a bunch of examples that demonstrate how to use the library.

It was mentioned that often there are most popular libraries per region, so how are we going to standardise a library that is very popular in China when we do not understand how it works or even the comments which are written in Chinese? Someone said that if they do not speak English which is the lingua franca of the Internet, it will be their fault if we do not adopt their code.

I used to think like that, but experience has taught me that it’s a wrong view of the world. Being able to speak English other than your mother tongue is an immense privilege not everyone has been gifted with. I have had amazing contributions to my open source projects from brilliant people who hardly speak English, and it’s been truly hard to communicate, but if we make an effort, we all win.

So my answer to this is to be patient, and to try to write simpler English which is easier to machine-translate, and be even more patient, and try to use all the tools we can to communicate. Maybe we need to invest in better machine translation tools. Maybe we need to learn other people’s languages. Maybe we need simpler, evident code examples.

The discussion moved onto how to involve more developers and getting them on board, i.e. involved in the Extensible Web and all that, highlighting again the fact that those developers were not in the room, but the work we do has an effect on their lives. Mailing lists being a scary place was mentioned again. Moderate them? Not moderate them? What about having something else instead of mailing lists?

Performance was a discussion topic too. I felt there was a bit of… FUD dropped by some of the participants, with discussion of not being able to control memory in JS in a fine grained way just as you can in C++, or with JS not being “as efficient as native code”. Show me benchmarks and show me where this supposed slowness is affecting your particular use case.

Honestly I have seen native code that is horribly inefficient when dealing with UI, and it’s way easier to generate leaks and mismanage memory in C than it is with JavaScript. Not to speak about wasted developer time tracking segfaults and leaks, and the fact that your code will only work in one platform unless you invest more money in making your native code work in more platforms.

Finally there were discussions about having spec writers also write code that uses such spec, so they get an idea of whether the spec makes sense or not. I think this is a good idea, and would help in both adopting the spec but also in validating its adequateness.

Some people argued that not everyone codes and we shouldn’t make it a requirement for participating in specs. I partially agree with this.

Future JS

Collaborative notes for this session.

This session was a bit of Q & A with Domenic as he’s the one who’s more closely involved in the TC39 people.

The main take aways for me:

ES6 JS breaks when you try to load ES6 code in platforms that do not support it (because the syntax is just different, you cannot use feature detection). But you can use Traceur in the meantime! Idea being that Traceur is to JS as SASS is to CSS.

Sadly I’m slightly opposed to using transpilers because they add complexity to projects, and that extra compilation step sometimes prevents people from using/contributing to a project.

JS modules were discussed too. One reason for them not quite being there yet is because they were specified but their loading mechanism was not, which is actually crucial when it comes to deduplication, dependencies, etc. So that has been holding them down. I’m glad I use Browserify, nanananana 😛

There was also a good point made about JS modules making it harder to overwrite/touch native objects. For example, if you do

import Math from 'Math';

// Mwhahaha
Math.sin = function(x) {
  return Math.cos(x);
}

then other scripts using the Math module should not be affected by your local modification, which is something that does happen right now if you do the above evil reassignment and then use Math.sin in another part of your code, due to Math being a global object. This is neat!

Parallel JS is coming! I just love to do data intensive manipulation (an example is Animated GIF). Being able to run those calculations in parallel, but using the GPU and not Web Workers, would be amazing in terms of performance and battery life. ParallelJS transpiles some JavaScript code to something that can run on the GPU in parallel, and coincidentally there was a talk about Parallel JS in JSConf later that week-end, but I didn’t know it by then. I’ll speak about that in my JSConf post.

Web Components

And this was the last session I attended, as I had to prepare for the Web Audio Hackday happening next day!

Collaborative notes for this session here.

Since I had already exposed my opinions during the lightning talk, I decided to take a more observant role during this session, so I could take note of people’s concerns with regards to Web Components.

I’m a bit sad this session was slightly monopolised by the discussion/demonstration of somebody’s specific project that did not use Web Components because it was built before Web Components ever existed. People tried to drive the conversation back to Web Components by asking why was this project not rewritten with Web Components now–what was missing from the platform in order for that to happen? but the attempts didn’t quite work.

Yes, your project is amazing. Yes, it is a nice technical achievement. But you should also understand that this is just a one hour discussion, and you shouldn’t feel entitled to take over so much time of it by talking about how much better and cool your idea is instead of proposing solutions to make Web Components better–which is what we are here for.

Take aways:

People want to use web components as an encapsulation method. They want to load and make these components available to their HTML somehow, and then have all the members in their team use them in HTML without having to deal with configuration issues and stuff but getting instant quality code up and running.

I will refer to my previous article written after EdgeConf, and insist that Web Components are NOT a silver bullet.

I don’t see how much better it is to load a bunch of web components that declare config settings and then create instances of objects in HTML than it is to do that with JavaScript–with less weirdnesses and metamagic specific to your project, and the advantage that you can use jshint + uglify + browserify and all the rest of proven and well tested tools.

Some of the people in the room presented their work on Web Components that use non visual tags in JSConf, so I will add my thoughts on that talk and link to them later too.

There was a mention about it being legit to have tags that do not have a visible output–for example the <title> tag or the various <meta> tags which then happen to help search engines or any other sort of bots. While that was a valid point, I also thought that you need to teach bots the meaning of new custom components, and you also need to convince bots to implement an interface that lets you tell them that those elements have a certain meaning. This is open to SEO abuse. Also, do search engines trust titles and meta tags that much nowadays?

There was the customary reminder that DOM elements (including custom elements) are also JavaScript objects and you can interface with them and they can have custom methods and attributes and setters and getters, etc–not everything has to be totally imperative or totally declarative, and you can combine the best of both worlds.

Of course data binding came up in the discussion. Several frameworks are proposing different implementations of data binding in different manners, and there doesn’t seem to be any work on implementing this as a standard. Whatever it is, should be based in Object.observe, Domenic pointed out.

Then we were back to one of my favourite subjects: dependency management in Web Components. How do you make one depend on other(s)? One option being HTML imports which I mentioned already are not that cool, but they can deal with HTML and CSS. Another option is just using npm+browserify. This is what I’ve been using for my audio UI component experiments, where I was using custom elements to build complex GUI for virtual instruments.

There is an often overlooked issue with document.registerElement: once you register a custom element with a certain tag name, it cannot be registered again with the same name. So you can’t use two versions of the same element if they both try to register using the same tag name.

All in all: this is such a new technology we don’t know how to use it or what is the best use case or the best design patterns, and we’re confused.

So, in other words: business as usual. We need to keep using and experimenting with it, polishing its raw edges until it’s all smooth and nice.