James Long, a programmer, writes about JavaScript, React, async patterns, compilers and SQL in the browser.
Commenters say he and a few others stay ahead of the industry, and they recommend his React and generators posts for learning concepts.
Actually Ampie used to work differently: Ampie would store the local cache of links from your twitter feed and links submitted to HN, and check against it when you went to any web page. If there were hits, it would show a small tab in the bottom right corner, showing that there are N tweets, M HN submissions with this page. Then you could click on the tab and the sidebar would pop up, so no requests were sent until you actually clicked on the tab.
There are two problems with this: first, the cache had to be large, several hundreds of megabytes, because there are a lot of links (~200k from HN, and each person I follow on average tweeted 1k links among the last 3k tweets that twitter lets me access) and indexeddb is not memory-efficient. Second, this is easy to miss, and those numbers alone don't give enough information to go through the effort of clicking there every time. And this doesn't include the backlinks and HN comments mentions (fun fact: there are about 4m URLs mentioned in HN comments), so you'd miss out on a lot of stuff. You could suggest Bloom filters as caches, but that is a bad solution since now you only can show if there is a hit or not (instead of two numbers), but also there are false positives so the sidebar is not reliable anymore, and given that you go to hundreds of URLs a day, the FP rate has to be really low which makes the cache really large. Maybe using something like https://jlongster.com/future-sql-web would have reduced the memory usage, but at…
I've been using this (v2, though) rather extensively the last few months so I figured I'd share some experiences.
First off, it works great. The TypeScript definition file also works fine as an API documentation of sorts, although it would be nice if some web site with a clickable TOC could be generated from it.
I was a little confused at the beginning how the "Sequence" base class (changed name to Iterable in v3) was an arbitrary key=>value mapping (with no apparent relation between the keys and the ordering of the key/value pairs) that I had expected would be called "Map". The name change made this clearer for me: it's basically an abstract interface, not a concrete datastructure.
The TypeScript support, to my experience, does not work as advertised on the tin, especially when you nest data structures. For example, code like this compiles fine:
var q = Immutable.Map<string, Immutable.List<number>>();
q.set("hello", Immutable.List([1,2,3])); // typechecks until here
q.updateIn(["hello", "wrong"], false); // shouldn't be possible, but is.
Similarly, if you use Immutable.Record to build immutable objects, then you can still call set() with any key because the key is a string instead of something TypeScript could typecheck. Meanwhile, using direct property access on Immutable.Records, like this, will fail:
var Banana = Immutable.Record({length: 0, colour: "yellow"});
var someBanana = new Banana();
someBanana.curve = 5.0; // should fail, but…
This is a very useful walkthrough.
Some links for those who are also interested in "Thinking in React" in a more conceptual way (#4 is a presentation from the same person who wrote the walkthrough):
1) React — Basic Theoretical Concepts: “A description of the conceptual model of React without implementation burden.” https://github.com/reactjs/react-basic
2) Pure UI: “A lot has been written about the merits of React as a framework. Today I’m compelled to write about the benefits of a programming model it enables and its implications to the design and creation workflow." http://rauchg.com/2015/pure-ui/
3) Removing User Interface Complexity, or Why React is Awesome: “I’m mostly concerned with the core problems of data binding and componentizing UIs. After much research and usage of the technologies mentioned above, I found React to provide the best solution.” http://jlongster.com/Removing-User-Interface-Complexity,-or-Why-React-is-Awesome
4) Pete Hunt: React: Rethinking best practices (youtube): “building views with JavaScript, ‘re-rendering’ your entire application when your data changes, and a lightweight implementation of the DOM and events.” https://www.youtube.com/watch?v=x7cQ3mrcKaY
5) Nothing new in React and Flux except one thing: “What is it that makes React so innovative and compelling?… The Virtual DOM allows us to convert a mutable retained mode graphics API to an immutable functional immediate mode API.”…
> Generators are JavaScript's programmable semicolons. Lets not take away that power by taking away the programmability. Lets drop async/await and write our own interpreters.
One of "our own interpreters" (i.e not standard in JS), that I am very fond of, is js-csp [1]. It's a replica of Clojure(Script)'s core.async, or Go's channels/goroutines. It uses ES6 generator functions underneath.
James Long has written an excellent post about it [2].
I find it to be the less taxing on the mind solution for coordinating complex asynchronous processes in JS, especially when paired with transducers [3].
Furthermore, powerful Go/Clojure patterns can easily be re-used in JS.
In conjunction with CoffeeScript, the code becomes elegant and straightforward since there is no 'function*' ugliness required.
That's the least complex solution I have found to like the most. Performance and memory usage suffer a bit, but it's very straightforward to optimize if/when needed.
[1] https://github.com/ubolonton/js-csp
[2] http://jlongster.com/Taming-the-Asynchronous-Beast-with-CSP-in-JavaScript
[3] http://jlongster.com/Transducers.js--A-JavaScript-Library-for-Transformation-of-Data
Nice write-up. I've been popping my head on over to their project every few months to check out their progress. Something that's pretty cool is that they're using Flutter to write Fuchsia's UI [0].
My favorite thing about Flutter is that it looks like they took some heavy inspiration from React. If anyone reading this isn't familiarized with React, or they don't really "get it", I'd highly suggest reading the Removing User Interface Complexity, or Why React is Awesome [1].
One of the big problems with implementing a UI toolkit is having to re-implement everything relating to accessibility. Although it's totally understandable that they're still focusing on the core.
Something I'd be interested in seeing is how Dart and Flutter might affect battery life. I'd expect the stock UIs to be pretty well optimized by now, but I have no idea how Dart stacks up in performance.
[0] https://github.com/fuchsia-mirror/sysui
[1] http://jlongster.com/Removing-User-Interface-Complexity,-or-Why-React-is-Awesome
Thanks! I haven't used Scheme in a while because I got tired of focusing so much on something without a big community. I want to get back into it though, specifically with game development. Checkout http://jlongster.com/ over the next couple months and I'll start posting again.
Scheme is great but you should also involve yourself in a popular language with a big/fun community so you don't burn out. Seeing different perspectives is good anyway.
Looks like iScheme came out after they backed off of their only Objective-C/C rule. So it should be fine, simply because it doesn't download any scripts. I think that's the only restriction now.