architecture Zero-cost Future Proofing: Meaningful Namespaces Sandi Metz famously said "duplication is far cheaper than the wrong abstraction," and my experience has been that following that advice has usually worked out well. You can't future-proof well until you know what you need to future-proof against. A trade-off that makes
Code Introducing API Boundaries to Prepare for Bigger Changes Alternatively: API Boundaries for Fun and Profit I routinely misquote Kent Beck, who said "for each desired change, make the change easy (warning: this may be hard), then make the easy change." He said this on Twitter (RIP) so I won't be linking to it, but
Code Code is Knowledge In the mid-2000s (so, in ancient history) a friend of mine went to an interview at a big tech company and was asked to write the JPEG compression algorithm on a whiteboard. He didn't know that algorithm off the top of his head, which he admitted, and
programming Using Timers to Learn When I'm trying to learn a new language or environment, one of the first things that I try to do is implement a timer: code that can be used to instrument other code and print out how long it took to run. A long time ago, early on
go Go Interfaces as Requirements, not Capabilities This is a hard-won lesson that's taken me many years to learn, and I have seen others follow a similar path, so I'm writing it down in hopes that maybe some people will find a shortcut. Go's type system is, in my experience,
Design Changing the Meaning: Breaking Semantic Changes The subtlest kind of breaking change is the kind that doesn't affect a value's type but instead affects what that value means. These changes can be hard to notice when you're making them, and even harder to debug when they happen. They can lead
Database Constrain Your Data Access for Fun and Scale ActiveRecord-style ORMs can be huge time-savers, but also blur boundaries within a system, which leads to bad assumptions and habits
Code Building Extensibility into APIs from the Start Making the right design decisions early in a project can have a huge impact on the ability to safely improve and evolve it over time.
testing In defense of unit tests A few years back, Guillermo Rauch—now the CEO of Vercel—tweeted a pithy assessment of automated testing: Write tests. Not too many. Mostly integration. — Guillermo Rauch (@rauchg) December 10, 2016 This inspired Kent C. Dodds to write that: Integration tests strike a great balance on the trade-offs between
continuous deployment Sliding Windows of Compatibility Writing software professionally means constantly changing, evolving, and migrating applications. All-new "greenfield" projects are a rare treat, but not the norm. Constant change means we have to be comfortable making big changes applications that are running in production environments, usually with customers using them, and do it
programming Caller-controlled Rollouts Slightly warm take warning: not everything needs to be feature-flagged. New APIs or API endpoints, for example, that have no callers yet, don't benefit from the ability to toggle them off. If nothing is executing this code, then there's no behavior to disable. Let'
open source Open Source Subway Map If you don't actually want to read this whole post (no shame at all) the tl;dr is that I'm going to try using a GitHub project to organize and hold myself accountable for open source maintenance. Mental health is a weird thing, sometimes. Like, oh
technical What is "Tech Depreciation?" As soon as you drive that software off the lot, its value will start going down. "Tech debt" is a well-known and useful metaphor, but I've found it doesn't describe the whole picture. Technical debt is a choice, a trade-off—sometimes made
Code Open Source Update: Waffle I just pushed version 0.11 of Waffle [https://pypi.python.org/pypi/django-waffle/0.11], the feature flipper for Django [https://www.djangoproject.com/]. It contains a number of code and documentation fixes [https://github.com/jsocol/django-waffle/compare/v0.10.1...v0.11] which you can
bleach Open Source Update: Bleach As of today, I transferred ownership of Bleach [https://github.com/mozilla/bleach] to the Mozilla organization, and the Mozilla WebDev team, in particular Will Kahn-Greene [http://bluesock.org/~willkg/] and Jannis Leidel [https://twitter.com/jezdez/], are taking over maintenance of it. Huge thanks to Will, Jannis and
Code Bounties and Tips Last week [https://www.coffeeonthekeyboard.com/biweekly-ish-update-07nov2014-1185/] I wandered into the tip4commit fracas [https://news.ycombinator.com/item?id=8542969] and a “helpful” commenter pointed out Bountysource, so I started asking some questions there. There must have been a few others doing the same thing because,
cas Simple out-of-process lock with Python and Memcached On TodaysMeet [https://todaysmeet.com/] I need to check that a name is not in use before creating a new record. Unfortunately, because names can be reused over time, I can’t create a UNIQUE key in the database and enforce it there. That means there is some tiny amount
Code Actually Starting an Open Source Project I’m a little late to the party, but I just got around to reading Starting an Open-Source Project [http://coding.smashingmagazine.com/2013/01/03/starting-open-source-project/] and, as someone who has started several reasonably successful projects, I wanted to publicly disagree with, essentially, the entire
Code Where are James' Slides? I give a lot—well, I give some—talks, but I never give the slides out. And, as far as I can remember, no one has ever asked for them. I know people, people who speak a lot more than me [http://stevesouders.com/], who put all their slide decks
Code Why Django Sucks, Except When It Doesn't Ken Reitz [https://twitter.com/kennethreitz] is a smart man. Very smart. Smarter than me. He’s responsible for some of the best [https://github.com/kennethreitz/flask-sslify], most widely-used [https://crate.io/packages/requests/] Python libraries out there. So when he talks, I listen. And recently, he
Back-end Developing at Scale: Database Replication When a website is small—like this one, for example—usually the entire thing, from the web server to the database, can live on a single server. Even a single virtual server. One of the first things that happens when a web site gets bigger is this is no longer
amo Code-sharing Update When we decided to move SUMO to a new platform [https://www.coffeeonthekeyboard.com/the-evolution-of-sumo-339/], one of the reasons we chose Django [http://www.djangoproject.com/] was code sharing and reuse—specifically that SUMO [http://support.mozilla.com/] and AMO [https://addons.mozilla.org] would be
Code WP: Better Search Widget 1.1 Better Search Widget 1.1 [https://www.coffeeonthekeyboard.com/wp-content/uploads/2009/07/better-search-widget.zip] is a significant upgrade to Better Search Widget [https://www.coffeeonthekeyboard.com/wp-plugin-better-search-widget-113/] that adds new features and fixes an old bug with internationalization. Features (New features
api Widget l10n I spent some of today working on bringing a couple of WordPress widgets up-to-date (Better Search [http://jamessocol.com/projects/better-search-widget.php] and Most Comments [http://jamessocol.com/projects/most-comments-widget.php]) only to discover there is a new widget API [http://codex.wordpress.org/
Code JavaScript: Private Static Members, Part 2 Finally, it’s time to finish up the lesson on private static members and methods in JavaScript. Last time [https://www.coffeeonthekeyboard.com/javascript-private-static-members-part-1-208/], I introduced the technique of creating and immediately executing a function, using parentheses. I talked a little about returning a