Lego blocks are never a good analogy
Technical and tech-adjacent writers seemingly never tire of describing various technologies as being "like Lego blocks". Here's just the latest example I've come across, and a particularly egregious one: In the new world of Web 3.0 closed systems will be replaced by open systems, centralized by decentralized/democratized and interoperability modularity will rule (think how Lego pieces regardless of where you buy them, and from which set, work with each other). Here are some other things whic...
Read post
How I Learned OOP: A Nightmare
C++ was the first Object Oriented programming language. It was created by mixing C with Simula, which was invented by Alan Kay. In this article, I'll be sharing some helpful principles I was taught for writing OOP programs. (Is this for real? You decide!) Use inheritance to share behaviour Create deep inheritance hierarchies Provide a getter for every private member Mutable state is your friend A class must be something you can touch You can touch Beans OOP is the only paradigm you'll ever ne...
Read post
Destroy All Dependencies
or, why structural typing is awesome Comment on this post on dev.to When designing software, we strive to ensure each module, class, or function has a single responsibility. We want to be able to reuse small, focused pieces of code, and we want our tests to be clean and understandable. But a piece of software as a whole usually has more than one responsibility! Sindre Sorhus, noted developer of small NPM modules, puts it succinctly in this comment: You make small focused modules for reusabi...
Read post
Lessons in object-oriented design
I will be re-reading the following quotes from Sandi Metz's Practical Object-Oriented Design every morning before I start coding: Object-oriented design is about managing dependencies. It is a set of coding techniques that arrange dependencies such that objects can tolerate change. In the absence of design, unmanaged dependencies wreak havoc because objects know too much about one another. Changing one object forces change upon its collaborators, which in turn forces change upon its collaborat...
Read post
A stateless token case study: Algolia search API
At work, we use Algolia to outsource the job of managing search infrastructure. One part of its API intrigued me. Algolia's server-side library allows us to create "secured API keys" to give to our users (i.e., browsers), with which our users can perform searches over our Algolia data with filters. For example, our Algolia account contains search data from Teams A, B and C. When a user from Team A logs in, our server generates an Algolia token for that user with a filter set to only show result...
Read post
JavaScript's ecosystem is uniquely paranoid
Another week, another NPM-related snafu. Why does this keep happening to the JavaScript ecosystem? The answer is paranoia. 😱 Many are quick to assert that JavaScript just has a too-low barrier to entry and the n00bs are messing it up. Whenever anyone says "JavaScript is the new PHP!" this is probably what they mean. I don't feel the need to provide evidence against this claim; I think it comes from an understandable frustration, expressed through all-too-common tech elitism. Others say we sh...
Read post