All,
After watching multiple presentations from Google I/O 2017 on Polymer 2, I was struck with an oppositional view of the “adopt the platform” mantra that the presenters were espousing. While reflecting on this reaction for a couple of days, I couldn’t help but reminisce of days gone buy in this industry. It feels as though we keep reinventing the same wheel, and expecting a different result. For those of us that have been around long enough, we remember the failures of the past, and why they failed. Specifically, I’m thinking of Java Applets, and all the time I wasted writing them. While watching the presentations, I couldn’t help but notice the almost constant promotion of ES6 classes, and their use within Polymer 2. I also couldn’t miss the constant assumption that this will be the standard, that should be adopted. The more I thought about these annoyances, the more they continued to bother me, and it makes me question if our industry will every make any real progress, and move past a single set of ideas. Here are some very basic examples to help highlight my point:
A Basic Java Applet
import java.applet.Applet;
import java.awt.Graphics;
public class HelloWorld extends Applet {
public void paint(Graphics g) {
g.drawString("Hello world!", 50, 25);
}
}
<HTML>
<HEAD>
<TITLE> A Simple Program </TITLE>
</HEAD>
<BODY>
Here is the output of my program:
<APPLET CODE="HelloWorld.class" WIDTH=150 HEIGHT=25>
</APPLET>
</BODY>
</HTML>
A Basic Polymer 2 Component
<link rel="import" href="https://polygit.org/components/polymer/polymer-element.html">
<script>
// Define the class for a new element called custom-element
class CustomElement extends Polymer.Element {
static get is() { return "custom-element"; }
constructor() {
super();
this.textContent = "I'm a custom-element.";
}
}
// Register the new element with the browser
customElements.define(CustomElement.is, CustomElement);
</script>
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://polygit.org/components/webcomponentsjs/webcomponents-loader.js"></script>
<link rel="import" href="custom-element.html">
</head>
<body>
<custom-element></custom-element>
</body>
</html>
These feel eerily similar to each other don’t they? I can’t help but think that a certain style off code, primarily a certain form of OOPs is once again being forced on the developer. Each time the presenters proudly proclaimed we use ES6 classes with inheritance and everything; I couldn’t help but cringe, then follow it with a little chuckle. I mean really, we were doing this two decades ago. With the ever increasing awareness of functional programming styles and their benefits, it’s a little frustrating to feel like the “platform” is forcing or promoting one style without an obvious open door to other styles. A monolithic conceptual paradigm will certainly result in a false barrier to innovation, and will force the creation of even more abstractions over the “platform”.
This just makes me want to stay as far away from Polymer and web components as I can, which I know isn’t the intention, but is the side effect of the message that was being presented. I’m certain that I’m not alone in the assumptions that I’ve made, and that negative feelings that were inadvertently created as a result of these presentations. I’m sure that I’ve missed many of the finer details, and I’m probably wrong on all accounts; However, I would love to learn how the Polymer team, and the standards committees are planning to interoperate, and even accommodate some of the ideas from Purescript, Elm, ClojureScript, and others. At the end of the day it’s still all just some form of JS, but I’m fearful that the tech community will continue to recreate Java over and over again without regard to other advancements and ideas.
Many Thanks!
-- Nick
Hi Nick, I'm a fellow developer, not part of the Polymer team. My first foray into a production web app involved applets. Glad we've moved on :-)But I don't think applets fell out of favor because they used classes. That was the one aspect I've missed all these years, until recently. They were problematic in terms of performance, being confined to a rectangle, blurry printing, needing to compile a complex, proprietary language when JavaScript could do the same thing almost as fast, with a much lower learning curve, etc. And just not being "of the web" in the best sense, but controlled by one vendor (who famously went after another vendor for daring to ship their own version of it).
Most functional languages including F#, Scala, Haskell have classes. Nothing is forcing you to make your classes have mutable members.
I've seen examples of custom elements built with Elm, for example. You might also look at SkateJS, if you have a strong aversion to OOP.
Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/fc2c20e0-c690-4f8c-935f-b5ffec21d428%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
How best would you develop a collection of extendable components while avoiding classes?
Even 10 years ago libraries rolled their own class systems...
Should we avoid the platform way of doing inheritance and extensibility just because?
Everything you have alluded to in the past is all making do with what was available at the time...
ES6 is what's available from the platform...
With that being said, your aversion to it is confusing...
I will agree that the "module" system that landed in ES6 is by far not the smartest choice but it's what the lovely standards committee gave us...
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.