Showing 12 posts by,

Josh Johnston

A little while ago I had a magical moment. We were building a web application and the product team had decided to phase out a certain feature. This meant that one of the UI components we had built was no longer needed. From the beginning of the project we had put some thought into a modular architecture, and so all of the code for this component was nicely contained within a single directory. Now that it wasn't being used anywhere, we could safel

Remember how Marty McFly traveled to the past and changed that one small thing, then when he came back to the future (ohhhhhhhh) his dad was all buff and cool, instead of the sniveling weakling we saw at the start? In the same way, CSS Modules has introduced one small change at the heart of css and now there is a new world of improvements to discover. This post is a continuation from last week’s introduction to CSS Modules where we will take a cl

If you’ve ever worked on software that uses global variables, you’ll know why they are avoided. And as a codebase becomes larger and more complex you’ll observe two things: first you will feel a growing desire to make these globals get away, and second you’ll find this an unexpectedly difficult task. The reason: ease of maintenance is very closely tied to how dependencies are structured in your code. Globals quickly lead to dependencies out of co

It can be tricky to write software that produces the correct result. But we all know that this only marks the line where the real challenge begins. Finding a good way to model the solution can make the difference between something that “makes sense” and is a joy to work with, versus something that ends up wrapped in comments like this: // // Dear maintainer: // // Once you are done trying to 'optimize' this routine, // and have realized what a te

Greetings adventurer! On our last trip we explored a popular nodejs library and discovered some interesting gems there. That was ~100 lines of code, but this time we’re going to attempt something a little more ambitious: React! Ever try finding your way around a huge codebase? It doesn’t take very long before the vertigo kicks in. When looking at something like React, what we see is the cumulative result of years of effort from hundreds of very b

Greetings adventurer! In today’s expedition we’re going to pick a popular nodejs library and dive into its depths to see what we can find. If this all goes to plan we’ll come away not only understanding the internal workings of a commonly-used module, we’ll also discover some interesting patterns and techniques along the way. Meet mkdirp Get ready to dig into substack’s excellent mkdirp, a handy library for recursively creating directories (just

When you first find yourself leading and mentoring a distributed development team, it can seem like an incredibly daunting task. You might ask yourself things like: “How am I suppose to lead people when I can’t even see what they’re doing?” or “How can I mentor someone through a chat box?” The good news is that once you learn how to trust and empower proactive people, regardless of where they live, you will be amazed at the results you can achiev

Untangling Callbacks Promises, generators, fibers… Extremely clever people have gone to great lengths to avoid using callbacks in javascript. Writing callback-heavy javascript can be very challenging and once you’ve gone beyond 5 or so levels of callback-nesting it’s reasonable to start asking whether there might be a better way. But consider that callbacks aren’t a “language feature” of javascript. Callbacks are just functions. Often when we fin

Meetings are such a common cause of misery that we bond over them.  If you ever find yourself in an awkward silence with a programmer, all it takes is a “Meetings, amirite?” and within no time you’re best pals.  We groan at the bureaucracy and busywork of planning and attending meetings when all we really want is to get things done. Yet they are generally tolerated as a necessary evil.  What’s going on here? The unfortunate fact is: we are addict

There was a time when people thought of web apps as less-functional-and-slower versions of native apps. Fortunately that misperception is being challenged every day, and the gap is starting to look significantly shorter. “ORBX.js enables state of the art 1080p60 cloud streaming to all HTML5 browsers, without the use of plug-ins, browser-specific video codecs, thin client-installations or native code dependencies.” Between node.js, ORBX.js and ma