From, with love.
Subscribe now

The fate of Object.observe()

Hi everyone,

If you've been a subscriber for a while, you know I'm not an early adopter. As such, I get worried when people start to overly-rely on transpilers and polyfills to "use" something that hasn't been finalized and doesn't exist in reality yet. Doing so means you're using a prototype, a prediction of what might one day be implemented natively, and sometimes those predictions are very wrong.

Object.observe() was first proposed for inclusion in ECMAScript 6, but was pushed to ECMAScript 7 (or 2016, if you prefer). It was seen as a huge step forward for the state-of-the-art two-way data binding that dominated discussions in the past two years. Championed by Google, implemented in V8, and released without a feature flag in Chrome, it seemed like Object.observe() was on the fast track to becoming the web's most important new tool. But then, something happened.

While it's probably too simplistic to say that React caused the death of Object.observe(), React definitely did usher in the new era of one-way data binding, which effectively removed the primary use case of Object.observe(). As the world was moving away from two-way data binding, Object.observe() started to look less and less useful. Ultimately, the feature's champions formally withdrew Object.observe() from consideration for ECMAScript 7 and are planning to remove it from V8.

This should be a lesson about rushing to use experimental language features in production: they are experimental for a reason. You could very well be relying on something that won't exist in the future, and while the V8 team cites low Chrome usage statistics, the fact that most people were not using Object.observe() isn't going to save you the development pain of rewriting your code if you were.

The future will be here soon enough, and it's good practice to meet it when it arrives rather than trying to force it to arrive sooner.

Be well.

JavaScript WeeklySponsor: The O’Reilly Fluent Conference
Subscribers receive $200+ off with discount code NCZ20 (expires 11/30)

Recommended Links

How Our CSS Framework Helps Enforce Accessibility (article)
Accessibility is one of those things that can take a lot of time if you don't think about it early enough in the process. At eBay, they spent the time to create a CSS framework that enforces accessibility best practices, ensuring that the proper attributes and elements are used for best accessibility. A very clever approach.

Khan Academy React Style Guide (article)
Just like any library, React has some rough edges, and it's helpful to document useful and perilous patterns. Khan Academy has published their React style guide, and it's filled with useful information about what to do and also what to avoid when building a large-scale React application.

Fixing ContentEditable (article)
The contenteditable attribute has a long history filled with heartbreak and disappointment. As the de facto standard for rich text editing on the web, there are so many difficulties in creating cross-browser behavior that it's time to think about a change. This article talks about the history of contenteditable and a proposal for how to save it.
JavaScript WeeklySponsor: AdNgin
Increase AdSense Revenue with Fewer Ads

Recommended Book

Rework is a collection of blog posts from 37signals/Basecamp. If you've been an avid reader of the blog, you'll find a the same content in this book, albeit a bit more polished. Described as a book on entrepreneurship, I found it to be equally applicable to anyone who works for someone else. The short, to-the-point chapters (blog posts) contain small pieces of wisdom you can carry with you throughout your career. The book is a quick read and filled with good ideas and points to ponder about your career. Why are meetings so horrible? When is it time to look for a new job? What type of people would you like to work with? The book covers a breadth of topics that we all can relate to. 

Recently on NCZOnline

Hidden performance implications of Object.defineProperty()
I've recently been working on a project to port Espree[1], the parser that powers ESLint[2], to use Acorn[3]. In so doing, I ran into an interesting performance problem related Object.defineProperty(). It seems that any call to Object.defineProperty() has a nontrivial negative affect on performance in V8 (both Node.js and Chrome). An investigation led to some...

ECMAScript 6 destructuring gotcha
With all of the new syntax in ECMAScript 6, you're bound to periodically find something that is confusing (likely as you're hunting down an error). Recently, I've seen an uptick in the reporting of a specific type of error as it relates to destructuring assignment[1] using object patterns. Destructuring basics Before you can understand the...

Triggering Jenkins builds by URL
As you might have read not too long ago, I recently moved my site from Wordpress to Jekyll[1]. In so doing, I ended up using Jenkins[2] to periodically build and upload my site to S3. Having a Jenkins instance running turns out to be quite useful for all sorts of tasks and so I've been...


Love this newsletter? Hate it? Have suggestions for how to make it better? When you subscribe to the newsletter, you can just reply to send in feedback.
Copyright © 2015 Nicholas C. Zakas, All rights reserved.

unsubscribe from this list    update subscription preferences