The Caching Antipattern

TL;DR - Caching done badly has bad implications. Try your hardest not to cache data; but if you really do have to, make sure you do it right.


There are only two hard things in Computer Science: cache invalidation and naming things.

– Phil Karlton

Caching?

To make sure we’re on the same page, when I say caching, I am talking about the practice of speeding up your own application by masking slow dependencies by remembering previous responses and using them instead of making another slow call to the dependency.

As mentioned briefly by Phil Karlton in his well known sound byte, caching is a tricky problem. This is compounded by a number of common mistakes which I have seen over the years which have resulted in unnecessary confusion delay.

Common Mistakes

Here are some of the mistakes I have seen and what we should to differently.

read more

Can we do better than database migrations?

TL;DR - Database migrations are an antipattern, Model your database and generate diff scripts instead.


What are database migrations?

Migration is about getting from one place to another. Database migrations are about getting our database from one state to another. As we maintain and develop a database application we will want to add and remove new tables and columns, create new stored procedures and modify reference data.

SQL database engines facilitate all of these operations with imperative statements so when playing with the database in your Dev environment we issue a series of these statements to get the database in to the state we want. When we’re happy that we know what we want, we write all of these statements down together (either directly in SQL or using a DSL like ruby or asp migrations) and declare them as a migration from the previous state to the new.

read more

Management As Multithreading

What if developers and managers can be models using the same concepts as in multi-threaded software?

As developers we often talk about limiting work in progress. The reasons for this are well understood thanks to books like [The Phoenix Project](https://en.wikipedia.org/wiki/The_Phoenix_Project_(novel%29) and [The Goal](https://en.wikipedia.org/wiki/The_Goal_(novel%29) before it. As a developer I notice that this is not entirely unlike a single thread in my software doing a single piece of work at any one time.

read more

Event Handling In Games

Being predominantly an applications programmer, I have a different take on things that people in the games development area might. Event handling is something that one might do quite differently in many different situations. Here are the ideas I’ve had and the pros and cons.

read more