<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Flaki on Medium]]></title>
        <description><![CDATA[Stories by Flaki on Medium]]></description>
        <link>https://medium.com/@slsoftworks?source=rss-d7cb583a6faa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*MKUgadL6r5cvPqTA.png</url>
            <title>Stories by Flaki on Medium</title>
            <link>https://medium.com/@slsoftworks?source=rss-d7cb583a6faa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 03:45:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@slsoftworks/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Diving Into Rust for the First Time]]></title>
            <link>https://medium.com/mozilla-tech/diving-into-rust-for-the-first-time-79ce4fe35660?source=rss-d7cb583a6faa------2</link>
            <guid isPermaLink="false">https://medium.com/p/79ce4fe35660</guid>
            <category><![CDATA[rust]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Flaki]]></dc:creator>
            <pubDate>Fri, 08 Jul 2016 18:08:25 GMT</pubDate>
            <atom:updated>2016-07-08T18:08:44.561Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y1BM50iNmvX1bcBLq5d5DA.jpeg" /></figure><p><a href="http://rust-lang.org/">Rust</a> is a new programming language which focuses on performance, parallelization, and memory safety. By building a language from scratch and incorporating elements from modern programming language design, the creators of Rust avoid a lot of “baggage” (backward-compatibility requirements) that traditional languages have to deal with. Instead, Rust is able to fuse the expressive syntax and flexibility of high-level languages with the unprecedented control and performance of a low-level language.</p><p>Choosing a programming language usually involves tradeoffs. While most modern high-level languages provide tools for safe concurrency and memory safety, they do this with added overhead (e.g. by using a <a href="http://en.wikipedia.org/wiki/Garbage_collection_%28computer_science%29">GC</a>), and tend to lack performance and fine-grained control.</p><p>To deal with these limitations, one has to resort to low-level languages. Without the safety nets of most high-level languages this can be fragile and error-prone. One suddenly has to deal with manual memory management, resource allocation, <a href="http://en.wikipedia.org/wiki/Dangling_pointer">dangling pointers</a>, etc. Creating software that can leverage the growing number of cores present in today’s devices is difficult — making sure said code works <em>correctly</em> is even harder.</p><p>So how does Rust incorporate the best of both worlds in one language? That’s what we’ll show you in this article. <a href="http://blog.rust-lang.org/2015/05/15/Rust-1.0.html">Rust 1.0.0 stable</a> has just been released. The language already has a <a href="http://users.rust-lang.org/t/rust-1-0-launch-event-details-action-required-for-event-organizers/1025">vibrant community</a>, a growing <a href="http://crates.io/">ecosystem of crates</a> (libraries) in its package manager, and developers harnessing its capabilities in a variety of projects. Even if you’ve never touched a lower-level language, it’s a perfect time for you to dive in!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nzbw_GHhvhMD3hLJZkWRJQ.jpeg" /><figcaption><a href="http://devswag.com/products/rust-t-shirt"><em>Rust t-shirts celebrate the release of Rust 1.0 worldwide</em></a></figcaption></figure><h3>Use cases for Rust today</h3><p>So for systems hackers, Rust seems like a great choice, but how about those who are not familiar with low-level languages? Maybe the last time you heard the words “C” and “stack/heap allocation” was 10 years ago in CompSci 101 (or maybe never). Rust provides the performance typically seen only in low-level systems languages — but most of the time it certainly <em>feels</em> like a high-level language! Here are a few examples of how you can leverage Rust now in practical applications:</p><p><strong><em>I want to hack on hardware/write Internet-of-Things applications</em></strong></p><p>The <a href="http://en.wikipedia.org/wiki/Internet_of_Things">IoT</a> era and the expansion of the maker movement enables a real democratization of hardware projects. Whether it is the Raspberry Pi, Arduino, or one of the young titans like the BeagleBone or Tessel, you can choose from a slew of languages to code your hardware projects, including Python or JavaScript.</p><p>There are times, however, when the performance these languages offer is simply not adequate. At other times, the microcontroller hardware you are aiming for is not suited to the runtimes these languages require: slow chips with tiny memory reserves and ultra-low-power applications still require a close-to-the-metal language. Traditionally that language has been C — but as you might have guessed, Rust is the new kid on the block.</p><p>Rust supports a wide variety of exotic platforms. While some of this is still experimental, support includes <a href="https://zinc.rs/">generic ARM</a> hardware, the Texas Instruments <a href="http://antoinealb.net/programming/2015/05/01/rust-on-arm-microcontroller.html">TIVA dev board</a>, and even the <a href="https://github.com/Ogeon/rust-on-raspberry-pi">Raspberry Pi</a>. Some of the newest IoT boards like the <a href="https://tessel.io/">Tessel 2</a> even come with official, out-of-the-box Rust support!</p><p><strong><em>I’m operating high-performance computing applications that scale to multiple cores</em></strong></p><p>Studies suggest <a href="http://octarineparrot.com/assets/mrfloya-thesis-ba.pdf">Rust is already great for HPC (high-performance computing)</a>. You don’t even have to rewrite your whole application in Rust: its flexible <a href="http://doc.rust-lang.org/book/ffi.html">Foreign Function Interface (FFI)</a> provides efficient C bindings that let you expose and call Rust code without any noticable overhead. This allows you to rewrite your app module by module, slowly transitioning towards a better developer experience that will result in performance on par with the old code or better. You also get a more maintainable codebase with fewer errors, which scales better on a high number of cores.</p><p><strong><em>I simply need something fast!</em></strong></p><p>Rust is great for rewriting performance-sensitive parts of your application. It interfaces well with other languages via FFI and has a tiny runtime that competes with C and C++ in most cases, even when resources are limited.</p><p>Despite the work-in-progress nature of the language, there are already business-critical, live production applications that have been making good use of Rust for some time: Yehuda Katz’s startup, Skylight uses high-performance <a href="http://blog.skylight.io/bending-the-curve-writing-safe-fast-native-gems-with-rust/">Rust code embedded in a ruby gem</a> for data-crunching. The 1.0.0 stable release is also an important milestone in that no breaking changes should happen from now on. That makes it safe to recommend Rust for even the most demanding and robust applications!</p><p>Watch Yehuda Katz and Tom Dale talk about the <a href="https://www.youtube.com/watch?v=LazvK39Oc4U">basics of Rust programming</a> and how they used Rust with Ruby in their app.</p><h3>Getting started with Rust</h3><p>There are many tutorials covering Rust in general, as well as specific aspects of the language. For example, the <a href="https://blog.rust-lang.org/">Rust blog</a> has great articles on various facets of developing Rust applications. There are also excellent introductory talks such as Aaron Turon’s talk at Stanford University. He explains the main concepts and motivations behind Rust nicely, and the talk serves as the perfect appetizer, starting you on your journey:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FO5vzLKg7y-k%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DO5vzLKg7y-k&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FO5vzLKg7y-k%2Fhqdefault.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/33eca90f7987b04b6ad2439ba8156f60/href">https://medium.com/media/33eca90f7987b04b6ad2439ba8156f60/href</a></iframe><p>Talks and tutorials are no substitute for <em>writing code</em>, right? Rust’s got you covered in that regard, too! The <a href="http://doc.rust-lang.org/book/">Rust Book</a> was conceived to help you get started — from installation to that first <em>Hello World</em> to providing an in-depth reference for all the core language features.</p><p>Another resource worth mentioning is <a href="http://rustbyexample.com/">Rust by Example</a>, which guides you through Rust’s key features, from the basics to the arcane powers of traits, macros, and the FFI. Rust By Example offers invaluable live-editable, in-browser examples with all of the articles. You don’t even have to download and compile Rust, as you can try (and edit) all of these examples from the comfort of your living room couch, just as they are. There is also a <a href="http://play.rust-lang.org/">Rust Playpen</a> for the exact same purpose.</p><p>Not that downloading and installing Rust is much trouble, anyway. Head to the <a href="http://rust-lang.org/">Rust homepage</a> and download the appropriate binary/installer there. The downloads contain all the tools you need to get started (like rustc, the compiler, or cargo the package manager), and are available pre-built for all platforms (Windows, Linux, and OSX).</p><p>What is it then, that makes Rust so unique, so <em>different?</em></p><h3>The Rust Way</h3><p>Arguably it’s Rust’s unique <a href="https://doc.rust-lang.org/book/ownership.html">ownership model</a> that allows it to <a href="http://manishearth.github.io/blog/2015/05/03/where-rust-really-shines/">really shine</a> — eliminating whole classes of errors related to threading and memory management, while easing development and debugging. It is also invaluable in keeping the language runtime minimal and the compiler output lean and performant.</p><p><strong><em>The ownership model</em></strong></p><p>The basic principle of Rust’s ownership model is that every resource can belong to one and only one “owner.” A “resource” can be anything — from a piece of memory to an open network socket to something more abstract like a <a href="http://blog.rust-lang.org/2015/04/10/Fearless-Concurrency.html">mutex lock</a>. The owner of said resource is responsible for using, possibly lending out the resource (to other users), and finally cleaning it up.</p><p>All this happens automatically, with the help of scopes and bindings: bindings either own or borrow values, and last till the end of their scope. As bindings go out of scope, they either give their borrowed resource back, or in case they were the owner, dispose of the resource.</p><p>What’s even better is that the checks required for the ownership model to work are executed and enforced by the Rust compiler and “borrow checker” <em>during compilation</em>, which in turn results in various benefits.</p><p><strong><em>Zero-cost abstractions</em></strong></p><p>Since the correct operation of a program is asserted at compilation time, code that compiles can generally be considered safe with regard to most common types of memory and concurrency errors (such as <a href="https://www.owasp.org/index.php/Using_freed_memory">use-after-free bugs</a> or <a href="http://doc.rust-lang.org/book/concurrency.html#safe-shared-mutable-state">data races</a>). This is possible because Rust complains at compilation time if the programmer attempts to do something that violates the principles above, which in turn helps <a href="https://news.ycombinator.com/item?id=9477513">keep the language runtime minimal</a>.<br> By deferring these checks till compilation time, there’s no need to perform them during runtime (code is already “safe”), and no runtime overhead. In the case of memory allocations, there is no need for runtime garbage collection, either. This — advanced language constructs with little to no runtime overhead — is the basic idea of “zero-cost abstractions.”</p><p>Though a thorough explanation of the ownership model is outside the scope of this article, the Rust Book (linked above) and various talks and articles excel in explaining its principles. The principles of ownership and the borrow checker are essential for understanding Rust, and are key to other powerful aspects of the language, like its handling of concurrency and parallelism.</p><p><strong><em>Two birds, one language construct</em></strong></p><blockquote>Shared mutable state is the root of all evil. Most languages attempt to deal with this problem through the mutable part, but Rust deals with it by solving the shared part.<br> — <a href="http://doc.rust-lang.org/book/concurrency.html">The Rust Book</a></blockquote><p>Aside from memory safety, paralellism and concurrency are the second most important focus in Rust’s philosophy. It might seem surprising, but the ownership system (coupled with a few handy traits) also provides powerful tools for threading, synchronization, and concurrent data access.</p><p>When you try some of the built-in concurrency primitives and start digging deeper into the language, it may come as a surprise that those primitives are provided by the <em>standard library</em>, rather than being part of the language core itself. Thus, coming up with new ways to do concurrent programming is in the hands of library authors — rather than being hard-wired into Rust, restricted by the language creators’ future plans.</p><p><strong><em>Performance or expressiveness? Choose both!</em></strong></p><p>Thanks to its static type system, carefully selected features, and having no garbage collector, Rust compiles into performant and predictable code that’s on par with code written in traditional, low-level languages (such as C/C++).</p><p>By moving the various checks out of the runtime and getting rid of garbage collection, the resulting code mimics the performance characteristics of other low-level languages, while the language itself remains much more expressive. The (seemingly) high level constructs (strings, collections, higher order functions, etc.) mostly avoid the runtime performance hit commonly associated with them. Since the Rust compiler’s output is in the <a href="http://en.wikipedia.org/wiki/LLVM#LLVM_Intermediate_Representation">LLVM intermediate representation</a>, the final machine code makes good use of the LLVM compiler’s cross-platform benefits and all additional (current and future) optimizations automatically.</p><p>We could go on for hours about how with Rust you never have to <a href="http://blog.skylight.io/rust-means-never-having-to-close-a-socket/">worry about closing sockets or freeing memory</a>, how traits and macros give you incredible flexibility for <a href="http://rustbyexample.com/trait/ops.html">overloading operators</a>, or even working with Rust’s functional aspect, juggling iterators, closures and <a href="http://rustbyexample.com/fn/hof.html">higher order functions</a>. But we wouldn’t want to overwhelm you early on! Sooner or later you will come across these anyway — and it’s more fun to discover for yourself exactly how deep the rabbit hole is.</p><p>So now instead, let’s finally look at some code…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=79ce4fe35660" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mozilla-tech/diving-into-rust-for-the-first-time-79ce4fe35660">Diving Into Rust for the First Time</a> was originally published in <a href="https://medium.com/mozilla-tech">Mozilla Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beyond Offline]]></title>
            <link>https://medium.com/@slsoftworks/beyond-offline-bf5c013ec8e7?source=rss-d7cb583a6faa------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf5c013ec8e7</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[browsers]]></category>
            <category><![CDATA[mobile]]></category>
            <dc:creator><![CDATA[Flaki]]></dc:creator>
            <pubDate>Tue, 01 Sep 2015 15:56:23 GMT</pubDate>
            <atom:updated>2015-09-01T15:56:23.691Z</atom:updated>
            <content:encoded><![CDATA[<h4>Using a custom service worker to expand on your browser’s capabilities.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FgBGIxfaPAtlhzMO6z1yIQ.jpeg" /><figcaption>“Offline” — photograph by <a href="http://www.ericvalli.org/#/louis-vuitton/">Eric Valli</a></figcaption></figure><p>There is a lengthy ongoing debate on how the Web could compete with the onslaught of native apps on mobile platforms — heck, there is debate on <a href="http://www.quirksmode.org/blog/archives/2015/07/stop_pushing_th.html">whether it even <em>should</em></a>.</p><p>If you agree with <a href="https://twitter.com/slightlylate">Alex Russell</a>, you might agree that transitioning away from the safety of our wired broadband and spacious desktop CRT-s has made our web browsing experience… how should I put it… rather <em>“promiscuous”</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/60/1*avLWL1KwySRWZLx6WDpZhg.gif" /></figure><p>Clicking a link or button in your mobile browser while sitting on a train is not that comfortable, rewarding experience any more: compared to desktop, where errors and blank screens were a relatively rare occurrence and mostly the fault of the services themselves, the mobile experience is plagued by fear and anxiety:</p><blockquote>Will my mobile network hold up?<br>What if there is a tunnel coming up ahead of us?<br>I should have opened this in a new tab so at least I could have read the remainder of my feed while (if ever!) this loads!</blockquote><figure><a href="https://vimeo.com/132501774"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FGps68b6XfLzA8dzKIgiDg.png" /></a><figcaption><a href="http://www.webdirections.org/blog/whats-next-for-the-web-platform-progressive-apps-alex-russell/"><strong>Progressive Apps: What’s Next for the Web Platform? — Alex Russell</strong></a></figcaption></figure><h3>Workers back in service</h3><p>So we then put our trust in AppCache, hoping it could save us from this particular hell, and solve our connectivity problems once and for all.<br>Clearly, AppCache has <a href="http://alistapart.com/article/application-cache-is-a-douchebag">failed to live up to our expectations</a>, but at least it wasn’t all in vain — we learned a lot from our fumble. When the declarative approach failed to quench our thirst for a flexible and powerful tool in making our web properties tolerate network failures, we went the imperative route.</p><p><strong><em>Navigation Controllers</em></strong><em> were born.</em><br><a href="https://web.archive.org/web/20130728111641/https://github.com/slightlyoff/NavigationController/">Never heard of those</a>? Well, don’t blame yourself, as before long, it turned out the web had a lot more issues to solve related all these new usecases than a scriptable cache could possibly cover. But it was a great start, nonetheless, so they made it a new primitive, and navigation controllers morphed into something we tend to call a <em>“Bedrock API”</em> — the Service Worker API became a <em>thing.</em></p><p>It was hoped that these distinct scripts, not associated with any window per se, but bound to an origin could not just help making pages work offline (as scriptable caching proxies), but — maybe through some extensions — could be used in solving other use cases: push notifications, background synchronization, geofencing…</p><p>The idea of building an <a href="https://extensiblewebmanifesto.org/">extensible web</a> is not all that old. Adding primitives to the web that could be used then for polyfilling (adding newly drafted features to unsupporting browsers) &amp; prototyping (drafting a feature and refining, iterating it before it is finally specced) is a remarkable idea — and service workers fit the bill perfectly. By putting new tools in the hands of authors, browsers get better feedback on usecases and can decide on what issues and features to solve on a lower level — to increase adoption, performance and ease of use.</p><h3>Why this?</h3><p>The <a href="https://github.com/flaki/bpg2jpg">BPG2JPG transparent service worker polyfill</a> is a proof-of concept. It was created to demonstrate the above idea: service workers could be used to build much more powerful features than just providing offline support to your app. While offline support could be thought as “extending your browser with a new feature” — that is, being able to run your webapp when there is no connectivity — this is just one of the multitude of possibilities.</p><h3>How does it work?</h3><p>The <a href="http://bellard.org/bpg/">BPG (Better Portable Graphics)</a> image format is based on the HEVC video compression standard and promises up to 40% smaller encoded filesize for the same image quality as traditional JPEG-encoded images. Naturally, the format is not yet supported by any of the browsers out there — you could use the command line encoder, and the JavaScript polyfill (clocking in at around 190 KBytes, 65 KB GZIPped) to display them on your sites.</p><p>The <a href="https://github.com/mirrorer/libbpg/blob/master/html/bpgdec.js">original browser polyfill</a> uses XMLHttpRequest to download the images, then replaces the &lt;img&gt; tags in your document with HTML5 canvases and decodes and renders the images onto them. This of course results in several inconveniences (like having to deal with manually sizing of those canvases later on, etc.). Also, while decoding uses ASM.js, the image conversion blocks the UI thread, which could be a big issue on limited hardware (like mobile) and on pages with lots of images. Also, every image has to be decoded each and every time the page is reloaded, even if HTTP caching kicks in and the XMLHttpRequests are themselves cached.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*qmL9Oy5m5DoYyEzOdENuxw.png" /></figure><p>It might still be worth doing, though, since a 40% improvement on file sizes is a huge win in terms of server load and client data transfer. You can check out the <a href="http://xooyoozoo.github.io/yolo-octo-bugfixes/#camel&amp;jpg=m&amp;bpg=s">demo page</a> to see the gains for yourself — note that image-quality-wise JPEG-encoded images are practically indistinguishable from their BPG counterparts, even when JPEG images are encoded in the next-best (and thus, larger) encoding setting (large vs medium, medium vs small, etc.)</p><p>What the <a href="https://flaki.github.io/bpg2jpg/test-sw.html">transparent service worker polyfill does</a>, is to move decoding into the service worker script, and instead of displaying raw bitmap data, re-encodes decoded BPG images into JPEG ones. These images are then cached and returned to the browser for display.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XKbTo-8sSCJVYZcbp3U4rg.png" /><figcaption>The transparent BPG <a href="https://flaki.github.io/bpg2jpg/test-sw.html">service worker polyfill</a> in action!</figcaption></figure><p>As a result, all conversion happens in a thread separate from the UI thread, no UI blocking occurs<strong><em>*</em></strong>, and the webpage itself doesn’t need to be changed (beyond including the service worker), nor is manipulated afterwards — the image tags will transparently receive a JPEG-encoded image in place of the requested BPG ones.</p><p>Decoded/re-encoded images are also cached, so on subsequent loads images appear <em>instantly — </em>no re-decoding has to take place.</p><h3>…how is this an improvement again?</h3><p>One could argue whether downloading a few hundred kilobytes of script would offset the gains from images, but as I said this is just a proof of concept library.</p><p>It is easy to see that for sites that use lots of images (think Facebook), using a better image compression algorithm could be a huge win — no wonder Facebook was experimenting with the WEBP format on webkit-based browsers.</p><p>One could also easily write a direct BPG-to-JPG transcoder in C, and include that transcoder in the service worker via <a href="https://github.com/kripken/emscripten/wiki">Emscripten</a>, instead of using the Emscriptened decoder and a JavaScript encoder cobbled together like the above lib does — this could be an obvious win for both code-size and runtime performance. Also, service worker scripts are cached, as well as their dependencies, so this traffic should only be accounted for on every first <em>site</em> visit.</p><p>The current implementation also doesn’t account for the input image quality, and re-encodes images at 80% JPEG compression. This might not be desirable, as may result in loss of detail for some images, but that could be easily overcome with building adaptive encoding quality (input quality detection), or switching to a different output format (i.e.: PNG.) This all is a matter of sophistication of the lib, and balancing storage (cached size) and quality.</p><p>All in all, this is not a one-size-fits-all library that you could drop in your site and use it in production (<em>please, don’t use this in live production!</em>), but it does demonstrate that such library is possible, and even worthwhile to create.</p><h3>A word on Progressive Enhancement</h3><p>While you shouldn’t be using the above script in production, you could very well be using service workers in production, as at least Google Chrome has support for them for several versions now. You can <a href="http://christianheilmann.com/2012/02/16/stumbling-on-the-escalator/">progressively enhance your app</a> experience and reduce bandwidth and server load for <em>millions of users </em>of your app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*Fz01inthUD3QD0B40Savog.jpeg" /><figcaption>“Progressive Enhancement” by <a href="http://alistapart.com/author/kcornell">Kevin Cornell</a></figcaption></figure><p>If you wanted to use something similar to the above code in production; you could simply include the .JPG links in your HTML and link the service worker in your page to let it do all the hard work! On platforms that don’t support service workers, your browser would end up downloading and displaying the JPG images — done! On supporting platforms, though, you could modify your service worker to intercept image requests and automatically request BPG images instead, then transcode them accordingly. Note that this solves the initial load problem as well, as for the very first site load (when your service worker is not yet loaded/installed), regular JPG images will be downloaded and shown.</p><p><a href="http://alistapart.com/article/progressiveenhancementwithjavascript"><em>Dang — unobtrusive scripting at its best!</em></a></p><h4>How about other browsers?</h4><p>Developers at Mozilla are hard at work on adding service worker support, you could already try the above example in Nightly versions of Firefox, but you might need to set some configuration entries manually for it to work. By using the progressive enhancement techniques outlined above, your code will work with new browsers’ service workers out of the box as they are released.</p><h3>MDN Fellowship</h3><h4>…or “How did we end up here?”</h4><p>I have been following the evolution of service workers from the very beginning, and wow, it has been some journey! Service workers are becoming quite a hefty specification (especially with all the linked parts, like <a href="https://fetch.spec.whatwg.org/">Fetch</a> or <a href="https://developer.mozilla.org/en-US/docs/Web/API/Push_API">Push</a> and prerequisites like <a href="http://www.html5rocks.com/en/tutorials/es6/promises/">Promises</a>) so it can be quite a journey to wrap your head around all this shiny new stuff that’s going into the browser.</p><p>For service workers, this could have been even worse — things are starting to settle down now, but even up to a few months ago the API could change from right under you, implementations were in alpha state, bugs were abundant, documentation was scarce and possibly outdated. In an environment like this for someone to be able to keep sane it was <em>essential</em> to reach out to the experts: people living and breathing the specification, like <a href="https://twitter.com/slightlylate">Alex Russell</a>, <a href="https://twitter.com/jaffathecake">Jake Archibald</a> or <a href="https://twitter.com/annevk">Anne Van Kesteren</a>, or working on the browser implementation like <a href="https://twitter.com/wanderview/">Ben Kelly</a> or <a href="https://twitter.com/falkenmatto">Matt Falkenhagen</a> etc.<br>It was a journey in and of itself!</p><h3>Vignesh Shanmugam on Twitter</h3><p>mdnfellowship Day 2 pic.twitter.com/8cWch367Fr</p><p>In such a volatile environment, the <a href="https://blog.mozilla.org/community/2015/05/14/mdnfellowsannouncement/">MDN Fellowship</a> turned out to be a <em>national treasure.<br></em>For the MDN Fellowship five <em>fellows</em> were selected from five different functional areas (from testing and teaching, through performance to WebGL and service workers), who have been then working together with Mozilla experts in pushing their respective areas forward and developing teaching/learning materials to be used later in spreading the knowledge in those fields.</p><p>As one of those lucky fellows, I positively couldn’t thank enough the help of <a href="https://twitter.com/tbiz">Diane Tate</a>, <a href="https://twitter.com/chrisdavidmills">Chris Mills</a> and all the others — especially my mentors <a href="https://twitter.com/annevk">Anne Van Kesteren</a> &amp; <a href="https://twitter.com/brittanystoroz">Brittany Storoz</a>, as their help was invaluable in getting here.</p><h3>MDN Content Kits</h3><h4>Teaching the web — one repository at a time</h4><p>So what was it that came out of the 7 weeks of the fellowship, besides the lifelong friendships formed and service worker demos emerged?<br>Kick-ass learning materials!<br>One of the goals of the Fellowship was for the to fellows and mentors to work out an outline for teaching/learning materials for their expertise in the <a href="https://github.com/mdn/content-kit-template">MDN Content Kits format</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*wRwHirJSGVVm64JG0RuQmw.png" /><figcaption>The Content Kit format was developed by the bright folks responsible for MDN’s world-class docs on web technologies!</figcaption></figure><p><a href="https://developer.mozilla.org/en-US/Learn/Content_kits">MDN Content Kits</a> are condensed sources for not just learning, but teaching topics of various types and origins. They are aimed to serve as collected sources for teaching their respective topics, containing slides, resources, demos and information needed for someone who is (at least vaguely) familiar with those topics to be able to give talks, workshops or in other ways teach those topics to individuals or groups.</p><p>During the Fellowship with the help of my mentors I have managed to put together the baseline of an <a href="https://github.com/flaki/ck-service-workers">MDN Service Worker Content Kit</a>, that is intended to collect service worker related learning and teaching materials as well as resources for organizing workshops based around service workers, like the one based on above library “<em>Implementing one’s own service worker</em>”.</p><p>Content Kits are also collaborative, in that they encourage reuse and contributions from various fields — so if you feel competent, or used them and have some feedback to add, be sure to contribute and send a pull request with your edits, resources, presentations etc. or file issues to follow up!</p><h3>What’s next?</h3><p>Dear Reader, if any of the above inspired you to do something cool and/or useful with service workers, yay! Please drop me a tweet (<a href="https://twitter.com/slsoftworks">@slsoftworks</a>), or just write about your project and include it as a response here on Medium!</p><p>Also if you have time, pull <a href="https://github.com/flaki/bpg2jpg">requests are welcome for the demo repository</a>, as well as the <a href="https://github.com/flaki/ck-service-workers">Service Worker Content Kit</a> — file issues, share your feedback, teach the web and generally don’t forget to be awesome while doing it!</p><p>* please note, this still blocks the <em>service worker thread</em>, which is not at all ideal, but we would need to wait for <a href="https://github.com/slightlyoff/ServiceWorker/issues/678">workers-in-service-workers</a> until that could be resolved satisfactorily.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf5c013ec8e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JavaScript World Domination]]></title>
            <link>https://medium.com/@slsoftworks/javascript-world-domination-af9ca2ee5070?source=rss-d7cb583a6faa------2</link>
            <guid isPermaLink="false">https://medium.com/p/af9ca2ee5070</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Flaki]]></dc:creator>
            <pubDate>Tue, 24 Mar 2015 11:59:02 GMT</pubDate>
            <atom:updated>2015-04-06T18:07:48.458Z</atom:updated>
            <content:encoded><![CDATA[<h2>The JavaScript<br>World Domination</h2><p>From browsers to mobile phones, from tablets to tabletops, from industrial automation to the tiniest microcontrollers — JavaScript seems to creep into the most unexpected places these days. It’s not too long until your very toaster will be running JavaScript… but why?</p><h3>How exactly did we end up here?</h3><p>In recent months I have been frequently asked to talk about some next-level JavaScript (mostly ES6 and the <a href="http://slides.com/flaki/jot">JavaScript-of-things</a>) &amp; DOM technologies (i.e. <a href="http://slides.com/flaki/offline">Service Workers</a>) on meetups and conferences in Hungary.</p><p><a href="http://www.meetup.com/newtech-42/">At one of those meetups</a> I had a chance to present on “<a href="http://slides.com/flaki/js-eating-the-world">JavaScript’s World Domination</a>”. In retrospect, five minutes of stage time was bound to be <em>a bit slim</em> to cover a both some of JavaScript’s history, while also touching on the incredibly vast and diverse potential just waiting to explode onto the JS-biosphere — yet that was the basic idea there.<br>Anyway, to stick to the point, after the talk someone in the audience asked me the question:</p><blockquote>“Why hadn’t you mentioned Netscape’s <a href="https://en.wikipedia.org/wiki/SSJS">original server-side JavaScript solution</a> — but instead <a href="http://slides.com/flaki/js-eating-the-world#/2">pointed out node.js as “How it all started”?</a></blockquote><p>Well (apart from the obvious time constraint involved) this was a fair question — even though I think it was based on the wrong assumption of what “<em>How it all started</em>” referred to. I thought this might have deserved a bit more elaborate answer than the one given, which was something like:</p><blockquote>“While node wasn’t the <strong>first</strong> server-side JavaScript solution, it certainly was a turning point with regard to <strong>how</strong> JavaScript’s used today”.</blockquote><p>Server-side JavaScript in itself is a topic that would be troublesome to fit in its own five-minute talk — but here, what I meant is that with node.js a <em>new era</em> has begun for JavaScript — and this new era was about <em>so much more</em> than just server-side JavaScript! But well, let’s not get ahead of ourselves…</p><h3>Accidental JavaScript</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/589/1*GxGi2L_Hl1ozge0rTqLgSw.png" /><figcaption>David Linden’s original, <a href="http://www.hup.harvard.edu/catalog.php?isbn=9780674030589">“The Accidental Mind”</a> reimagined</figcaption></figure><p>When someone starts off to learn the ropes of the ECMAScript standard, they are bound to learn a lot — not just about the future of JavaScript, but (in order to fully understand the editors’ motivations and constraints) its history, too. This is exactly what happened to me, as I have slowly pieced together the fragments of the JavaScript lore, it became apparent that this was a language with a lot of “baggage” — one with quite a few skeletons in various closets to uncover.<br>JavaScript is a <a href="https://en.wikipedia.org/wiki/Kludge">kludge</a> — most of you reading this will be well aware of its anecdotal hasty inception, by its creator Brendan Eich. However (and this is important) this isn’t necessarily a bad thing!<br>JavaScript is a kludge <a href="http://www.hup.harvard.edu/catalog.php?isbn=9780674030589">in a way our very brains are</a> — in its advances being more <em>evolutionary</em> than revolutionary, hogged by all the cruft accumulated during its early days that it just could not afford to dispose of — but in the meantime, thriving both in numbers and in finicky smart additions that conceal its ancient aspects.</p><p>Before we go on a trip down memory lane to start our Civilization-esque journey of JS-evolution, here is a bit of glossary of JavaScript-monikers and early history:</p><p><strong>JavaScript</strong> is the name you are most likely familiar with — the name that stuck, but which is basically a marketing-stunt to ride Java’s fame, as early on Netscape’s browser-scripting language it refers to was called <strong>LiveScript</strong>. Heck, if you’ve <a href="http://devchat.tv/js-jabber/124-jsj-the-origin-of-javascript-with-brendan-eich">spent enough time around Brendan Eich</a>, you may have even heard how they wanted to call it “<strong>Mocha</strong>”.<br>Netscape, of course, couldn’t get away with being the sole browser offering in-browser client-side scripting — Microsoft’s Internet Explorer sported its very own interpreted script language, called <strong>JScript</strong>. JavaScript and JScript were similar, but not the same: the compatibility issues that followed started to plague the lives of contemporary “web designers”, so Netscape, Microsoft and the European Computer Manufacturers Association (now Ecma International) went ahead to unify the grammar and standardize browser scripting under the name — you guessed it — <strong>ECMAScript</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*L8tQsZAVhPae3aGehPe0Ig.png" /><figcaption>ECMAScript 2015 Release Candidate 1 (<a href="https://twitter.com/awbjs/status/568632824066019328/photo/1">via Allen Wirfs-Brock</a>)</figcaption></figure><p>Several languages popped up in the following years based on the ECMAScript standard — probably the most widely-known being flash’s <strong>ActionScript</strong>, which tried to cater for the original language’s shortcomings, but despite the effort it failed to pass on its extended features into the mainstream. Other than that, quite a few languages extended JavaScript in various ways (like <strong>CoffeeScript</strong> or <strong>TypeScript</strong>) since then, while the language itself evolved, incorporating the best ideas into the core. ECMA (more specifically, <a href="http://www.ecma-international.org/memento/TC39.htm">TC39</a>) has released several editions of the base standard since then —<strong> ECMAScript 5.1</strong> being the most recent (stable) one, while <strong>ECMAScript 2015</strong> — or as it was previously known <em>Harmony</em>, <em>ES.Next</em> or simply the <em>6th edition (ES6)</em> — is in the <a href="http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts#march_17_2015_rev_36_release_candidate_3">Release Candidate 3</a> phase and is slated for approval by the ECMA general assembly <a href="http://sdtimes.com/milestone-ecmascript-6-track-june-release/">in June</a>.</p><h3>Occupying the browser</h3><p>With this post I am not in the market of selling ES6&#39;s advances — there are a lot of <a href="https://github.com/lukehoban/es6features">great</a> <a href="http://www.2ality.com/search/label/esnext">sources</a> to find out more about the upcoming cool features and extensions — however I think we could agree on the fact that JavaScript has <em>pretty much dominated the browser market</em>. There aren’t a whole lot of client-side languages in browsers today, <a href="https://news.ycombinator.com/item?id=9201747">and that’s for a reason</a>: VBScript was <a href="https://msdn.microsoft.com/en-us/library/ie/dn384057%28v=vs.85%29.aspx">dropped in IE11</a> and Google is still trying to shoehorn Dart into the web (well, that mostly means Chrome) — <a href="http://www.walkercoderanger.com/blog/2014/03/dart-isnt-the-answer/">with not much success</a>.<br>What remains then? Not much, basically (quite) a few <a href="https://github.com/jashkenas/coffeescript/wiki/List-of-languages-that-compile-to-JS#coffeescript-family--friends">compile-to-js &amp; JavaScript-superset languages</a>, but at the end of the day, even these are just pushing JavaScript’s agenda forward. Heck, JavaScript even compiles to <em>itself</em> — with <a href="https://babeljs.io/">tools</a> being able to <a href="http://en.wikipedia.org/wiki/Source-to-source_compiler">transpile</a> the new functionality in ES6 into previous versions of the standard for backward compatibility.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*fQgETwYtPvDaHyfBXSkpww.png" /></figure><h3>Suddenly — a wild JavaScript appears</h3><p>As JavaScript was becoming more and more ubiquitous as it was accumulating developer mindshare, it started popping up in weird and unexpected places: initially, this was just the corners of the web previously untouched by the JS-pandemic, but soon after that, JavaScript was all over the place. There were essentially two (more or less) well-known laws in IT that contributed to, even foretold JavaScript’s world domination.</p><h4>Moore’s Law</h4><p>I doubt computing’s most essential law needs any explaining to anyone who got this far in reading this article: <a href="http://en.wikipedia.org/wiki/Moore%27s_law">Moore’s law</a> (oversimplified) states that hardware complexity (and thus, speed) increases in an accelerating fashion. So far this has been generalized in various ways (i.e.: how it really is about “<a href="https://medium.com/@nivo0o0/when-exponential-technological-progress-becomes-our-reality-74acafd65e26">exponential progress in the wake of tiny revolutions &amp; paradigm shifts</a>”), but we are interested in its rawest aspect: explosive growth of brute computing power in an ever-shrinking package.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_KuLiW7RECD9dDl5yzzULw.png" /><figcaption>Moore’s Law explained (by Ray Kurzweil, <a href="http://digitalcommons.usu.edu/cgi/viewcontent.cgi?article=3164&amp;context=smallsat">via Niv Dror</a>)</figcaption></figure><p>What these seemingly unstoppable technological advances made possible: they made performance <em>less of a sensitive aspect</em> when developing applications. In a software ecosystem, performance is just one aspect — developer mindshare (programmers familiar with the language &amp; environment), available tools and libraries, openness &amp; onboarding cost are all very real constraints one has to deal with. Back in the days where megahertz and kilobytes were of scarce serving JavaScript’s suboptimal nature was a much bigger hindrance than in today’s amply-powered cheap devices.<br>Moore’s law was what made the <em>mobile web</em> possible — while in the meantime JavaScript taking a stab on the <a href="http://hu.wikipedia.org/wiki/Node.js">server-side</a>, <a href="http://en.wikipedia.org/wiki/Chromebook">desktop</a> &amp; <a href="https://developer.mozilla.org/en/Firefox_OS">mobile operating systems</a>, eventually seeping into the <a href="http://www.espruino.com/Pico">tiniest microcontrollers</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/378/1*nh4sctlhro4aCTWy0ziyLQ.gif" /><figcaption><a href="http://docs.oracle.com/cd/E19957-01/816-6411-10/getstart.htm">Netscape’s original Client+Server-side JavaScript architecture</a></figcaption></figure><h4>Serve your script, and eat it too</h4><p>As mentioned above, node.js wasn’t the first time JavaScript has wandered server-side — Netscape has offered server-side JavaScript execution <a href="http://en.wikipedia.org/wiki/JavaScript#Server-side_JavaScript">in its Enterprise Server</a> as early as in 1994, right after the language’s inception.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*L-bxgD4lNWmmXiMSTKsUbg.gif" /></figure><p><em>But it didn’t stick.<br></em>Why? Well mostly because <a href="http://philip.greenspun.com/wtr/livewire.html">it was a serious pain in the bum using it</a>. For one thing — <em>it wasn’t live at at all</em>, the application had to be <em>compiled</em> after the slightest modification.<br>Of course, just because it didn’t work out for Netscape, that doesn’t necessarily mean server-side JavaScript was a lost cause, so various solutions to the same problem kept popping up.</p><p><a href="http://helma.org/">Helma</a> &amp; <a href="https://github.com/tlrobinson/narwhal/">Narwhal</a> were one of those projects. Helma — now abandoned (<em>or rather, spun out into </em><a href="http://ringojs.org/"><em>Ringo.js</em></a>) — was running Mozilla’s Java-based JS-engine, <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino">Rhino</a>, while Narwhal theoretically supported <a href="https://github.com/tlrobinson/narwhal/blob/master/docs/engines.md#engines">several different JS-backends</a>. Both of those frameworks found their respective niches — but neither of those found widespread popularity — that could be chalked up for several of their shortcomings, but before we get there, there is one more thing we need to mention: the DOM.</p><h4>DOMinating the JavaScript World</h4><p>When Microsoft and Netscape released their respective scripting-enabled browser offerings, they started standardizing the programming languages — which effort was to become ECMAScript later. However, web browsers (even back then) were not just empty shells, nice facades for a script console. Web browsers comprised a full environment (an operating system of their own, so to speak), of which JavaScript(/JScript) was just a tiny fragment — every time one needed to <em>interface </em>with some of the browser’s features (like the HTML markup of the document itself, or the styling of the nodes) one needed an <a href="http://en.wikipedia.org/wiki/Application_programming_interface">API</a> for that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/1*C0YzHNhJSqgbr2aDwFGFGQ.jpeg" /><figcaption>Internet Explorer’s dHTML (from the book <a href="http://www.amazon.com/Developing-XML-Solutions-DV-MPS-General/dp/0735607966/ref=sr_1_1?s=books&amp;ie=UTF8&amp;qid=1427190566&amp;sr=1-1&amp;keywords=0735607966">“Developing XML Solutions”</a> via <a href="http://flylib.com/books/en/3.247.1.88/1/">flylib.com</a>)</figcaption></figure><p>Both Netscape Navigator and Internet Explorer went on to introduce their own (of course, incompatible) APIs for accessing the document object model, which eventually went on to be standardized separately and <a href="http://www.w3.org/2002/07/26-dom-article.html#history">became the DOM standard</a>. The DOM is supposed to supply the bindings — both language and platform-independent — to the features exposed in a browser (or more broadly, by the <em>environment</em>), and has evolved just as ECMAScript evolved, in standards released by W3C in tandem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*Tv6Lypy_7KXta2KzY91d0g.png" /><figcaption>Basic scheme of the <a href="http://en.wikipedia.org/wiki/Document_Object_Model">DOM</a> — image <a href="http://code.tutsplus.com/tutorials/javascript-and-the-dom-series-lesson-1--net-3134">via James Padolsey</a></figcaption></figure><p>Eventually, besides the DOM several other features and extensions emerged, some of which went on to be standardized and accepted cross-browser, some of which remained confined to a single browser vendor or environment. Such efforts are continuously being worked on as of today (one particular cooperative effort being the <a href="http://www.w3.org/TR/service-workers/">Service Worker specification</a>), and are even <em>encouraged,</em> <a href="https://extensiblewebmanifesto.org/">as a means of extending the web</a> and keeping it up to speed with technological advancements.</p><p>Why all the above is relevant? Well, for one thing the two are confused quite often so it didn’t hurt to get that misunderstanding out of the way — but more importantly, is because while all client-side JavaScript solutions at this point had <em>some</em> standardized APIs for accessing their environment, all the above server-side solutions were vastly incompatible in their ways (i.e. accessing a file’s contents on the server). There were attempts trying to weld the two technologies together before: one such unlikely hybrid was <a href="https://github.com/aptana/Jaxer">Jaxer</a>, running a fairly complete <em>Firefox instance, complete with browser DOM</em> on the server-side. However, even Jaxer had its own way of <a href="http://ejohn.org/blog/server-side-javascript-with-jaxer/">dealing with lots of the environmental factors</a>, so for really useful outcomes of this hybridization, we still had to wait for node.js to arrive.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*4_n18FH8hRrvlLyRufD1sQ.png" /></figure><h3>Enter node.js</h3><p>Whoah, I have sure preached quite extensively about node up to this point (not that I have any particular interest in selling it to anyone), but hopefully I have managed to give a fair preface to:</p><p><em>Why was node.js </em><strong><em>a big deal</em></strong><em>?</em></p><h4>It just happened to be<br>in the right time, at the right place.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/1*ksFQo_CqXyvEkFFcXEtMRg.png" /><figcaption>JavaScript speed increase during the browser wars (<a href="http://extremelysatisfactorytotalitarianism.com/blog/?p=514">via Brendan Kenny</a>)</figcaption></figure><p>The <a href="http://en.wikipedia.org/wiki/Browser_wars#Updated_browsers_released">browser wars were raging</a>, JavaScript execution speed was tenfold ahead of anything anyone had ever seen before — and due to the fierce competition, was still steadily increasing… and yet,<br><a href="http://jsconf.eu/2009/video_nodejs_by_ryan_dahl.html">Ryan Dahl, the creator of node.js</a> wasn’t even <em>trying</em> to shoehorn JavaScript into a server environment.<br>Au contraire, admittedly <a href="http://www.reddit.com/r/node/comments/h1m2o/i_am_ryan_dahl_creator_of_nodejs_ama/c1rxnb8">he just stumbled upon</a> the mighty V8 engine while researching event-driven server techniques — JavaScript just <em>happened</em> to be a suitable fit to evented, non-blocking I/O, and a single-threaded event-loop based environment.</p><h4>A-synchronicity</h4><p>Even though the idea of asynchronous, non-blocking/evented I/O wasn’t new at all, <a href="http://daverecycles.tumblr.com/post/3104767110/explain-event-driven-web-servers-to-your-grandma">event-driven web servers</a> were not all that abundant. Event-driven server origins go as far back as <a href="http://www.cs.princeton.edu/~vivek/flash/">1999, the nascent Flash</a> (no, not <em>that</em> flash) server used this technique — but other server-side solutions using the same paradigm are on quite short order. In fact, (and please correct me if I’m wrong), node.js actually predates the single other relevant solution I could find, <a href="http://www.tornadoweb.org/en/stable/guide.html">the Tornado web server</a> (<a href="https://github.com/tornadoweb/tornado">written in Python</a>) by at least half a year.</p><p><em>Pointed out by Alexandre in the comments — the Nginx server was also event-driven (which actually is mentioned in Ryan’s original presentation, pitching it against Apache’s threaded system), however I would argue that it is much less powerful/flexible for this to count as fair comparison.</em></p><p><em>Also pointed out by several readers, the </em><a href="http://en.wikipedia.org/wiki/Twisted_%28software%29"><em>Twisted Framework</em></a><em> (written also in Python) was an event-driven async networking framework, which well predates node’s release. One could argue whether Twisted fits the argument above or not, but certainly is a valid point — thanks for pitching in!<br>(Twisted also has </em><a href="http://www.tornadoweb.org/en/stable/twisted.html"><em>extensive interoperability with above mentioned Tornado web server</em></a><em> which I think better fits node, but that’s simply a personal opinion.)</em></p><h4>Gathering a Common-ity</h4><p>Node was the first server-side JavaScript solution to gather a sizable community (on several different levels). Releasing it as open-source software, contributions flowed in (<a href="http://www.infoworld.com/article/2855057/application-development/why-iojs-decided-to-fork-nodejs.html">arguably not at a pace that was satisfactory for some</a>, but well, it was a start), adopting <a href="http://en.wikipedia.org/wiki/CommonJS">CommonJS</a> as the interoperability platform in node (and thanks to <a href="https://www.npmjs.com/">npm</a>), the developer ecosystem thrived (Narwhal/RingoJS both utilized the CommonJS standard — but neither could pull off anything like the advent of node.js and npm spurred).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ctzYgpquS83lSKAp97ysHg.png" /></figure><p>The arrival of IO.js in early 2015 has further extended and revitalized the community around node.<br>Contributions soared sky-high as the <a href="https://iojs.org/en/faq.html">open-governance model</a> selected by the fork’s authors started to do its magic:<br>in a few months, <a href="https://medium.com/@iojs/io-js-and-a-node-js-foundation-4e14699fb7be">the number of active contributors has overtaken that of the early node.js days</a>, and localization teams took the community to new frontiers.</p><p><em>“Okay, okay — node.js breathed new life into server-side programming, it is our savior, a fearless knight in shining armor, yadda-yadda — I get it, sheesh…”</em> — well yes, but it didn’t even stop there!</p><h4>Extending the chain of command</h4><p>Node also made it trivial to embed JavaScript in a cross-platform way into… well practically <em>anything</em>. It all started with the <a href="http://www.2ality.com/2011/12/nodejs-shell-scripting.html">command line</a>, and at a blink of an eye JavaScript based scripting and tooling was zapped into the world.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/1*D8FlFxXnJOPF69CccvsskA.png" /><figcaption>Node.js and the myriad of tools it has spawned has made cross-platform task automation a breeze, extending the JavaScript tooling leaps and bounds beyond what was possible before.</figcaption></figure><p>Easy to use, extensible, and available for all relevant platforms <a href="http://gruntjs.com/">Grunt</a>, <a href="http://gulpjs.com/">Gulp</a> &amp; co. extended the tooling around not just JavaScript and the web, but any conceivable platform.<br>(Did you know even <a href="https://www.youtube.com/watch?v=wqmMqB91zdI">Photoshop had its own scriptable node.js instance</a> built in?)</p><p>Also, what Jaxer couldn’t pull off (an embedded browser with DOM), it came almost naturally to node — first via the help of <a href="http://phantomjs.org/">PhantomJS</a>, and not long after that with <a href="https://github.com/tmpvar/jsdom">JSDOM adding JavaScript-native first-class support</a> for accessing the DOM in node.js — automated client testing for web content was reinvented in a familiar package (check out Domenic Denicola’s superb talk on <a href="http://www.thedotpost.com/2014/11/domenic-denicola-the-jsdom#autoplay">JSDOM and its motivations</a>!). Guess what, even <em>that</em> wasn’t enough, and after conquering the browser, the server and the command line — node went for an even bigger fish in the fishbowl: <em>desktop apps</em>.</p><h4>A NW era</h4><p>Thanks to the speedups of JavaScript and advances in HTML5/CSS web technology, HTML5 apps are all the rage — and most of the time they run at ample speed on a common low-to-moderately specced device. As node.js brought a myriad of API-s to access low-level (such as filesystem and networking) operating system primitives — it was only trivial to expose these primitives to a web rendering context instance — since <a href="https://github.com/nwjs/nw.js/wiki/How-node.js-is-integrated-with-chromium">both Chromium and node.js used V8 as their JavaScript engine</a>, fusing those two together was a no-brainer: this was how <a href="https://github.com/nwjs/nw.js">node-webkit (now named NW.js)</a> was born.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*RnkgrfEoLPwdQEJxhsc9aA.gif" /><figcaption><a href="https://atom.io/">Atom Editor</a>’s interface (all in its pure HTML5-glory) could match any of the contemporary native-code editors’</figcaption></figure><p>Node-webkit spurred a whole new class of desktop projects into existence, and after <a href="https://c9.io/">Cloud9 IDE</a> successfully wedded node.js and web technologies in what became a state-of-the-art Integrated Developer Environment, projects like <a href="http://brackets.io/">Brackets</a> and <a href="https://atom.io/">ATOM</a> brought the experience to the desktop (while keeping best of both worlds — cross-platform interoperability, extensibility — intact).</p><h4>Harder, Better, Faster, Stronger</h4><p>While JavaScript was becoming more and more sophisticated and powerful thanks to the work of TC39 on the ECMAScript standard, and ever- increasingly omnipresent (reaching farther than ever thanks to node.js et al.), its evolution didn’t seem to stop, or even slow down.<br>JavaScript was bound to become <em>faster</em> while devices it was powering kept shrinking<em> smaller and smaller</em>.</p><p>Okay, JavaScript — sooo…<br>Browsers? <em>Done</em>. Servers? <em>Easy!</em> Mobile? <em>Devoured! </em>Desktop? <em>Done &amp; dusted!</em> Anything else you might want to try?<br><em>Well what about IoT?</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*YmWYNPYCtakgIu5Qcc5wHg.png" /><figcaption>The JavaScript of Things (<a href="http://blogs.salleurl.edu/networking-and-internet-technologies/el-reto-de-internet-of-things/">based on the image at the blogpost by <strong>ayza</strong></a>)</figcaption></figure><h3>The JavaScript of Things</h3><p>Well, this idea of the “internet-of-things” is quite popular nowadays, one might say. Smart watches, smart lighting, smart heating, smart houses; internet-connected fridges and washing machines and electric kettles — you name it.</p><p>But these are small, limited power devices, tiny chips with tiny memories, also with tiny power supplies — such a resource-hog, power-hungry language like JavaScript shouldn’t be driving these, no?<br>Well, <strong>think again! </strong>An era of the <a href="http://slid.es/flaki/jot">JavaScript of things</a> is closer than you might imagine.</p><h4>A fiery fox to the rescue</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*8SZQDr7tP2Y3CQpnfADh9g.png" /></figure><p>A few years ago no one would have thought a low-power, cost-conscious mobile device based on web technologies would be even possible — and yet <a href="https://www.mozilla.org/en-US/firefox/os/">Firefox OS</a> has proven that it was not simply possible, but very much feasible by releasing ~15 different Firefox OS-powered devices in about ~<a href="https://blog.mozilla.org/blog/2014/12/16/firefox-os-expands-to-nearly-30-countries">30 countries</a> in the last two years.<br>All these devices are full-blown internet-capable touchscreen smartphones — selling for as low as ~$33 USD. These, and the other types of gadgetry (like <a href="https://gigaom.com/2015/01/06/first-look-this-is-panasonics-firefox-os-powered-tv/">Panasonic’s FirefoxOS-powered TVs</a>) are the proof that JavaScript and web technology are still rather far from hitting their limits.</p><p>Actually it is so far from said limits, that Samsung decided on using it on its <a href="http://slides.com/flaki/js-eating-the-world#/4/2">smartwatch platform, based on the Tizen operating system</a> — while at the same time, <a href="https://esdiscuss.org/notes/2014-04/ecma-tc39-talk-samsung.pdf">approaching Ecma International’s TC39 with the idea</a> of standardizing a mobile-conscious, even more prudent subset of the language to be used on the smallest scales of devices.</p><p>While we don’t yet know what has come out of Samsung’s proposal — embedded JavaScript is a <em>very lively </em>topic of its own. Samsung’s original TC39 pitch references <a href="https://tessel.io/">Technical Machine’s Tessel</a> and the <a href="http://www.espruino.com/">Espruino</a>, two microcontroller platforms built around JS.<br>Before we dive into the details of creating a JavaScript solution for such highly resource-constrained hardware, I would like to introduce the second law I wanted to share with you:</p><h4>“Any application that <em>can</em> be written in JavaScript, <em>will</em> eventually be written in JavaScript.”<br>— <a href="http://blog.codinghorror.com/the-principle-of-least-power/"><strong>Atwood’s Law</strong> by Jeff Atwood</a></h4><p>I won’t try to over-explain the law above (it’s pretty self-explanatory, anyway), but I will try to show it in the works in the remaining part of this article.</p><h4>Minuscule Scripts</h4><p>JavaScript at its core is an interpreted language. This means that it is run by evaluating its source code just before executing it. Of course, various optimizations could be perceived to ease and speed up JavaScript execution — one of the most basic (and also very powerful) ones is parsing the source and building an AST, an <a href="http://en.wikipedia.org/wiki/Abstract_syntax_tree">Abstract Syntax Tree</a>. An AST is a representation of the source code that’s much easily traversed by the interpreted. Source code is still not compiled to machine code in advance, but executing on the fly, thus avoiding the overhead of parsing (and re-parsing) and tokenizing the source code. This is an obvious gain without many drawbacks — that is exactly why nearly all JavaScript engines use this method. There are even some tokenizers <a href="http://esprima.org/demo/parse.html">written in JavaScript itself (like Esprima)</a> that could be used to view and even fiddle with this intermediary state. Esprima’s AST output could be used for several interesting use cases like transpiling and code-completion (a lot of node-based tools exist for JavaScript pre-processing and code transformation that are based on Esprima).</p><p>There is one small problem with this approach. Besides the initial processing requirement, memory space is required to <em>store</em> the AST so that later it could be executed. For most of the applications this should not be a limiting factor, but when we get down to as low as the sub-megabyte memory capacities of microcontrollers, this becomes a one very real restriction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*4DZCvw6PO_xGmLgYHzBhbQ.jpeg" /><figcaption>Espruino’s next generation, <a href="http://www.espruino.com/Pico">the Pico</a> — slated for release in May</figcaption></figure><h4>The Espruino</h4><p>The issue above was exactly what <a href="https://twitter.com/Espruino">Gordon Williams</a>, creator of the original Espruino faced — a tiny hackable IC consisting of a single microcontroller and 64 kilobytes(!) of memory, but still executing JavaScript. Compiling or parsing to AST form was not an option on such a low-memory device (some of the standard’s requirements have to have been glossed over, like Unicode-support because of the limited memory capacity). For that reason, code on the Espruino <a href="http://www.espruino.com/Performance">runs from the source itself, parsed and executed on the fly</a>! This, of course, comes with quite a few peculiarities that should be taken into account — like white-space affecting the speed at which the code runs on the Espruino!*</p><p>The upcoming new iteration of the Espruino, the <a href="http://www.espruino.com/Pico">Espruino Pico</a> will have a tiny bit more memory at its disposal (96KB), but even that is not that much for this issue to be adequately solved. For these reasons (code size &amp; compatibility) Espruino boards might be programmed via the familiar JavaScript language, execution remains dynamic (=interpreted on the fly), but blind spots in the engine’s standards-compliance make it unable to take advantage of a sizable part of the rich ecosystem that the language offered. Espruino’s strengths, however lie in its affordability and its potential in lowering the disconnect between hardware and software (further lowering the barrier to entry into hardware-hacking with tools like <a href="http://www.espruino.com/Web+IDE">its Web IDE</a>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*fvosrwc1imRsKTQZarqHRw.png" /><figcaption>The original Tessel (<a href="https://instagram.com/technicalhumans">via Technical Machine’s Instagram</a>)</figcaption></figure><h4>The original Tessel</h4><p>For some of these reasons stated above the great folks developing <a href="http://tessel.io/">Tessel</a> at <a href="https://twitter.com/technicalhumans">Technical Machine</a> chose a different approach. The Tessel had ample RAM (32MB) at the disposal of the JavaScript interpreter — however the Cortex M3 microcontroller that drives the whole machinery <a href="https://tessel.io/blog/102381339917/a-new-engine-for-your-tessel">has about 200KB of memory</a>, which makes it quite difficult to run any high-level JavaScript interpreter on it.<br>There was, however, one language that was <em>begging</em> to be embedded from the very beginnings: <a href="http://www.lua.org/">Lua</a>. Lua itself is a programming language that closely resembles JavaScript, so writing a compiler that <em>translated the JavaScript source to Lua</em> and <a href="https://tessel.io/blog/98257815497/how-tessel-works-the-basics">executed the translated code on the very compact Lua virtual machine </a>on the microprocessor of the device sounded like an epiphany.<br>Because of this Tessel was designed to be “node-compatible”, which meant it was able to run most of the modules straight out of npm, without much hassle (provided they didn’t have any binary dependencies — but that’s another story).</p><p>The concept above worked in some places, and failed in some others, but most of the time it got the job done — yet Tessel’s strong suit wasn’t its JavaScript compatibility or performance anyway: it was <strong>its plug-n-play nature</strong>. One could order <a href="https://tessel.io/modules">pre-manufactured extension modules</a> from the website and simply by typing the module identifier into an npm install command, they could access the additional hardware in 5 seconds via simple JavaScript call(back)s.<br>This kind of extensibility and modularity showcases the path outlined in the <a href="https://extensiblewebmanifesto.org/">Extensible Web Manifesto</a> — the basic idea “exposing low-level primitives for developers and letting them expand upon them in JavaScript code” beautifully demonstrated <a href="https://tessel.io/modules#third-party">i.e. in Tessel’s Community modules directory</a>.</p><p>Now before we march on to review Tessel’s second iteration, I think we should take a little detour back into FirefoxOS-land:</p><h4>Firefox OS’s twisted twin brother: Jan OS</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/227/1*sbK4S1zLTvkXa4c-kugZNQ.jpeg" /></figure><p>Well <a href="http://janos.io/">Jan OS</a> is a strange animal! Invented by the crazy Dutch, Frankenstein of Amsterdam <a href="https://twitter.com/janjongboom">Jan Jongboom</a> — it is neither a phone (any more), nor a microcontroller platform (yet) — but a bit of both.</p><p>Jan OS is based on Firefox OS’s open source code (it’s a fork, if you will), and focuses on the hardware and sensors. The same sensors and modules you could buy for hundreds of dollars as addons for your Tessel, here come pre-soldered to a highly compact and power-conscious IT board (that you got for a few tens of bucks, but back then they called it a <em>phone</em>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/449/1*Co3JaHGeEDECL4t7FBv1WA.jpeg" /><figcaption>All these sensors and circuitry fit on an IC-board about the size of a credit card!</figcaption></figure><p>With Firefox OS’s (dead-simple) hardware APIs are all right there, by stripping the unneeded cruft and the UI (GAIA) and security/permission mechanics (basically <em>rooting </em>the phone) you get a highly optimized, cellular-network-connected, low-power internet-of-things board. With an ample power supply you could, for example <a href="http://ee.telenor.io/about-gonzo/">stuck your contraption out in the wild and have it take and upload photos wirelessly for a <em>whole month</em></a>!</p><p>What happens here is that you are basically running a slim, mobile-optimized Linux kernel (Firefox OS’s kernel, Gonk is <a href="https://source.android.com/source/building-kernels.html">based on the AOSP kernel</a>), with Mozilla’s Gecko engine (including the SpiderMonkey JavaScript engine it comes with — with all optimizations, bells-n-whistles you would get on the mobile or desktop browser —<em> hellooooh, Jaxer!</em>), but with the addition of <a href="https://developer.mozilla.org/en-US/docs/Web/API">WebAPIs</a> for accessing the mobile chipset, wifi, FM radio(!), sending SMS text messages, initiating calls or capturing gyroscope data!</p><h3>Jan Jongboom on Twitter</h3><p>Weight scale using #FirefoxOS. Crazy stuff during IoT workshop in Hungary. pic.twitter.com/Mlgqq7Xejs</p><p>Might I add, there is even support (in both Firefox OS and Jan OS) <a href="http://janos.io/device-list.html">for the Raspberry Pi</a>? That said, it should soon be fairly apparent why I chose to introduce Jan OS right before we talked about the Tessel 2.</p><h4>Tessel 2 — hardcore prototyping</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*rCgFqkY4XxvCfUbtTIf2UQ.jpeg" /><figcaption><a href="https://instagram.com/technicalhumans">Two Tessels connected to the USB ports of a Tessel 2</a></figcaption></figure><p>The <a href="https://forums.tessel.io/t/introducing-tessel-2/1571">second iteration of Tessel</a> positions itself on the sweet spot of all those hardware mentioned above: It is nearly as powerful as the Raspberry Pi, it is much cheaper than the original Tessel was (less than half the price!), it is just as modular and extensible as the first one was (heck, it even got better with the inclusion of <em>two standard USB ports</em>!) — and last but not least, runs a tiny Linux kernel and <a href="http://iojs.org/">io.js</a>, <a href="https://forums.tessel.io/t/introducing-tessel-2/1571">leveraging the full power, speed and ecosystem node/io.js has to offer</a>, while doing away with compatibility issues once and for all!<br>Well that’s already nice — but the best thing is yet to come — you could use the Tessel 2 to <em>prototype</em> your product, and also to bring it to market — because if you wanted, you could order a bunch of pre-fabricated Tessel 2-s, with integrated module boards and <a href="https://tessel.io/#scale">put them<em> right into your final product</em></a>!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*Qp6jpEN9rXwJKHT-BgAH1g.png" /><figcaption>The “Fractal” concept <a href="https://github.com/technicalmachine/fractal-docs">from the docs</a></figcaption></figure><p>Technical Machines’ <a href="https://tessel.io/blog/101109458547/what-comes-next-fractal">“Fractal” concept</a> makes the scenario above even more tempting — taking modularity and prototyping to a whole new level, by using seamless interactions between JavaScript-driven and performance-sensitive close-to-the-metal compiled modules.</p><p>Performance-sensitive you say? Close to the metal? Let’s dive a bit further into the wizards’ den, look into what JavaScript’s future has to offer…</p><h3>Way ahead of its time:<br>JavaScript Droids from the Future</h3><p><a href="http://acko.net/blog/on-asmjs/">ASM.js</a> is not a new technology. Well — it’s not really even a technology, but rather a <a href="http://mozakai.blogspot.se/2013/06/what-asmjs-is-and-what-asmjs-isnt.html">bunch of iterative optimizations</a> that in the end just happened to be easily optimized and <em>simply running really fast — </em>it is more like a kind of <em>guided evolution</em>, if you wish. Already mentioned before some optimizations (like the AST) which help JavaScript performance-wise. The AST is used to speed up the interpreter and make runtime execution speedier — but nobody said that this is the <em>only </em>way JavaScript could be executed.<br>The keyword here is: <em>compilation</em>.</p><p><a href="http://en.wikipedia.org/wiki/Just-in-time_compilation">Just-in-time (JIT) compilers</a> have been widely known and used since the earliest days of interpreted languages — and JavaScript is no different (however, for dynamically typed languages like JavaScript, JIT-ting does have its fare share of quirks and pitfalls).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*H1AO8UHh1PS5luILjPfx4w.png" /><figcaption>Structure of SpiderMonkey’s JIT in Firefox (<a href="https://blog.mozilla.org/luke/2014/01/14/asm-js-aot-compilation-and-startup-performance/">via Luke Wagner</a>)</figcaption></figure><p>Optimizing hot code (like long loops or frequently called functions), by compiling it to <em>directly executable machine code instructions</em> could result in sizable gains in execution performance. What ASM.js tries to achieve is to make AOT (ahead of time) compilation of swaths of JS source possible by defining an intermediary <a href="http://asmjs.org/spec/latest/">JavaScript subset-syntax</a> that makes it possible to compile the JavaScript source, well before execution. Compilation generates type-safe, readily executable machine code with predictable performance by eliminating managed memory and garbage collection <em>altogether</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UED_irKP00NVYwmu01n5gA.jpeg" /><figcaption>Also coming to JavaScript — support for native <a href="http://en.wikipedia.org/wiki/SIMD">SIMD</a> instructions (<a href="https://01.org/blogs/tlcounts/2014/bringing-simd-javascript">image via Intel OpenSource blog</a>)</figcaption></figure><p>There is also a second, no less important goal to ASM.js — establishing JavaScript as a fast <em>target-language</em>. Compile-to-JS tools, like <a href="https://github.com/kripken/emscripten">Emscripten</a> or <a href="http://www.gwtproject.org/">GWT</a> have existed for quite some time before ASM.js, and as the habit of compiling low-level languages into JavaScript persisted, engines started optimizing for the kind of source code these compilers emitted. ASM.js is the natural continuation (I am trying hard not to overuse the word “evolution” as you might notice…) of this effort, by defining a common “language” (a standard syntax format) that makes the output of these tools comparable, more easily optimizable and <a href="http://mozakai.blogspot.hu/2014/06/looking-through-emscripten-output.html">perhaps a bit more readable (not that anyone would want to do that to themselves, anyway)</a>.</p><h4>Look Ma’ — a time machine!</h4><p>The results? Well, certainly awe-inducing — whether one talks about the thousands of MS-DOS games running nothing but a browser, thanks to <a href="https://archive.org/details/softwarelibrary_msdos_games">archive.org’s collected library</a>, or the wonders of 3D graphics that contemporary tools with built-in HTML5 (WebGL/JavaScript/ASM.js) output produce (like the <a href="https://blog.mozilla.org/blog/2015/02/24/unreal-engine-4-7-binary-release-includes-html5-export-3/">Unreal engine</a> or Unity):</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F2v6iLpY7j5M%3Ffeature%3Doembed&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D2v6iLpY7j5M&amp;image=http%3A%2F%2Fi.ytimg.com%2Fvi%2F2v6iLpY7j5M%2Fhqdefault.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c4f85e01b9f464f5eedde964639c3718/href">https://medium.com/media/c4f85e01b9f464f5eedde964639c3718/href</a></iframe><p>With <a href="https://hacks.mozilla.org/2015/03/asm-speedups-everywhere/">browser support expanding</a>, these wonders are reaching more and more users on the web every day, bringing high-performance <a href="https://www.facebook.com/cloudraidersgame">games</a> and <a href="http://jlongster.com/s/lljs-cloth/">even physics simulation</a> into browsers and to the open web.<br>However, speed is not the only concern. Sometimes size (see above, for the Espruino) is just as important (if not more important).<br>That is where our tiny script engines make an appearance.</p><h3>TinyScript — the Davids to your<br>JavaScript Goliaths</h3><p>Mentioned earlier, Lua has been readily and frequently used embedded in other software products to provide extensibility/scripting to its host software. This was partly due to its simplicity and extensibility, but also due to its small code &amp; memory footprint.</p><p>Unfortunately for JavaScript (while being equally simple, quite extensible and certainly well-known) — size has been always an issue for its runtimes so it didn’t achieve widespread adoption… yet. Based on our learnings and assumptions of the Espruino engine, we would feel compelled to say that “a fast and standards-compliant JavaScript interpreter just cannot be squeezed into such a small footprint these applications would require” — but again, we would be wrong.</p><p>Fast-forward to 2015, enter <a href="http://mujs.com/docs/about">muJS</a> and <a href="http://duktape.org/">Duktape</a> — two tiny JavaScript interpreters built for just those purposes mentioned above! Clocking in at ~200KB compiled size, they are light-weight and easily embeddable in any product (or microcontroller, for that matter!): the Duktape engine could be slipped onto a small embedded system with 256KB of flash storage and as low as 96KB of RAM and would hum along nicely!<br>(Espruino’s <em>(even Pico’s)</em> hardware, on the other hand, would still prove too slim even for these tiny runtimes.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*M9vujq-Dqzqu1cJgD8Q_Rg.jpeg" /><figcaption>The Atomic Game Engine uses Duktape for embedded scripting</figcaption></figure><p>Sporting ECMAScript standard compliance and all the bells-and-whistles expected of a modern JS-engine (garbage collector, unicode support, RegEx engine — you name it) these tiny powerhouses are no small feat of engineering. In spite of these being fairly new projects, some has already started incorporating them in their projects: Game engines, for example have frequented Lua for a long time catering for their in-game scripting needs — the <a href="http://atomicgameengine.com/">new Atomic Game Engine</a> on the other hand uses Duktape.</p><p>Duktape has also approached the bare metal in projects like the <a href="https://wiki.allseenalliance.org/_media/training/programming_alljoyn.js.pdf">IoT framework “AllJoyn.js”</a>, while Tilmann Scheller at Samsung evaluated the fitness of the engine for general use in embedded systems (<a href="http://www.slideshare.net/seoyounghwang77/js-onmicrocontrollers">with very promising results</a>).</p><h3>Takeways?</h3><p>That concludes our journey up to JavaScript’s present and current directions — but what about the future, what does the future hold? It would be hard to guess, the landscape changes every second.</p><p>One thing seems pretty clear, though: JavaScript is not going away anytime soon — so one might as well learn a thing or two about it. <em>Just in case</em>.</p><h4>Actually…</h4><p>There is indeed one more thing. Seeing people on all over the web chanting the old slogan (even those who actually read the article above):</p><p><em>“Well JavaScript is still butt ugly &amp; unusable,<br>it is a disgrace of a language and will surely remain so!”</em></p><p>To those people: <strong>not to worry</strong>, give it a few years and <strong>JavaScript is destined to be practically extinct</strong> — dead as a dodo!<br><em>Whaaat?!<br></em>After all this preaching why on Earth would anyone say that? The prologue itself literally says that “JavaScript is not going away anytime soon” — what about that? It might seem, that I am contradicting myself — I am truly sorry, but you will have to watch <a href="https://twitter.com/garybernhardt">Gary Bernhardt</a>’s prophetic talk to find out what is going on:</p><p><a href="https://www.destroyallsoftware.com/talks/the-birth-and-death-of-javascript"><strong><em>The Birth and Death of JavaScript</em></strong></a></p><p><em>Hint: Steven Wittens’ previously linked article on ASM.js also has some pointers.</em></p><p><em>* in fact V8&#39;s “Crankshaft” optimizing compiler has similar peculiarities that arise from code size because it chooses to </em><a href="http://floitsch.blogspot.hu/2012/03/optimizing-for-v8-inlining.html"><em>inline functions based on their text-size</em></a><em> (and that includes white-space and comments, too!).<br>To learn more about this, </em><a href="http://www.thedotpost.com/2014/11/joe-mccann-tuning-node"><em>check out Joe McCann’s talk from dotJS 2014</em></a><em>!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af9ca2ee5070" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introducing the JavaScript of Things]]></title>
            <link>https://medium.com/@slsoftworks/introducing-the-javasscript-of-things-e0933d2767b9?source=rss-d7cb583a6faa------2</link>
            <guid isPermaLink="false">https://medium.com/p/e0933d2767b9</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[firefox-os]]></category>
            <dc:creator><![CDATA[Flaki]]></dc:creator>
            <pubDate>Fri, 13 Mar 2015 18:02:29 GMT</pubDate>
            <atom:updated>2015-03-14T10:12:39.682Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kgbMQXukzbgy65IT_pPs-w.jpeg" /></figure><h3>Introducing the JavaScript-of-Things</h3><blockquote>Internet-of-things festival, embedded-hardware JavaScript hackery and mobile HTML5 WebAPI magic — a weekend with Mozilla and Jan Jongboom in Budapest.</blockquote><p>When Firefox OS didn’t take off in Hungary as many of us hoped— two years after the official launch the open source mobile platform remains an ghost among the consumers — we, mozillians in Hungary tried to find new directions to make an impact on the Open Web, on a local scale. As consumer (and operator) interest faded — to our wonder, <em>developer interest</em> seemed not to falter, but instead <em>kept rising slowly, but steadily</em>.<br>This should not have been that surprising, as Firefox OS is basically (<em>a supercharged, yes</em>) version of the Web at its core — but that gave us an idea.<br>Talks have started about an event on Firefox OS hacking as early as last December with Firefox OS evangelist at Telenor Digital, <a href="http://janjongboom.com/">Jan Jongboom</a>. Telenor Digital folks have already joined us in spreading the Firefox OS love on several occasions before — and Jan was eager to come back to Budapest for some time, too. Also, it was Jan who came up with (and put together) one of the most exciting projects in the current Firefox OS landscape: <a href="http://janos.io/">Jan OS</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*q7x01g-N9_kczF7u8xe3zA.jpeg" /><figcaption>Jan first presenting the idea of JanOS in his <a href="http://2014.jsconf.eu/speakers/jan-jongboom-abusing-phones-to-make-the-internet-of-things.html">talk at JSConf.EU 2014</a></figcaption></figure><p>Jan OS is a stripped-down, utilitarian version of Firefox OS — with all the API-s and Open Web magic still there, but without the glamorous facade of <a href="https://developer.mozilla.org/en-US/Firefox_OS/Platform/Gaia">GAIA</a> to cover up the system’s complexities. <em>A platform made for hacking.</em></p><p>The talks have succeeded, and we got both Mozilla and Jan on board, so we have started planning this whole weekend-worth of <a href="http://itcafe.hu/hir/mozilla_firefox_os_jongboom_meetup_workshop.html">Firefox OS-related developer festivity <em>(linked article in Hungarian)</em></a>.</p><h4>Meetup day — Thursday, February 26.</h4><p>Jan landed safely in Budapest on the murky Thursday afternoon of 26th February, barely spending two minutes in the hotel dropping off his stuff and hurrying over to the POSSIBLE Budapest head­quarters to give his presentation at the POSSIBLE + Mozilla + Innovation &amp; Interaction <a href="http://www.meetup.com/Innovation-Interaction/events/220140076/">“Gadgets and browsers together” meetup</a>.</p><p>The meetup went quite well—even in spite of the terrible weather, 50+ participants managed to find the POSSIBLE HQ (with few more people following the online stream). After a short delay while we worked trying to overcome the initial hurdles of hardware setup and hooking up Jan’s Raspberry Pi to a local big-screen, Adrienn Zádori (<em>POSSIBLE Budapest Host and Innovation &amp; Interaction meetup organizer</em>) opened the evening, and the meetup was live!</p><p><a href="https://instagram.com/slsoftworks/p/zkyBXVPRQo/">Adrienn Zádori of @@PossibleCEE &amp; I&amp;I #meetup setting off Gadgets &amp; Browsers!!</a></p><p><a href="https://twitter.com/slsoftworks/status/571020225673609216/">Jan started the lineup of speakers</a> with a mindbending (or, quoting Adrienn: <em>psychedelic</em>!) presentation on Firefox OS principles and Jan OS basics. Curious meetuppers got a great introduction into the philosophy that brought the Open Web APIs to life, and were presented how to tap into these possibilities — using either Firefox OS, Jan OS or a standard issue (supporting) browser (be it on mobile, desktop or anywhere else).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/338/1*NomNCzFjtF-LsAriYVn-Lg.png" /><figcaption>The tiny microcontroller that supports JanOS (originally a Geeksphone PEAK Firefox OS phone)</figcaption></figure><p>He didn’t just talk about these things, but have shown all these too. Pranked by the Demo Gods™ a few times — but eventually managing to connect to a Jan OS-driven Raspberry Pi, we have been presented a sneak peek into how Firefox OS could power future’s (and today’s) microcontrollers and IoT hardware — thus creating the <a href="http://slides.com/flaki/jot">JoT (JavaScript-of-things)</a> in the process.<br>Connected to the same network and using the Firefox OS developer tools it wasn’t too hard then to access Jan OS remotely and control the hardware and LEDs wired up to the Raspberry Pi with simple JavaScript commands — from across the room.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FDRclviot29tFjEKYzLS8A.jpeg" /><figcaption><a href="https://www.flickr.com/photos/slsoftworks/16564260178/in/set-72157648900260134">Jan Jongboom showing off the Jan OS-powered Raspberry Pi</a></figcaption></figure><p>After Jan put the “fun” back into the “funspace” at POSSIBLE — a more serious talk followed by <a href="https://twitter.com/csertanakos">Ákos Csertán</a>. Ákos is one of the organizers of Innovation &amp; Interaction meetup (and a former POSSIBLE alumn), currently working at BalaBit IT Security — and gave a pretty eye-opening talk <a href="http://www.slideshare.net/csertanakos/the-insecurity-of-things">on the (in)security of today’s much hyped IoT and wearable devices</a>.</p><h3>Flaki on Twitter</h3><p>Follow @csertanakos &amp; other great presentations of Gadgets &amp; Browsers #meetup live at https://www.youtube.com/watch?v=wkLKoPUSx1E ... #fxoshu pic.twitter.com/56SIVIPDJe</p><p>In the break preceding the second part of the talks people were flocking around the presenters (and cleaning up the last crumbs of pizzas) — the magical, Raspberry Pi-and-open-web-tech-driven TV screen has once again attracted a fair bit of enthusiasm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GTADjhViaTbVMHsbdNMsMA.jpeg" /><figcaption>Jan OS running on the Raspberry Pi put to a test once again during the break</figcaption></figure><p>Right after all pizza was reduced to empty cardboard boxes, all questions asked and all LEDs blinked, commenced the second part of the talks with <a href="http://cee.possible.com/news/2015/02/gadgets_and_browsers">Csaba Csecskedi and Attila Lőrincz of the POSSIBLE fame leading up the pack</a> with a presentation on the ups and downs of developing for Samsung’s Tizen-based wearables/smartwatch platform. They even let us in to the creation process of <a href="http://cee.possible.com/works/aktif/aktif">POSSIBLE’s AKTIF! watchface app</a> developed for the Galaxy Gear smartwatch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HXvWyEJWip5-Moue70U28Q.jpeg" /><figcaption>Attila Lőrincz talking about the AKTIF! watchface app</figcaption></figure><p>Wrapping up the meetup-evening, the POSSIBLE UID team prepared three entertaining experimental lightning talks from the niches of the bleeding edge of web technology and JavaScript-hardware interactions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*XHmdCqmFq3t3eSj53k1YJA.jpeg" /></figure><p>First up, <a href="https://twitter.com/bogy0">Bálint Lendvai</a> presented his experiences on using the <a href="http://slides.com/bogy0/leap-motion-controlled-js-app">LEAPMotion controller hooked up to a WebAPI library and exercising gesture control</a>. Via a simple, proof-of-concept rock-paper-scissor game, we were introduced to the probably limitless possibilities of accessing simple but powerful APIs from inside JavaScript and web source code.</p><p>In the next lightning talk <a href="https://twitter.com/hozeee">József Szabadszállási</a> started mixing hardware sensor access with high resolution panoramic video graphics. Combining the device orientation extracted from the gyroscope of supporting devices with a special kind of 360° footage and some WebGL magic, what emerged is a window to another dimension — <a href="http://slides.com/szabadszallasijozsef/panorama-wegbl">a viewport to a lively, animated three-dimensional world showing through the tablet screen</a>.</p><h3>Flaki on Twitter</h3><p>Very nice boatz! - The @PossibleCEE UID team in action: experimental #js demo by @pety7439 @Hozeee &amp; @bogy0! #fxoshu pic.twitter.com/8kdR3SUwNY</p><p>Last but not least <a href="https://twitter.com/pety7439">Péter Schmíz</a>, head of POSSIBLE UID presented his <a href="http://slides.com/schmizpeter/kinect-v2-in-browser">journey around the Kinect 2 sensor data</a> — and experiments in putting that extracted raw sensory data into good use.<br>The presentation soon turned into a wicked fun of comical hilarity, as POSSIBLE Games’ latest game, <a href="http://www.pocoecogame.com/">Adventures of Poco Eco’s titular character</a> showed up on the projector screen: attendees (and even Jan) has gone nuts and bananas over the quickly hacked-together motion tracking app, as it transplanted their postures in real time onto the tiny Poco-s fooling around on the projected live canvas!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BAyXCwJhMBwFDnIJdsr88g.jpeg" /><figcaption>Jan Jongboom and István Makáry frolicking in front of the Kinect 2 sensor rigged to models of Poco Eco by Péter Schmíz</figcaption></figure><p>The lightning talks have succeeded in revitalizing the attendees to a point when — despite the late hour — really good conversations popped up and went on well after the talks were over. A few of the folks have even had the energy to continue these conversations at a nearby pub after leaving the POSSIBLE office, and some of them have returned for the Saturday workshop, too. It was a great night!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*pLXf4nfyiaAQ18M-EMZD6A.jpeg" /></figure><p>It’s also worth mentioning that the meetup was followed on the air — thanks to the live YouTube feed — by quite a few curious folks, too, who couldn’t manage to attend in person (due to weather or other constraints). Thanks go out to them, too — thank you for joining us!</p><p><a href="https://www.facebook.com/media/set/?set=a.958515564173713.1073741851.206631892695421&amp;type=1">More pictures of the meetup evening can be found in this Facebook-album</a>.</p><p><em>All talks were in English and recorded, see slides linked above for each — and recorded videos os talks coming soon, so stay tuned!</em></p><h4>Workshop day — Saturday, February 28.</h4><p>After wrapping up the meetup there was still a great deal of hacking waiting for anyone interested in Firefox OS and Open Web APIs running on tiny hardware: <strong>at Saturday’s JanOS Workshop</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QKhMHUhHW3E4S3jKLDED6w.jpeg" /><figcaption>Jan arriving to the workshop at EPAM</figcaption></figure><p>Thanks to Telenor we had Jan to MC his way through a whole day of Firefox/Jan OS hacking. No less thanks to Mozilla, we had Firefox OS hardware we could give to participants an a few pizzas (and a later dinner) to keep their brains supplied with sufficient amount of nutrients while they hacked their way through the day. Finally — last but not least, thanks to the much welcome help of <a href="http://www.meetup.com/Frontend-Meetup-Budapest/">Budapest Frontend Meetup folks</a> — we had actual participants and a place to take them on Saturday: with EPAM supplying us their awesome hackspace. EPAM turned out to be an excellent host, they prepared the venue for our arrival, marked up the directions for the participants, and — in spite of the occasional wi-fi issues — we are bound to return there for future events.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*13P7oaKo_IFbgzq6sCPdPQ.jpeg" /><figcaption>New home for the Foxmachine — Mozilla Reps swag thanks to the awesome Brian King</figcaption></figure><p>The workshop started with the organizers (Mozilla, Frontend Meetup &amp; EPAM folks) gathering in the EPAM tutorspace early in the morning. Kálmán Szalai (KAMI) — returning from the distant <a href="https://www.facebook.com/media/set/?set=a.10152614122681479.1073741915.372155461478&amp;type=1">Lendava Webmaker workshop in Slovenia</a> — came bearing gifts: thanks to Mozilla and Brian King we were ready to start the day in <em>all-firefoxy-glory</em>!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*hrFb2oPZZ29-axCPuXfhSw.jpeg" /><figcaption>Anikó Fejes (Budapest Frontend Meetup) prepared her foxiest self for the workshop</figcaption></figure><p>After all was set up and the participants started arriving, Jan gave an introductory talk on Firefox OS / JanOS, coupling this with a few quick one-liners coded live and e.g. sending SMS messages from a JanOS-flashed GeeksPhone board as quick demonstration of the power of WebAPIs.</p><h3>Flaki on Twitter</h3><p>In ~20 lines of code @janjongboom uses #FitefoxOS &amp; janos.io to &quot;sudo make me a sandwich&quot; over SMS! #fxoshu pic.twitter.com/WxDIeVHjJl</p><p>After Jan’s primer, the participants got their own phones to hack on, flashed the latest version of Firefox OS (or JanOS) on them and began hacking. We had a brainstorming session where interested participants could share the idea they were going to work on for the rest of the day so others could get inspiration or join them building it.<br>Jan and I were helping the workshop folks getting started (also Balázs Úr brought a lot of his students from web development class, and was helping out a lot during the day), while other Mozillians (Kami, Lívia) made sure everything went smoothly during the day.<br>After dinner, arriving into the final stretch we were helping the most adamant Firefox OS-hackers finishing and presenting their ideas — late in the afternoon we had at least 10 different ideas working (to some extent) and demoed on stage.</p><p>Among these ideas were quite a few JanOS-based works (without the claim of completeness): a <a href="https://twitter.com/slsoftworks/status/571693045495824384">presenter helper with gyroscope support</a> for laser-pointer replacement (by Bence Golda), a geofencing-based grocery shopping-list (by Kovács Dániel Dávid) or <a href="https://twitter.com/kowww/status/572069391766061057">generative music using audio sensor data</a> (by Tibor Szász).</p><p>One particular JanOS idea even went viral on Twitter — the accelerometer-based Firefox OS/JanOS weight scale must have stuck a nerve, because it spread like forest fires right after Jan tweeted about it!</p><h3>Jan Jongboom on Twitter</h3><p>Weight scale using #FirefoxOS. Crazy stuff during IoT workshop in Hungary. pic.twitter.com/Mlgqq7Xejs</p><p>There were several other ideas, different implementations for Morse-transceivers and even a bicycle courier dispatch webapp! The authors of the ten most promising/unique/well-executed ideas received a Firefox OS device to elaborate/hack on their ideas further and results are to be followed up on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*B5GylMAsVTQGctWRvB-dWw.jpeg" /><figcaption><a href="http://jsconfbp.com/">JSConf Budapest</a> ticket prize and coupon</figcaption></figure><p>Also, as an additional prize — thanks to the <a href="http://jsconfbp.com/">great cool folks over at JSConf Budapest</a> — we had the chance to give away one JSConf Budapest ticket for a participant deemed most worthy of the prize for his activity and results at the end of the workshop. After quick discussion, we were proud to announce <a href="https://twitter.com/bencegolda">Bence Golda</a> as the winner of the JSConf ticket prize for his idea and super quick prototyping of the JanOS presenter he dreamed up!</p><h3>Frontend Meetup on Twitter</h3><p>congrats @bencegolda for winning a @jsconfbp ticket at last weekend&#39;s IoT workshop with your gyro-pointer! #fxoshu pic.twitter.com/Q3TRrl1J9P</p><p>After the troubles and a whole-day of hacking at the workshop, the top hackers were invited to have a dinner with the workshop organizers/Mozillians (thanks to Mozilla!), and to chill and discuss the day’s takeaways next to a glass of lemonade/pint of beer! Some of the most fearless also accompanied us for a tour of Budapest Saturday nightlife with Jan — but well, that’s another story altogether…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7b-XddDUfhidcF7p29Ut1A.jpeg" /><figcaption>Mozillian after-workshop dinner at Kompót Bisztró</figcaption></figure><p>All in all, the weekend turned out to be a great success! We never imagined such cool ideas would pop up on the workshop, and this many people would be interested in JanOS/hardware hacking via Open Web tech. The events certainly managed to revitalize the Firefox OS developer community — and hopefully, after following up on the workshop projects, will keep doing so in the coming months, too.</p><p>More pictures of both days <a href="https://www.flickr.com/photos/slsoftworks/16751354231/in/album-72157648900260134/">are uploaded here</a>. Even more pictures of the <a href="https://www.flickr.com/photos/101286233@N04/sets/72157651292955441/">meetup</a> and the <a href="https://www.flickr.com/photos/101286233@N04/sets/72157650886878820/">workshop</a> day can be found on Mozilla Hungary Flickr.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e0933d2767b9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting sail for Frostfell]]></title>
            <link>https://medium.com/@slsoftworks/setting-sail-for-frostfell-cfba6edc30cf?source=rss-d7cb583a6faa------2</link>
            <guid isPermaLink="false">https://medium.com/p/cfba6edc30cf</guid>
            <dc:creator><![CDATA[Flaki]]></dc:creator>
            <pubDate>Fri, 06 Mar 2015 15:22:45 GMT</pubDate>
            <atom:updated>2015-03-06T15:32:17.971Z</atom:updated>
            <content:encoded><![CDATA[<p>After an intense slightly less than one-and-a-half year, I am leaving the wolfpack of <a href="http://cee.possible.com/">POSSIBLE</a>’s incredible UID folks.</p><p>It wasn’t an easy decision from either side, but it became sadly apparent, that I was getting increasingly less able to commit myself to the job as my other engagements towered above my head. My <a href="https://wiki.mozilla.org/User:Flaki">contributions to Mozilla</a>, my <a href="http://slid.es/flaki">meetup talks</a> and visits, conference attendence — all these were eating away my time in such a pace that was making it ever increasingly difficult for me to supply my body with the amount of sleep that is generally considered sufficient for continued support of a human metabolism.</p><p>Well after churning out that break-neck sentence:<br>What now — what’s next? <em>Good question!<br></em>Certainly in the lookout for opportunities — hopefully ones that can more easily accomodate my open-source/Mozilla commitments and need for personal development &amp; Open Web evangelism efforts. Friends and folks, hit me up with anything you might think would suit me!</p><h4>One thing is for sure — going to sleep through the whole of March, I can assure you of that!</h4><p><a href="http://cheesepirate.com/forums/viewtopic.php?f=6&amp;t=230&amp;p=1227#p1226"><em>Background image courtesy of the lovely Vanja Utne</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cfba6edc30cf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why should one keep an eye out for Servo]]></title>
            <link>https://medium.com/@slsoftworks/why-should-one-keep-an-eye-out-for-servo-6d53eb6f64ff?source=rss-d7cb583a6faa------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d53eb6f64ff</guid>
            <dc:creator><![CDATA[Flaki]]></dc:creator>
            <pubDate>Mon, 01 Dec 2014 21:48:40 GMT</pubDate>
            <atom:updated>2014-12-06T08:13:28.647Z</atom:updated>
            <content:encoded><![CDATA[<h3>(and just why are we not there yet)</h3><h4>For those late to the party — what is Servo?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*k_vsfbPPDbv5haRTX-90RQ.jpeg" /></figure><p>Well, if you have never heard of Servo — Servo is a brand new open-source browser engine, built from the ground up by Mozilla and Samsung (and a host of third-party open source contributors). Browser engines are the “soul” of a browser — the “Gecko” engine in Firefox (OS), “Blink” in Chrome/Opera etc. is what makes the web <em>tick</em>. Servo is completely open source, highly parallelized and is written in a new programming language, called <a href="http://www.rust-lang.org/">Rust</a>.</p><p>Currently, the most comprehensive source of Servo-related information is the <a href="https://github.com/servo/servo/">Servo GitHub repository</a>, more specifically the <a href="https://github.com/servo/servo/wiki/">Servo Wiki</a>. For a quick introduction, you might want to watch the talk below by Lars Bergstrom, researcher at Mozilla Research:</p><p><a href="https://air.mozilla.org/an-introduction-to-servo-2/video/">An Introduction to Servo</a></p><p>Lately, leading up to the release of <a href="https://www.mozilla.org/en-US/firefox/developer/">Firefox Developer Edition</a>, one could have caught quite a few people wondering, whether “the new browser” would include a “new browser engine”, too. Some of these musings were just plain silliness — like the ones writing off Mozilla as a “douchebag” as now they would “have to support a new browser engine” — but some were a bit better-informed, envisioning the inclusion of Servo in the new Firefox browser. Should they knew more about Servo, these rumors wouldn’t have spread in the first place — and since information is out there in the open, I decided to do a writeup on the state of Servo.</p><p>Firefox Developer Edition had since gone live — and surprise-surprise, it didn’t include any new browser engine! Servo is currently a <em>research project</em> at Mozilla — and while yes, browser engines are the salt-and-pepper at Mozilla, so they definitely want to use it in production as it matures, it’s <em>just not there yet</em>. The above (and much more!) is discussed in the two-hour marathonic meetup session on Rust &amp; Servo below, should this whetted your appetite to dive into Servo and browser-engine internals:</p><p><a href="https://air.mozilla.org/bay-area-rust-meetup-november-2014/video/">Bay Area Rust Meetup November 2014</a></p><p>Now that we cleared all that up, let’s dive into exactly <em>what</em> is preventing Servo of being included in a real browser — and when can we expect that happening!</p><h4>The first issue — Rust is still in its infancy</h4><p>For people not familiar with Rust — it is a low-level, systems-programming language (somewhat close to the level of C/C++), that is theoretically memory safe, includes countermeasures to a host of memory-related crashes and is built from the ground-up with parallelization in mind.</p><p>I’m saying “theoretically”, because (and this is one of the reasons why Servo is still experimental), because Rust <em>itself</em> is pretty much in its infancy. While it is approaching version 1.0 fast, the language has not yet matured/stabilized enough to provide a reliable base for consumer-grade software (let alone a whole browser(engine)). A disclaimer at the Rust website itself suggests (half?)jokingly, that</p><blockquote>[Rust] may do anything it likes up to and including eating your laundry.</blockquote><p>So why use Rust at all, then? Well, first: Rust is <em>awesome</em>! This new programming language — besides incorporating the learnings from decades of programming language design experience — is actually shaping alongside the development of Servo, the two existing and evolving in a kind-of-symbiotic relationship. If you are coming from a well-founded systems programming background, you might be interested in <a href="https://gist.github.com/rbranson/03d88e3733c6ee098a89">this writeup by Rick Branson</a> where he explains why he has such high hopes for the language, talking about the fores and vices of Rust compared to other similar-level languages including C, C++, Java &amp; C#.</p><h4>Next: while Servo is very promising, it is still missing a <em>lot</em> of key features</h4><p>Due to its high level of parallelization and the code that is rewritten from scratch with years of browser engine experience to back it up, Servo is <em>fast</em>. It is (in its current, unrefined state) sometimes up to twice as fast as Gecko. Rendering &amp; feature benchmarks are tricky, though — as comparing Gecko and Servo is currently a bit “apples-to-oranges”. This is due to the fact that Gecko <em>does much more</em>. Gecko implements the complete feature stack of a modern browser — that includes laying out tables, floats, rendering gradients etc. What Servo <em>can’t do —</em> will fail instantly, thus being able to lay out and render pages faster, but with features missing.<br>That said, there <em>are</em>, though, some benchmarks and web pages that already work just fine, utilizing a subset of features — and those look quite promising:</p><h3>Patrick Walton on Twitter: &quot;A page some of you may know rendered in my branch of Servo: http://t.co/yPxiJANz1O&quot;</h3><p>A page some of you may know rendered in my branch of Servo: http://i.imgur.com/Ld4ESkj.png</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l0ZdeJOWWaim2prOHQyq2w.png" /><figcaption>Google’s fallback HTML4 homepage, rendered in a recent buid of Servo</figcaption></figure><p>Servo currently implements a brand-new HTML5-parser called <a href="https://github.com/servo/html5ever">html5ever</a>, and does layout &amp; rendering on a level of a late 2006–2007 web standards-compilant browser, passing the ACID2 test this spring:</p><h3>Ahmed on Twitter: &quot;Never thought an Acid cake would look so delicious (Celebrating Servo passing ACID 2) http://t.co/WuFavILVS2&quot;</h3><p>Never thought an Acid cake would look so delicious (Celebrating Servo passing ACID 2) pic.twitter.com/WuFavILVS2</p><p>Of course, there are a lot of things missing yet, but improvements and features are pouring constantly into the engine — for example Servo is currently one of the first engines to support native rendering of vertical texts, and CSS3 Linear Gradients has just landed this month, inching closer and closer to feature-parity with the “big guns”.</p><h4>Mobile is just not there (yet)</h4><p>Parallelizing tasks during web page layout &amp; rendering is gaining importance as chipsets (and graphics controllers) abandon the pursuit of ever-increasing clock speeds in favor of packing more and more cores onto the circuit board. This is especially true for handheld/mobile platforms like ARM. Unfortunately — and this is another catch — current development targets desktop, rather then mobile, resulting in a (for now) subpar ARM performance, and in Gecko on mobile/ARM currently outperforming Servo.<br>Regardless, on the long run, of course the goal is to have Servo bring comparable advantages to the mobile platform as the ones it brings to the desktop — in fact, an alpha release for Android is already in the pipeline, planned for early 2015!</p><h3>Patrick Walton on Twitter</h3><p>This... is CNN. (In Servo.) http://i.imgur.com/6PJQAfW.jpg</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k-pe67VFFdiQWRK8JocZDA.jpeg" /><figcaption>CNN in Servo <a href="http://imgur.com/6PJQAfW?tags">http://imgur.com/6PJQAfW?tags</a></figcaption></figure><p>Another feature of Servo, is that it does <em>a lot of things </em>off the main thread — is the only browser currently that does Layout off the main thread — resulting in great improvements in parallelization, also off-main thread compositing which results in iframes in separate threads.<br>If you didn’t understand a single word of the above tech-babble, it basically means multiple cores on your device (be it processing or graphics cores) are better utilized, due to the high rate of <em>fine-grained parallelism </em>the whole system is built around. Also moving stuff off-main thread helps a lot with the pan/zoom/scroll experience — it results in a much smoother user experience (even when a lot of computation, DOM manipulation is happening in the background). This prevents a lot of “jank” (choppiness) of the general browser user interface.</p><h4>So when will I be able use Servo then?</h4><p>Servo is coming along nicely — if you want to know more about its future, I recommend you check out the <a href="https://github.com/servo/servo/wiki/Roadmap">Roadmap on the Servo Wiki</a>. If you want to follow more closely, there are quite a few great fellows at <a href="https://www.mozilla.org/en-US/research/">Mozilla Research</a>, working on Servo — including, but surely not limited to <a href="https://twitter.com/pcwalton">Patrick Walton</a>, <a href="https://twitter.com/mbrubeck">Matt Brubeck</a> or <a href="https://twitter.com/larsberg_">Lars Bergstrom</a> — I highly recommend following them on twitter (linked!) so you are up to date on the latest news.</p><p>Also, keep in mind, that Servo is highly modular and pluggable — so do you need a fast &amp; nice HTML5 parser, tracking the <a href="https://developers.whatwg.org/">WHATWG HTML Living Standard</a> as close as it gets, and one that includes either Rust or C bindings? Well, you are at luck, because <a href="https://github.com/servo/html5ever#getting-started-in-other-languages"><strong>html5ever</strong></a><strong> </strong>is there for you — you could have started using it today! This modularity and pluggability is true (and an intentional goal!) of several parts of the nascent browser engine, and are actually planned to land in Firefox, replacing some aging parts (like the current HTML tokenizer, that was actually machine-translated from Java to C++) prior to Servo being <em>finished at all</em>.</p><p>And well, after all — there is really no better way to follow Servo’s evolution, than working on the code itself — so if you are up to taking a dive deep into Rust-wonderland, I implore you to…</p><h4>Contribute! — and make Servo happen yourself!</h4><p>Helping Mozilla reach the above-mentioned goal of shipping Servo is a trivial task for anyone with a bit of programming mojo — contributions to Servo source code <a href="http://www.joshmatthews.net/servo-stats.html">are on the rise</a> — and it’s actually quite easy to contribute, so please do so, even if you haven’t seen Rust code ever in your life!<br>Rust is fun, you should <a href="http://doc.rust-lang.org/guide.html">check it out, if you haven’t yet</a> — also, there is a whole <a href="https://github.com/servo/servo/labels/E-easy">host of marked “easy” bugs</a> on the Servo GitHub issue tracker to get you started.<br>And just how “easy” are these easy bugs? So easy that they are getting fixed at a rate faster than created!</p><h3>Josh Matthews on Twitter</h3><p>Upside: lots of new contributors working on Servo&#39;s easy bugs Downside: the easy bugs filed for #mozlandia are gone and it hasn&#39;t begun yet.</p><p><em>Thanks to Lars Bergstrom &amp; Patrick Walton for their presentations &amp; kind feedback on the article! You could follow them on Twitter (links above) to receive timely updates on Servo-progress!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d53eb6f64ff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MozLove]]></title>
            <link>https://medium.com/@slsoftworks/mozlove-b3dcf2ce248e?source=rss-d7cb583a6faa------2</link>
            <guid isPermaLink="false">https://medium.com/p/b3dcf2ce248e</guid>
            <dc:creator><![CDATA[Flaki]]></dc:creator>
            <pubDate>Fri, 07 Nov 2014 08:15:12 GMT</pubDate>
            <atom:updated>2014-11-07T08:15:12.021Z</atom:updated>
            <content:encoded><![CDATA[<p>“I hate it when this happens” — I thought to myself. That morning, I opened twitter, and the internet was on fire, again. Not as radically and all-encompassingly though, as <a href="http://istheinternetonfire.com/">we are used to it nowadays</a>, this time it was mostly <em>angry</em> people — people angry at Mozilla.</p><p>I’m not an expert on <a href="http://en.wikipedia.org/wiki/Gamergate_controversy">#Gamergate</a> (yes, this has escalated <em>this</em> far, it has its own wiki page). It all started with an <a href="https://openstandard.mozilla.org/yes-gamergate-is-everyones-issue/">article</a>, and quickly escalated quickly after in a blogpost (it’s the internet era, after all) <a href="http://tim.dreamwidth.org/1864043.html">Tim Chevalier expressed his concern and/or disappointment</a> — and that was it, the genie was out of the bottle. People were raging and pointing fingers and expressing from disappointment to clear disgust a wide range of feelings according to how they felt at the moment.</p><p>There is an other side to this, though. People who care for Mozilla. These are not (necessarily) the people who <em>work</em> for Mozilla — I myself is just a contributor, a volunteer if you wish — a “mozillian” as they call it.</p><h3>Angelina Fabbro on Twitter: &quot;@supersole @bodil super sad right now&quot;</h3><p>As if @mozilla asking me to join a Thunderclap wasn&#39;t bad enough, now they&#39;re giving Gamergate a platform. https://twitter.com/fatneckbeardguy/status/529866539457978368 ...</p><p>I’m not going to argue on either side, or try to defend any of this — people has done it before me, in much better words, there would be nothing I could add to this. I am simply trying to express how “super sad” many of us gets in situations like this. And it wasn’t the first one, either. Yes, the controversy which lead to Brendan Eich’s departure was not quite unlike this — except being a more full-blown, all-engulfing firestorm. And it left behind causalities that were not easy to recover from. That was the inspiration for the <a href="https://twitter.com/search?q=%23mozlove">MozLove</a> movement.</p><h3>Christian Heilmann on Twitter: &quot;Yay the OSCON photos are out http://t.co/zfTh4rITnj - here&#39;s mine: #mozlove http://t.co/aECAU4s0Xx&quot;</h3><p>Yay the OSCON photos are out http://jceventphoto.com/oscon_2014.html - here&#39;s mine: #mozlove pic.twitter.com/aECAU4s0Xx</p><p>First it was just about twitter avatars, and hashtags — all very superficial-looking, but at the heart, truly emotional expression of the thoughts:</p><blockquote><em>“</em><strong><em>We are all saddened by all this, because we cared…</em></strong><em>”</em></blockquote><p>People were showing this because the cared deeply, about the mission, about the vision — about the <em>DNA </em>of what Mozilla really <em>is</em>, regardless of what it (according to people all around the world) it manages to represent. Then came an idea, because it wasn’t just mozillians, who cared — people all around the world, also cared. So instead of the “MozLove” t-shirts being a geeky expression of mozillianship (is that a word, even? ☺), they embarked on a mission to spread the (moz-)love (and say thank you to the people who cared).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EEyglWXhTOgo0hPq-3GA5Q.jpeg" /></figure><p>Mozilla’s “MozLove” t-shirts, when they shipped to mozillians all around the world (who requested one) — actually came in pairs, for one to be shared with someone who cared, just as much as the mozillian who received the package.</p><p>This Wednesday, when all hell broke loose — it was so great to see, that people still cared:</p><h3>Jan Lehnardt on Twitter: &quot;Dear friends at @mozilla: *HUGS* &lt;3&quot;</h3><p>Dear friends at @mozilla: *HUGS* &lt;3</p><p>I didn’t know a whole lot about gamergate. I didn’t want to defend anyone. At that point, I just wanted to help, to make all that pain of seeing angry and saddened posts (of both sides) go away.</p><p>I received my MozLove tee this July</p><p><a href="http://instagram.com/p/qjZ_piPRWz/?modal=true">MozLuv 💜 #mozlove &lt;3</a></p><p>So far I couldn’t decide, who would be the perfect person to give the “other half” of Mozilla’s beating heart to. Two days ago, this changed.</p><p>There is one game developer I know (not in person, but heck, this is the internet era, isn’t it?) who happens to also be a woman — and I’m sure as hell <strong>she deserves just as much to be a game developer as every single person on this planet</strong>. I know there are a lot of people, at Mozilla, who were hurt by the #Gamergate controversy just as much, as the following “Mozgate” controversy of the Gamergate-at-Mozilla. And they are trying to cope — this is just my way of coping.</p><h4>So Liza, expect a package soon, I hope you (and the snails) will like your new hearty apparel ❤</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pe8xBONirsa2Hzm34ySD_g.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b3dcf2ce248e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>