Understanding what `new` does in five easy steps

The new keyword, inheritance and object creation are some of the most confusing parts of the JavaScript language, and are equally befuddling both to newcomers and to programmers experienced with other languages. The reasons for this go way back to the design of the spec, and I won't get into them. I do not believe that being a coding newbie gives you some kind of advantage in understanding prototypes: rather, trying to grasp both prototypes »

Three mundane things you can do with recursion

I have been spending some quality time with Clojure, not because I think I'm likely to use it for a real project any time soon, but because both the syntax and behaviour of the language are so different from what I'm used to that I feel like a total n00b again. This is uncomfortable, but it's a good thing: I'm looking at my even my production code in a whole new way. Recursion is a »

DIY Lazy Load

I am constantly looking for practical ways to get all the beautiful images in a design to load without hampering the page load unreasonably. While responsive images have been the biggest help, occasionally something else is called for. For example, the content of carousel slides that are initially invisible can be deferred until the rest of the page has loaded, and the carousel can be started manually only once all the images are obtained. This »

How to keep your promises: JavaScript edition

The first time I needed to access a third-party API on the web I remember doing something like the following (in PHP): $data = file_get_contents('http://a/resource/somewhere'); This has the advantage of being really easy to read: like all other parts of my code, I assign a variable to an expression and expect that it will be filled with a value of some sort. What I never thought about at the time »

In the beginning was the code, and the code gave life, and the code was life

Credit: Randall Munro, Used under CC BY-NC The oldest gene we possess carries the information to make something called the 5S RNA, a component of the ribosome. This molecular machine is responsible for translating a DNA sequence into a protein sequence. The reason this is critical is that chemical properties of DNA are pretty simple: it's more or less just a carrier for information. Proteins on the other hand, have astoundingly complex chemistry: they can »

Journals: Your domain is now your reputation. Protect it.

One facet of web sites that often confuses clients who have not been involved with the web before is that they have to pay separately for their domain and their hosting. While the different bills can be annoying and seem like a scam, there is very good reason to keep them distinct and one should actually be wary of any "package deals" that sell both at once. The difference is often explained as if the »

How to choose your first programming language

I do not have Google Analytics on my blog (well, I do, but I seem to have forgotten the account it's associated with), and when I discovered my mistake, also discovered also that I didn't really care. If my blog doesn't have an audience, that's hardly a reason to stop blogging, and if it does, I don't need my topics to change based on traffic. I write mainly for me - if someone else finds »

The Web Covenant: Ad Blockers are here to stay

Since I blogged a month ago on the topic of content and page performance, the discussion around ad-blockers has really heated up. James Avery: CEO of Adzerk, using the same comparison to the Napster revolution that I used in my previous post, offers his prediction that ad blocking will keep growing until ads become less creepy and less detrimental to web page performance. Sam Snelling takes a more hard-line approach: There is no implied contract »

5 things I learned building a React and Node app

A blog post over at Treehouse listed seven web development trends for 2015. At least five of them touched on React, so perhaps the article could be summarized as: React, React, React, React, baked beans, React, and React. JavaScript is hot right now. I am far from an expert on building big stuff with JavaScript, but I thought with the recent release of Monocle that I could give a little perspective on what I learned »

Readability vs Instant Articles: how does Content save itself?

When I was in University there appeared - quite suddenly - new Thing called Napster, that allowed people to obtain Content (in this case audio files) for free; whereas just a few years before we had to pay for it. Or at least, the process of obtaining for free had previously been arduous enough that many were willing to pay for it. This new Thing, we were told, was dangerous because so much Content was »