This is really cool and would be a great way to introduce programming concepts in an educational setting. Instant-feedback, inline documentation in a narrative style, and running on a browser really lowers the barrier for entry.
I would have loved something like this when I was learning programming in middle-school decades ago. Since it comes from the guys behind D3 it's not surprising that much of the visuals come from D3. This is really evocative, but it may limit some of the audience for this tool. I would encourage the developers to take some cues from Apple's swift playgrounds and add visuals and sliders for even some of the simpler language constructs like loops and add some "simple" wrapper functions for drawing elementary shapes. This would definitely be a shift from the intended purpose as I see it right now, but it would have the side-benefit of increasing debugability as well. Great work - look forward to having the occasion to using it.
I would have loved something like this while learning to program as well. I mean ... the Ruby REPL was fun, but this sort of thing is just so much more tactile and visual.
We haven't had time to produce as many demo notebooks as we might have liked, but these notebooks really aren't D3-specific in the slightest. They're a reactive flavor of JavaScript, and anything that produces a value or can be rendered to the DOM will work. For example, here are a whole mess of Plotly charts: https://beta.observablehq.com/@jashkenas/plotly-js Here are some (wild) WebGL, Three.js and regl sketches: https://beta.observablehq.com/collection/webgl And here are some simple native inputs you can use to control your sketches: https://beta.observablehq.com/@jashkenas/inputs Remember — a "slider" here isn't anything special. It's just a chunk of DOM that produces a number as a value. It can be replaced with anything else you can imagine that produces a number as a value. There's no API there ;)
Oh that's cool I thought there were special hooks with D3. The native inputs demo seems really compelling especially in a learning environment. I'll definitely play with this and bring it into my next mentoring group meeting. (They'll be so glad to get away from scratch!)
One cool thing that Swift playgrounds let you do is advance program state through loops and other flow-control line-by-line using a slider. I think they have to have cooperation with the compiler/runtime to make this happen. (I'm also not sure how truly useful it is after a few days of learning the basics.) I suppose you could do something similar with the native inputs but not using native syntax. What I'm thinking would be a massive undertaking I realize - it's cool that this offering generates so many "ooh and what else" ideas.
Yes, it's absolutely worth exploring further — and we definitely have notions for ways to further expose and make interactive the running state of the notebook.
But for starters: You can do something similar to expose the internal state of loops and flow-control constructs by just using JavaScript's generators. Here's an extremely simple example that slowly yields the value of a loop's `i` variable: https://beta.observablehq.com/@jashkenas/flow-control-demo-w... If you remove the delay, it'll instead yield `i` at 60fps.
The app itself is well done, but the editing experience is quite lacking...It's 2018 and people don't want to write html/css/js as if writing txt files. https://codesandbox.io can be a good inspiration to learn from. I believe its popularity is a result of using Monaco[0] and supporting Language Servers[1].
I would advise looking into editing/language support early. Auto completion (for DOM API, D3 API, etc) and error checking can be very helpful to the user. Still, congratulations to the launch (the app looks beautiful and UX is pretty solid)! When I was reading @mbostock's medium post[2] a few months ago I knew something like this will popup. Anyway, back to building my own thing which focuses on the editing side of playgrounds, which I think is what most online ones (Codepen / JSFiddle) lack. [0]: https://microsoft.github.io/monaco-editor [1]: https://microsoft.github.io/language-server-protocol [2]: https://medium.com/@mbostock/a-better-way-to-code-2b1d2876a3...
This works by executing Javascript code written by the user. Since these notebooks are shareable, and there is also a log-in feature, do any security features need to be put in place to prevent, say, someone linking me to a notebook that sends my login credentials for observablehq.com to a malicious host? That is, is the javascript inside the notebook sandboxed in any way?
I don't fully understand how modern web security works. But "executing arbitrary javascript written by user A on website B viewed by user C" seems worrying.
Yep, Observable runs user JavaScript code, but that code has no access to your login credentials or anything from the 'application': user code runs in a sandboxed iframe on a separate host - host that doesn't have any cookies or user information. The application communicates with that iframe host through serialized postMessage information only. That's the gist of the 'user code' portion - the rest of the application has additional layers of best-practice security like very strict content security policies and so on that defend from other kinds of attacks.
The homepage copy didn't quite capture me... until I realized it was the new thing by D3's Mike Bostock! Maybe worth name-dropping that somewhere on that page? Though I don't know how many people would respond to that other than myself (hopefully lots of people).
Eh. I respect people more for not namedropping themselves, but maybe I'm alone in this.
(Are you sure it's a good idea to perpetuate the status quo? It's hard to get anyone to pay attention to what you've made unless you're already known. That seems a bit unfair to the next generation, and rather the opposite of oldschool hacker ethos.)
I totally see where you're coming from - name-dropping like that feels really tacky. I'd shy away from that on my own projects.
The challenge is helping people understand what something is and why it is valuable as quickly as possible. In this case, the fact that the team behind this are Mike Bostock (d3), Jeremy Ashkenas (Backbone, CoffeeScript) and Tom MacWright (Mapbox Studio) feels very relevant to getting me excited about the project. It's such a strong product that I imagine word of mouth (plus how well it demos) will do that job for them though. This was just my first thought on loading up he page in Mobile Safari (and then realizing what it actually was).
Echoing the other commentor, I think the name-dropping provides two important pieces of info:
1) I can match my previous knowledge of related projects to get an idea of what this project is trying to be, and likely have that be accurate. 2) in an age where any random half-baked idea has a polished marketing page and lofty ambitions, it's a noise filter for "these people have completed projects that have actually been used". If anything, on a page that doesn't name-drop, I'd trust a bare-bones, nocss landing page more.
This is a rare case where it seems useful for me to externalize my inner monologue: "Well, this just looks like Jupyter lite... oh, wait, this is Mike Bostock's project? He's built some very cool visualizations and some really powerful libraries with a tasteful API design... if this is his idea of a useful workflow it's probably well thought-out and executed and worth checking out."
Comments (128) 39 threads
Earlier commentsI would have loved something like this when I was learning programming in middle-school decades ago.
Since it comes from the guys behind D3 it's not surprising that much of the visuals come from D3. This is really evocative, but it may limit some of the audience for this tool. I would encourage the developers to take some cues from Apple's swift playgrounds and add visuals and sliders for even some of the simpler language constructs like loops and add some "simple" wrapper functions for drawing elementary shapes. This would definitely be a shift from the intended purpose as I see it right now, but it would have the side-benefit of increasing debugability as well.
Great work - look forward to having the occasion to using it.
We haven't had time to produce as many demo notebooks as we might have liked, but these notebooks really aren't D3-specific in the slightest. They're a reactive flavor of JavaScript, and anything that produces a value or can be rendered to the DOM will work.
For example, here are a whole mess of Plotly charts: https://beta.observablehq.com/@jashkenas/plotly-js
Here are some (wild) WebGL, Three.js and regl sketches: https://beta.observablehq.com/collection/webgl
And here are some simple native inputs you can use to control your sketches: https://beta.observablehq.com/@jashkenas/inputs
Remember — a "slider" here isn't anything special. It's just a chunk of DOM that produces a number as a value. It can be replaced with anything else you can imagine that produces a number as a value. There's no API there ;)
One cool thing that Swift playgrounds let you do is advance program state through loops and other flow-control line-by-line using a slider. I think they have to have cooperation with the compiler/runtime to make this happen. (I'm also not sure how truly useful it is after a few days of learning the basics.)
I suppose you could do something similar with the native inputs but not using native syntax. What I'm thinking would be a massive undertaking I realize - it's cool that this offering generates so many "ooh and what else" ideas.
But for starters: You can do something similar to expose the internal state of loops and flow-control constructs by just using JavaScript's generators.
Here's an extremely simple example that slowly yields the value of a loop's `i` variable:
https://beta.observablehq.com/@jashkenas/flow-control-demo-w...
If you remove the delay, it'll instead yield `i` at 60fps.
Chrome 63.0.3239.132, OS X 10.13.3
I would advise looking into editing/language support early. Auto completion (for DOM API, D3 API, etc) and error checking can be very helpful to the user.
Still, congratulations to the launch (the app looks beautiful and UX is pretty solid)! When I was reading @mbostock's medium post[2] a few months ago I knew something like this will popup.
Anyway, back to building my own thing which focuses on the editing side of playgrounds, which I think is what most online ones (Codepen / JSFiddle) lack.
[0]: https://microsoft.github.io/monaco-editor
[1]: https://microsoft.github.io/language-server-protocol
[2]: https://medium.com/@mbostock/a-better-way-to-code-2b1d2876a3...
I don't fully understand how modern web security works. But "executing arbitrary javascript written by user A on website B viewed by user C" seems worrying.
Yep, Observable runs user JavaScript code, but that code has no access to your login credentials or anything from the 'application': user code runs in a sandboxed iframe on a separate host - host that doesn't have any cookies or user information. The application communicates with that iframe host through serialized postMessage information only. That's the gist of the 'user code' portion - the rest of the application has additional layers of best-practice security like very strict content security policies and so on that defend from other kinds of attacks.
https://beta.observablehq.com/@ontouchstart/test
to confirm that the code is running in an iframe from host https://static.observableusercontent.com
(Are you sure it's a good idea to perpetuate the status quo? It's hard to get anyone to pay attention to what you've made unless you're already known. That seems a bit unfair to the next generation, and rather the opposite of oldschool hacker ethos.)
The challenge is helping people understand what something is and why it is valuable as quickly as possible. In this case, the fact that the team behind this are Mike Bostock (d3), Jeremy Ashkenas (Backbone, CoffeeScript) and Tom MacWright (Mapbox Studio) feels very relevant to getting me excited about the project.
It's such a strong product that I imagine word of mouth (plus how well it demos) will do that job for them though. This was just my first thought on loading up he page in Mobile Safari (and then realizing what it actually was).
1) I can match my previous knowledge of related projects to get an idea of what this project is trying to be, and likely have that be accurate.
2) in an age where any random half-baked idea has a polished marketing page and lofty ambitions, it's a noise filter for "these people have completed projects that have actually been used". If anything, on a page that doesn't name-drop, I'd trust a bare-bones, nocss landing page more.
All comments shown.
Couldn't load more comments. Check your connection and try again.