Four Years after our Robbery

Custom Lego Brickheadz models

Today marks four years since I was robbed.

Someone entered my home, presumably between 12-6am while I and the rest of my family were sleeping, and liberated the premises of my LEGO collection. And nothing more.

I wrote a blog post on the day of the theft to catalog some things and hopefully find the person(s) responsible. I wrote a follow-up post a year later to share that, yes, we were able to re-purchase everything and, no, we still had no idea who did it.

They didn’t rob our house. This wasn’t a random attack in a random neighborhood.

They robbed me, personally. 

And that’s the part that has stuck with me the most over these past 4 years. Someone whom I had invited into my home at some prior point in time, a person who had met me and maybe knew me well, chose to steal from me. 

Now, this was not the first time I’ve had belongings stolen from me.

I had a bike stolen once, when I was still a teenager. That stung a little. As an adult, I had my winter coat stolen off a coat rack while I on college campus for ministry work. That was cold, literally and figuratively. It was a bummer, too, because my car key was in the pocket and I had to spend something in the realm of $300 to replace that.

I didn’t take the coat theft so personally, though. Someone needed a winter coat badly enough to steal mine. Or they needed money badly enough to sell it, knowing full well they were leaving someone else in the cold (albeit temporarily). I hope they’re doing alright.

But this time was different. This was an extremely specific and targeted theft.

The stuff they took is largely irrelevant. Precious to me and my family, maybe, but it was only stuff. Insurance made it possible to replace the entire collection. Kind donors gifted our family with more LEGO than I can count. Our home, neighborhood, and town continue to be as safe as they ever were. Still, things continue to feel different.

I have not slept the same these past four years. I routinely wake up to bumps in the night. Some nights I’ll hear something as I’m falling asleep, get a full adrenaline dump, and be awake for another 30 minutes or more.

I want to know who they were to me before they slipped out of my life forever. I would like to know what was going through their mind before, during, and since. It would be great to get some closure.

What they stole was LEGO, but what they took from me was peace of mind.

Piecing it back together: one year after our lego theft

Pieces from the Lego Ghostbusters Headquarters set

It’s been a year since someone broke into our home, while we were sleeping, and stole only our Lego collection. This continues to be the strangest thing I’ve ever experienced and I hope it forever will be – I don’t know if I could handle anything stranger.

Throughout the year we have heard the same questions and suggestions over and over. Chief among them was the question, “are you serious!?” soon followed by, “did you catch who did it?”

In this post I’m going to attempt to address all of those frequently asked questions and provide some closure. I may update this post down the road, I may not. This should be the last thing I post on the topic.

Did you catch who did it?

No. No we did not. I don’t anticipate that we will, either.

Why not? Because most of what the thief grabbed was bulk Lego. They can know the assembled sets (which are the only ones I shared in my announcement post) but because they didn’t grab the manuals the rest of what they captured is random pieces. It’s the equivalent of someone stealing loose screws and bolts from a hardware store – how are you going to trace that?

Bins of Lego bricks
Sorting random Lego brick

Plus, it’s just as likely that this collection was stolen for keeps rather than for sale. Unless I stumble across the home where it now lives, I won’t see it again.

I did scour the internet for awhile after the collection went missing, finding what seemed like positive matches on a few difference occasions. Eventually I stopped looking when each lead turned into a dead end. I decided my time was better spent on billable work, otherwise I was just allowing the thief to rob me twice.

It someone you know, you know?

Yeah, we know. Without question it was someone who had been in our house before. That’s the only way they would have known where to find the collection and how to get in and get it. That doesn’t help narrow things down, though, and I decided early on that I don’t want to spend the rest of my life being suspicious of my friends or family. So, if it was you, know that I’m not looking for you and would be happy to never learn it was you (but I would still like to know how you did it).

Did you get everything back?

Microscale Lego Firehouse
Microscale Lego Ghostbusters Firehouse

Almost – there’s just one set I haven’t been able to find for sale. Yes! Insurance covered the replacement cost of our entire loss (after meeting our deductible).

We immediately repurchased a few sets that were still available on, and we bought new storage drawers from Amazon, but that was it for the first year. Several generous people sent us Lego in response to our theft and we’re still floored and humbled by your kindness. More on that in a bit.

I went back and forth several times about whether or not I even wanted to rebuy everything. To go through the entire claims process, to spend the time searching for and purchasing each of the old sets via Bricklink, to reintroduce the liability back into our home. My smart wife (and several others) convinced me it is worth the effort because our kids are already super into Lego and that interest is only going to grow with time. Plus, let’s be honest, if I just let it all go then the terrorists win.

So, I’ve spent a lot of time over the course of a few months buying every set could find from our original collection. Wherever possible we purchased sealed sets from different sources – just to be extra sure we’re not paying for our stolen stuff (which would be highly unlikely anyhow, since the person(s) behind this don’t know which sets they took). We were able to find everything from our known collection except for one single set. I still can’t believe it!

Friends and strangers alike are incredibly generous

I have always known this in my core. It’s a primary driver behind most of my own motivations, too. Generosity is a muscle that must be exercised lest it atrophy.

Many of you, though, still surprised me.

Cardboard boxes of bulk Lego bricks
Boxes of gifted bulk Lego

There were several comments on my original post, as well as emails, private messages, and more from people who wanted to send us Lego in response to our story. Some of you even sent us things without even asking first, likely knowing I would have otherwise done my best to dissuade you. In one example, Meijer, the incredible supermarket where we prefer to shop, sent us a $150 gift card to buy some new sets after hearing our plight. There was no publicity attached to it and, as far as I can tell, these two sentences are the only place it has been publicly mentioned anywhere. They’re just good people.

I did my best to thank everyone privately after each instance and that hardly seems sufficient.

To all of you, again, I have to say thank you!

We continue to be humbled by your gifts and have been enjoying playing with them quite thoroughly.

Can we send you some Lego?

Thank you very much for you offer! But, no, please don’t.

I definitely wasn’t soliciting donations when I announced we had been robbed, and yet many of you just cannot help yourselves because you’re so awesome. If you are in a position where you have unused Lego, and you want to see new life breathed into it, we encourage you to seek out local foster parents or operators of after-school programs. There’s a good chance they would benefit tremendously from some new and unexpected Lego.

If you really do want to divest of the Lego, and you can’t find a worthy recipient, I would be happy to help find someone and facilitate the exchange for you. Please do reach out if that’s the case.

Did you hear about the [other] Lego theft?

We probably have, actually. I didn’t know this before our own robbery but have definitely been made aware of just how common a target Lego is for thieves. Now people will inform me about them on the regular.

Screenshots of other Lego theft articles
Lego theft news clippings

In most cases the criminals are robbing commercial institutions (e.g. Toys R Us, Wal-Mart, Target, etc.). From there they might return the box with rocks inside, resell the stolen goods ( via Craigslist, ebay, Facebook, etc.), or just keep things for their own enjoyment.

I heard about at least one local-to-me case where a significant amount of Lego had been stolen from a warehouse (easily 4-5x the volume and value of our collection). In that case it was thankfully recovered around 18 months later, when that thief was busted for an unrelated crime.

In recent news there is a rather infamous case of a long-term Lego theft ring operated in Oregon – police busted a man with over $50k of stolen Lego still in his home. And there are many, many, many other cases besides these. It seriously happens all the time. Private Lego theft is far less publicized, so it’s hard to really know how common it is, but it would seem it’s not much of an outlier.

How are you sleeping since the incident?

Better, now that it’s a year behind us. But still not great.

Katie and I both had a lot of trouble falling asleep and staying asleep in the first month following the robbery. It got easier after we added security cameras and a monitoring system for all our entry points. We now have a few thousand dollars wrapped up in these stupid security encumbrances and I hate that.

I do still routinely wake up after a bump in the night, get a hit of adrenaline, and then have trouble going back to sleep after that. There are occasionally (rarely) nights where I’ll sleep very little. It was an extremely personal and violating crime and I’m afraid that will always be with me. But it is such a minor thing, too, compared to what so many other people live through and what it could have been. I remind myself of that on the regular to keep perspective.

What’s next?

Not much, as far as this case is concerned. We’ll continue acquiring the sets from our original collection, occasionally buy new sets, and keep enjoying Lego as a family.

Custom Lego Brickheadz models
My wife and I as Lego Brickheadz

The thief may have taken our things, may have taken my time, and may have cost us a lot of money, but they will not rob us of the joy of play as a family.

If you, thief, are reading this, I still – more than anything – want to know how you did it. Feel free to drop us an anonymous letter and give us some closure. I’ll do my part and continue praying you eventually find your footing towards a better, meaningful life. And sorry for calling you a dick to anyone who will listen.

Stolen LEGO: Two weeks later, now with a $2000 reward

LEGO in grass and bushes

The past two weeks have been a blur. This is, by far, the strangest thing that has happened in my life to date. I sincerely hope it goes down as the strangest thing ever, because I don’t think I’m prepared for anything weirder than this.

Here’s a quick high-level summary and you can find more detail below:

  • Our LEGO collection is still missing after the LEGO theft on August 28th. We did find a small pile of LEGO outside (photo above); it looks like one set of drawers tipped over after being set down and these are the pieces that were left behind.
  • Today I’m announcing a $2000 reward for the successful return of our collection and helpful information on finding the person(s) responsible.
  • Our home owner’s insurance policy has us covered and will (eventually) pay for all replacement costs in full (less our $1200 deductible).
  • In spite of the above, several friends and family members have been amazingly generous and purchased gifts to help us start replacing our collection more quickly. We couldn’t be more thankful or grateful. Y’all are amazing!
  • We have installed $1000-worth of surveillance and security equipment to help us sleep again… which is finally starting to work.
  • We still need your help keeping eyes on the many different marketplaces and reporting leads.
  • Lastly, I’m bothered a lot by how inward facing all of this has been – my world view has had been too much about me these last two weeks. I’m looking forward to getting back to thinking about and investing in the rest of you.

$2000 Cash Reward!

Pile of Money
Photographic illustration. I promise I won’t pay you entirely in ones.

Yes, we can replace our collection 100% thanks to our home owner’s insurance policy (more details below). This will take time and will still cost us $1200 for our deductible. I’d like to speed that process up and just get the original collection back, so I’m putting up $2000 towards the successful return of our collection and apprehension of the person(s) responsible for the theft.

If you can help us get our collection back, or if you can help us find the person(s) responsible for the theft, we want to personally pay you $2000 for the information.

If you know anything about who did this, where to find them, or where to find our missing LEGO collection, I urge you to please contact the Grandville Police Department or me personally.

Thank you to our generous friends and family!

Despite being clear that our insurance will cover us, many of you saw fit to bless us anyway. Some of you sent LEGO, some of you offered to send LEGO, some offered money and time. I shouldn’t be surprised, knowing all of you like I do, yet here we are. It is so encouraging to know you and be related to you. You’re a wonderful reminder to be more generous myself.

Our insurance has us covered

This section was originally 1,000 words all by itself. I’ve pulled that out into a separate post that I’ll share later. For now I’ll give you a truncated version.

This week we’re getting a $1200 check from the insurance company, against a $7500 loss. We’ll get the rest too, but it’s not a huge windfall that everyone expects and assumes when they say “they’re just doing it for the insurance money”.

Before I go any further, I need to say this: we love and recommend State Farm insurance (and have for years before this incident, too). They have been easy to work with on all fronts: vehicle insurance, renter’s insurance, home owner’s insurance, life insurance, etc. Every time we’ve needed to call them about anything, on any front, we were able to talk to a real human almost immediately. Every. Time.

In short, the process for restoring our collection will be based on reimbursement. As we are able to buy the lost sets we will submit receipts to State Farm. After that they will cut us a check for money spent.

But what if we get the original collection back?

I asked the detective in charge of our case the very same question. There is a restitution process for just such a thing. If we’re able to recover any original parts of our collection that will come off the insurance claim. If we were already paid for a replacement then either the replacement or original will become the insurer’s property. As it turns out, this is both a straight-forward and common occurrence.


Increasing our home security

Security camera
Photo by Serge Kutuzov on

The most frustrating part of all of this for me is that someone was in our home, while we slept, and got away without us noticing anything. This is the only known break-in at this address since the home was built 60 years ago. And it will probably be the only one ever. But we can’t be sure of that, of course. And sleeping has become quite difficult now because every bump and creak puts us on high alert, tense dreams startle us awake, and so on.

So, beyond the $1200 deductible we need to pay for replacing our collection, we’ve spent another $1,000 on surveillance and security equipment for our home. We’ve also paid out far more in hours of attention and wasted anxiety.

I’m not going to give up any details about what we bought, though, as that would defeat the purpose of getting the security system in the first place. I can tell you what we’ve done in general, though, and what you might want to consider for your own home (where we both know a break-in will never happen because you live in a safe neighborhood and lead a private life and keep everything worth stealing either locked up or secret, naturally).

We purchased a combination of cameras and sensors from different providers. This mixture allows us to monitor all doors, floors, and windows. I intentionally picked parts from multiple systems to ensure redundancy. If one layer fails or is compromised another can still secure the area. Everything we’ve installed is connected wirelessly and has battery backups. Outbound signals for the security system will utilize its own 3G antenna if WiFi is unavailable. Our modem and router have their own battery backup as well.

If someone opens a door, or enters through a window, we will be notified immediately. If someone bypasses those security measures and makes it into any room in our house, the secondary system will still notify us immediately. And if someone can cut our power or our internet we will still be notified immediately.

If this sounds like overkill, that’s because it is. Now that the integrity of our home has been compromised, though, I don’t expect we’ll ever live without it. As a rational, thinking human being this bothers me to no end. This is a totally emotional response to a statistical uncertainty. But my rational thoughts aren’t what keep me awake at night.

A quick side-note on counting on other people’s security cameras

Many people asked us if any neighbors may have had security cameras pointing at our home. I was polite and brief in all of my answers about that: no they don’t. Do your neighbors have cameras pointed at your home? Would that make you more or less comfortable?

The more elaborate answer is: even if they did, most cameras have a usable line of sight of about 30 feet, and that’s reduced to about 15 feet in darkness. Even HD cameras still capture barely-useful footage in that full range, which reduces the truly useful distance even further. I could go into a lot more detail about the limitations of the optics and sensors themselves but I think that much detail is useless and will sound condescending. I’ll just sign off as an authority who is both a technophile and a person who has studied camera equipment for more than a decade now.

Casting a wide net

Fishing net
Photo by Jonas Jacobsson on

There are so many digital marketplaces for LEGO. Holy smokes! I knew about a lot of places, but then people reached out and pointed out so many more. Now I’m watching all of them. If you can help watch any of them, too, I would greatly appreciate that.

Here’s a non-exhaustive list of sales outlets to get you started:

And you can find the list of stolen goods and photos of the collection in my previous post.

I’ve also reached out to a number of resellers, advertised buyers, and Lego User Groups (LUGs) to make them aware of the theft and keep eyes peeled for our stolen goods.

As you can imagine, keeping tabs on each of these sites is a serious chore. That’s why I’m looking for help to keep tabs on all the listings and why I’ve offered the $2000 reward.

Reporting leads

If you have any promising leads or information to share, please do! You can reach the Grandville Police Department through the non-emergency line at (616) 538-6110 or email Our case number is 17-6191.

You can contact me via email using my first name at this domain. I’m on twitter as @rzen. I’m also on Facebook and am usually absent there, but will make an exception for discussing this.

Thank you!

Help! My entire LEGO collection was stolen!

Did you take my entire LEGO collection? Because somebody did.

If it wasn’t you, can you help me find the thief?

A list of sets, some photos of the collection, and media coverage appear at the very end of this post.

Read the follow-up post, with details on a $2000 reward

Read the one-year-later epilogue

When did this happen?

Sometime after 12:00am ET on Aug 28 (when I got into bed) and 9:00am ET on Aug 28 (when I returned to my basement office) some person(s) invaded my home and relieved our basement of practically every piece of LEGO. And that’s it. Nothing else in our locked home, or unlocked garage, was touched. None of our expensive electronics (computers, monitors, microphones, etc.), none of my expensive camera equipment (body, lenses, lighting, etc.), none of my woodworking tools (table saw, mitre saw, drill press, router table, etc), or any other things of any kind.

It sure sounds like a prank. A very ill-conceived and poorly timed prank. That’s the explanation that makes the most sense of this situation. But nobody has stepped forward or returned anything.

[Minor addendum, after thinking more critically: most of the computer equipment, except for desk-mounted monitors and microphone, were on the main floor of the house with us; the camera equipment was hidden from sight; and the tools would have been very difficult to remove due to their size]

How did this happen?

I honestly can’t say. My family was home the entire day on Sunday, Aug 27. We had a few close friends over for lunch that day – people we’ve known for years and who depend on their credible reputation for their careers (and, before you ask, everybody is on the suspect list, including me). My boys and I played downstairs throughout the afternoon. The LEGO was fully present and accounted for throughout all of that. I was personally up and about the house until midnight, and then awake and out of bed again by 6:30am on Monday, Aug 28. Our house was locked when I went to bed, and again when I left for breakfast at 7am. My family was awake throughout the house from the time I left (7am) until 9am when I returned home and went downstairs. That means the break-in most likely occurred between 12:00am and 6:00am on Monday, Aug 28.

Someone came into my home. While we were sleeping. And removed nothing except thousands of dollars of LEGO. Small, rattly pieces of plastic. Either with a crew that should be large enough to be noticed, or with many trips up and down the stairs.

I want it all back, of course, but almost more than that I want to know how they did it. How did they get all of the drawers, parts, and sets out of our house without any of us hearing?

How much did they take?

Table with 9 bins and 316 drawers of sorted LEGO
The sorted collection. 316 bins of pieces separated by part type.

We’re still working on the total volume, but I know it was generally in the realm of “a lot”. Enough to fill two 18Gal storage bins, at least. The good news is, I have a good idea of which pieces and which sets went missing.

You see, I spent some time last summer sorting my childhood LEGO collection and putting it into small-parts drawers (see above). I had quite a few misc sets and figures that I then put on display across the top of those drawers. I also happened to take copious amount of photos of the process and some of the cooler sets that are now (that is, were) in our collection.

Back when I was still a teenager, my mother had the bright idea to round up all of my LEGO instruction booklets and put them into a folder, which eventually expanded to fill a full box. And the thief just so happened to leave ALL of the manual in the box on the floor.

Box of LEGO instruction booklets
My fine collection of un-stolen LEGO manuals

The real kicker, though, is that they took the sets that Katie and I were actively building! Rather large gifts that we had gotten each other recently. They took these partially-assembled sets and all of the pieces that I had just finished laying out and organizing into plastic dishes across a table in our basement.

Here’s what the table looked like yesterday:

Katie, building the LEGO Disney Castle
Katie, building the LEGO Disney Castle

And here’s what things look like now:

My office, stripped of LEGO
The space formerly known as “the LEGO table”

Table with just a few empty containers
Our stripped and barren table

Those vile rats even took all of the tupperware and an ice  tray that the pieces were sorted into! I mean, just look at all this tupperware!

Tupperware and such
All of our glorious containers, now AWOL along with the LEGO that was in them

How can someone help?

First, theft is covered under our home owner’s insurance policy, and we’re working through the proper channels to sort that out. We are actively working with the local police department on this active case.

Our collective hunch is that the sets are being sold off individually and the rest of the pieces sold in one or many bulk lots. The best way you can help is to keep your eyes peeled for used LEGO that’s up for sale. Maybe via Craigslist, maybe via Facebook, maybe via ebay, or pawn shops, or elsewhere. The seller is probably going to list them within a couple hundred miles of Grandville, MI (49418).

Which sets are missing?

We’re working on a list of that and I’ll update this post accordingly as more info becomes available. Until then, below is a short list of the assembled sets and loose minifigs that we know were taken.

Any leads?

Please either contact the Grandville Police directly via 616-538-6110 or or email me privately. My email address is my first name at this domain.


How about some more photos?

Sure thing, here’s a partial gallery documenting some of the sets and parts!

Media Coverage

So far this story has been covered by Inside the Magic, the Miami Herald, and Fox 17 news (WXMI) in Grand Rapids.

Conditionally change JetPack Infinite Scroll trigger to “click” or “scroll”

Earlier today I was trying to change the “type” for JetPack’s Infinite Scroll behavior to use “click” only for the front page. For all other archives I wanted JetPack to use the standard “scroll” type (you know, the namesake for Infinite Scrolling).

(In a hurry? The solution is at the very bottom of the post.)

JetPack has a bunch of filters available, and the developers even had the foresight to provide a conditional to toggle this behavior based on whether or not the site footer is displaying widgets. Each of the JetPack Infinite Scroll Settings is explained extremely well in the documentation. The setting designed for what I wanted to do is called footer_widgets.

This setting expects a boolean and, if true (footer widgets are present), JetPack will automatically convert the event trigger to “click” in order to allow visitors to see the footer. My first thought was that I could throw is_front_page() right here in the settings definition. My immediate second thought was, “no, that won’t work.”

You see, when the theme support for infinite scroll is registered we’re on the after_setup_theme hook, which is much too early for WordPress to know which template is being loaded.

Digging in, I found a filter mentioned in the documentation named infinite_scroll_has_footer_widgets designed expressly for more complex logic. This is perfect, I thought. Surely this could be as easy as hooking the is_front_page() callback to the filter (i.e. add_filter( 'infinite_scroll_has_footer_widgets', 'is_front_page' )). Nope; this filter is also evaluated before the template conditionals know where we are on the site. Foiled again!

Ah ha! There’s a filter named infinite_scroll_settings we can override! Nope, this is run too early, too.

Finally, Ben Gillbanks (@BinaryMoon) came to my rescue:

He was exactly right. The filter infinite_scroll_js_settings, designed for altering the settings just before they’re passed into JavaScript, works because its parent function is hooked to wp_footer.

Thanks Ben!

If you’ve got a more appropriate filter or an even better solution, I’d love to hear it!

Serve Missing Media from a Production Server via Apache/Nginx

When working on a website locally, it can become quite tedious to pull down all media from a production environment – particularly if you just need to spot-check one or two key areas. In some cases, the production sites I work with have media folders that are more than 1GB (!!) in size. In fact, it’s not entirely uncommon for a large site with a lot of history.

Several months ago I saw someone tweet a simple solution to this, but I didn’t take note of the URL anywhere and it quickly slipped into the ether. Googling for phrases like “apache redirect missing images to production server” or “serve missing images from remote server using apache” or “display live site images on development site” yielded unproductive results.

Then, today, while wishing once again for a solution to my dilemma, I found it!

To save others (and my future self) the struggle of trying to find this solution, I’m documenting it here.

In both of my examples below, make sure you swap for your production server’s URL. And note that these snippets expect the URL structure to be the same between servers (they should be, if you’re working with a true staging copy of a production environment).

Here’s how to tell Apache to serve missing files via remote server:


Note: If you’re working with WordPress, make sure this directive appears before the WordPress-generated rewrite rules in your .htaccess file. Otherwise, WP will catch the missing file URL and route it to a 404 internally.

And, here’s how to tell nginx the same thing:


How about as a WordPress plugin?

You’re in luck! If you’re using WordPress and you’d prefer to slurp up those missing images (so you’re not always dependent on a remote server), you can use the plugin Uploads By Proxy. This plugin will fetch each missing image from the remote server and load it into your local uploads directory for future use. For my use cases, though, I just wanted to see the images on my staging site, not actually copy them and eat disk space.


Becoming a Better Developer: Week 1 Review

This past week has been absolutely packed with new knowledge. I’ve distilled it as best I can for now. I hope future travellers will benefit from this as much as I have.

Getting Started

This past week I read the first four chapters of Clean Code and several relevant blog articles:

Then, on Saturday, I attended the WordPress and Backbone.js session at

I’ll talk about each of these in turn below.

Clean Code, Chapter 1 – Clean Code

Honesty in small things is not a small thing.

This is the omen that kicks off the book, actually belonging to the foreword rather than the first chapter. I really appreciate this quote, much as the author does, because I value the small, the finite, the detailed. Small things matter, and they make all the difference. It reminds me of another quote I greatly enjoy…

It’s always the difference that makes the difference.

Ponder, for a moment, your favorite brands and your favorite experiences. What makes them special? What makes them memorable? I guarantee it’s not their broad generalities. Indeed, it’s their details – their uniqueness from other similar, but different things – that make them special and memorable to you. And, I argue, it is for these very same reasons that the details in your code matter.

It is through practice in the small that professionals gain proficiency and trust for practice in the large.

Attentiveness to detail matters when programming. It means the difference between code that functions properly, and code that brings an entire production site to a halt due to a misspelled variable or missing semi-colon.

A fascinating statistic that the author presents very early in the book is that studies have found “consistent indentation style was one of the most statistically significant indicators of low bug density.”  If you’re lackadaisical about how you’re indenting your code, you’re probably less specific about a lot of other things, too.

Making your code readable is as important as making it executable.

This point, I feel, is paramount to everything else that this book covers. Humans will read your code often – maybe not that one small module tucked away in the recesses of the codebase, or that one-off function you had to hammer out at the end of the day specifically, but by-and-large code that you write will be read again by humans. It will either be read by someone else, or by future-you (which, if time has elapsed more than two weeks, makes future-you as good as a total stranger). What will they think when they read this code? Can they read this code? How frustrated do you feel when you cannot read or understand code that someone else has written?

Have you ever been significantly impeded by bad code?

Where does bad code come from? We run into it often, but why is that? I wager that improper planning, poor time management, and unrealistic expectations are the three most common factors of bad code.

Perhaps you felt that you didn’t have time to do a good job; that your boss would be angry with you if you took the time to clean up your code. Perhaps you were just tired of working on this program and wanted it to be over.

The best way to combat writing bad code is to remember that small things matter and that, ultimately, going slow will lead to working fast.

Working Fast = Working Clean

The only way to make the deadline— the only way to go fast— is to keep the code as clean as possible at all times.

This is a phrase I want to have enlarged, bolded, italicised, highlighted, underlined, and framed. It should be a permanent fixture at the top of every code editor, before the signature line on every contract, and in the footnotes of every email and project communication.

Sloppy code slows everyone down. If may feel faster as you’re writing it, because you’re just flying through line after line as you scramble to complete each function. But think about the gravity of what you’re doing – you’re writing the very lining of your own tomb!

How will you extend that code going forward? How will your code interact with the code of your teammates? How will it respond to the third-party integration you now need to include as part of phase 2? What happens when you or the client uncover a bug – will you even be able to trace it and correct it?

If you want to go fast, if you want to get done quickly, if you want your code to be easy to write, make it easy to read.

An inordinate amount of time is dumped into maintaining bad code. It’s an alarmingly and depressingly large statistic. Don’t burn away hours of your future because you couldn’t spare a few moments in the present.

Incremental Improvements beat No improvements

Try and leave this world a little better than you found it… — Robert Stephenson Smyth Baden-Powell

The next time you sift through a project, take some time to change code for the better. To quote the author once more, “Improve a variable name, break apart a function that is doing too much, see if you can’t eliminate one small bit of duplication…”

Clean Code, Chapter 2 – Meaningful Names

One difference between a smart programmer and a professional programmer is that the professional understands that clarity is king. Professionals use their powers for good and write code that others can understand.

If you want your code to be understandable to strangers (and I’m including future-you, here), long after you’ve written it, you would do well to choose meaningful names for the things you write. Files, classes, functions, and variables should all be named in such a way that they are completely obvious and even pronounceable.

That last word there, pronounceable, isn’t a prerequisite for names that I had fully considered before reading this book. Now it’s a concept I haven’t been able to shake loose from my head. A function or variable that is pronounceable, say, convert_usd_to_eur(), is far, far easier to verbally reference to your coworkers than one named, say, UsdToEurCnv().

A consistent lexicon is a great boon to the programmers who must use your code.

This is a principle I’ve tried to maintain for almost my entire career as a developer. Not strictly for the sake of other developers, but for myself, too. Using a consistent, predictable naming pattern makes it very easy to correctly guess what something is likely named within a project. If you take no other tips away from this chapter, let it be this one: name things consistently!

Shorter names are generally better than longer ones, so long as they are clear. Add no more context to a name than is necessary.

A long descriptive name is better than a long descriptive comment.

Be concise, but be clear. “Post ID” is better than “The ID of the post”. However, “ID” is not better than “Post ID”. However, while striving for brevity, remember that it’s better for your function or variable name to be descriptive than it is to provide a descriptive comment.

People are afraid of renaming things for fear that some other developers will object.

Don’t be afraid to rename something in this age of “Global Find and Replace”. As the author suggests, you’ll likely surprise someone, but that is far better than the alternative of further cementing a poorly named item in your project.

Clean Code, Chapter 3 – Functions

The first rule of functions is that they should be small. The second rule of functions is that they should be smaller than that.

I love this excerpt, and the paragraph that surrounds it. The author cannot justify his assertion that smaller functions are better, except his four decades of experience in writing functions of all shapes and sizes. The shorter a function is, the easier it is to read, and the smaller the space for bugs to hide.

Your functions should tell a story.

Every function in this program was just two, or three, or four lines long. Each was transparently obvious. Each told a story. And each led you to the next in a compelling order. That’s how short your functions should be!

The program referenced in the quote above did some pretty neat and seemingly advanced stuff, and even still it could be broken down to functions that were an average of four lines long. That’s a pretty lofty goal to aspire towards, but a goal worth achieving nevertheless.

The implications here are that any nested structures currently found in your functions (if and switch statements, iteration loops, etc) are better suited in their own separate functions.

Functions should do one thing. They should do it well. They should do it only.

Functions that do one thing cannot be reasonably divided into sections.

Break apart those large functions! Make sure every function has a single purpose, and remove everything else it’s doing until that purpose is met. It is OK if a function’s sole purpose is to call three other functions, but make sure its name clearly reflects that purpose (e.g. find_and_delete_invalid_subscriptions() – This function is clearly doing two different things because the word “and” appears in its name. If those two things are two different function calls – find_invalid_subscriptions() and delete_invalid_subscriptions() – that’s a-o-fine).

Your function promises to do one thing, but it also does other hidden things. Sometimes it will make unexpected changes to the variables of its own class.

If a function conditionally behaves in multiple different ways, or it modifies something outside of the scope of its single, solitary purpose, its doing too much. Refactor that function in such a way that it does its one obvious purpose, and put the other bits into a separate function.

Functions should either do something or answer something, but not both. Either your function should change the state of an object, or it should return some information about that object.

On Function Parameters…

The ideal number of arguments for a function is zero (niladic). Next comes one (monadic), followed closely by two (dyadic). Three arguments (triadic) should be avoided where possible. More than three (polyadic) requires very special justification— and then shouldn’t be used anyway.

This is something I want to explore more in-depth, and I’d wager its worthy of a blog post all its own. I agree that fewer parameters is preferred to many (e.g. $args = array() vs $param1, $param2, $param3, ...), but I’m not so sure how I feel about “zero arguments”. That is something I’ll need more time to explore.

Clean Code, Chapter 4 – Comments

Nothing can be quite so helpful as a well-placed comment. Nothing can clutter up a module more than frivolous dogmatic comments. Nothing can be quite so damaging as an old crufty comment that propagates lies and misinformation.

While reading this chapter I found myself disagreeing with the author quite often. You see, I’ve always found code comments and inline documentation to be tremendously helpful – both while reading and writing code – and he maintains the position that comments are a crutch and too-often clutter up the codebase.

Comments are a great way to get your thoughts down on how you think a function should be written, and what generally needs to happen, in plain English. They’re also a great way to see a quick summary of what a conditional statement may be testing, or a helpful note about why a particular section is written in such an obviously non-optimal way (e.g. “This function checks for [something] in this way because [some other method] isn’t available at runtime”).

After wrestling with many of his points over the weekend, I’m starting to shift my position.

Don’t comment bad code — rewrite it. — Brian W. Kernighan and P. J. Plaugher

[W]hen you find yourself in a position where you need to write a comment, think it through and see whether there isn’t some way to turn the tables and express yourself in code.

Replace the temptation to create noise with the determination to clean your code. You’ll find it makes you a better and happier programmer.

[Good] comments do not make up for bad code.

Clear and expressive code with few comments is far superior to cluttered and complex code with lots of comments.

Most of my struggles throughout this chapter came to an abrupt end when I encountered the above quotes. Prior to this I saw our author as a simple comment hater. When I read, and then re-read these lines, though, I started to evaluate the many ways in which I misused comments in my code.

Don’t waste precious minutes of your limited time on this earth adding comments to poorly-written code. Put those minutes to better use and improve the code. You won’t only be improving your own life, you’ll also be improving the lives of everyone else who will have to interact with that code in the future. You’ll be doing everyone a better favor, too, by improving the code than you will by merely describing it.

Blog Posts – Objects, Singletons, and Dependency Injection, oh my!

I don’t have much commentary to add to the blog articles I read, but I do highly recommend reading them. I’m of the mind that singletons (classes that are designed to be instantiated exactly once) are generally bad and to be avoided, for all the reasons Michael Toppa raises in his article.

I’ve personally been drawn towards using singletons across a number of projects. I liked working within a class structure because of the clean namespace it afforded me. Even as recently as this week I’ve placed code inside of a class that I only intend to instantiate once, globally. I know it’s bad – my awareness of my habitual problems is the entire reason I’ve committed to this 16-week series!

Bonus reading! This weeks serendipitous look at Object-Oriented Programming reminded me of an article I read back in August titled OOP is Not Your Hammer by John Hann.

WordPress and Backbone.js

wpsession6_thumb_pastI don’t think I can say enough good things to fully do this session justice. The three presenters, K.Adam White, Carl Danley, and Zack Tollman each did a phenomenal job in breaking down Backbone and making it approachable, even to a beginner. I’ve had a keen interest in Backbone.js for over a year now, but I just didn’t have the ambition or fortitude to take it on until after watching this session. Now I can’t wait to put it to use. I’ll probably start using it this week, in fact.

If you’re interested in adding structure to your javascript – even if you’ll never actually use Backbone.js – I highly recommend watching WordPress and Backbone.js and learning from the experts. Carl Danley, for example, does a great job guiding how to break apart a project and think about it as discrete, manageable pieces before even laying a line of code.

In Conclusion

To conclude this past week’s study, I leave you with a quote from the end of the Foreword to Clean Code:

Learning to write clean code is hard work. It requires more than just the knowledge of principles and patterns. You must sweat over it. You must practice it yourself, and watch yourself fail. You must watch others practice it and fail.

But never forget that your real goal is to tell the story of the system, and that the functions you write need to fit cleanly together into a clear and precise language to help you with that telling.

We are in for a long haul. This work will not be easy, but it will be worth it. Everything else builds from this foundation, so it is important that we get it right.

Next Week

Over the next week, starting today, I’ll be reading chapters 5-8 of Clean Code.

Are you keeping up? I’d love to hear your thoughts on any insight you’ve gained or any of the commentary I’ve added above. Leave some feedback in the comments!

Becoming a Better Developer: Week 1 Schedule

This week marks the beginning of my 16 week “Becoming a Better Developer” course.

Starting today I’ll be reading the first four chapters of Clean Code:

  1. Clean Code
  2. Meaningful Names
  3. Functions

I’ve looked ahead, and I’m really excited by some of the excerpts I’ve read. I’m particularly enthused by Uncle Bob’s strong emphasis on short, uni-tasking functions and using meaningful, descriptive, and pronounceable names. Just following those two pieces of advice alone can dramatically improve anyone’s code.

I’ll report back on Friday with my key take-aways and highlights.

Have you read this book? What am I in for? Please let me know in the comments!

Becoming a Better Developer

As I stated last week, for the next four months I’m putting myself through code school.

Objective and Plan

In order to do this right, I’ve outlined a 16 week plan that has me reading 5 books and recording what I’m learning. Every Monday I’ll write about the chapters I intend to read and what I expect to learn, and every Friday I’ll write about what I actually learned along with key take-aways. I think it would be great if you were to follow along every week and share your experiences in the comments. I could certainly use the encouragement, and I’m sure you can benefit by learning something new (or being reminded of something they forgot), too.

My main objective is simply to become a better developer. I realize this is largely an unquantifiable intangible, but I know that I (and anyone else following along) will become demonstrably better for putting forth the effort. I can say this with certainty because I’ve never heard of anyone getting worse – or remaining stagnant – after investing sixteen weeks of effort into a sole area of focus.

Demonstrable improvement may surface in any one of the following ways:

  • Increased expedience in solving complicated problems
  • Better solutions to existing problems
  • Cleaner, simpler, human-readable code
  • Improved architecture across the entirety of a given project
  • Code that is easier to test, debug, and extend
  • Jealous co-workers, friends, acquaintances, and arch-nemeses.

Required Reading

Below are the six books I intend to read, in order, over the next 16 weeks. I’ve linked to the kindle edition of each (not affiliate links), and have included the current price on Amazon. You’re welcome to acquire these books however you like.

  1. Clean Code [17 Chapers, 315 pages] – $21.39
  2. The Pragmatic Programmer [8 chapters, 260 pages] – $22.99
  3. Design Patterns: Elements of Reusable Object-Oriented Software [6 chapters, 360 pages] – $27.49
  4. Guide to Building Testable Applications in PHP [16 chapters, 68 pages] – $20+
  5. Refactoring: Improving the Design of Existing Code [15 chapters, 413 pages] – $29.99
  6. WordPress Coding Standards Handbooks [4 pages] – $0

Total Investment: $121.87
Total Reading Commitment: 62 chapters, 1,420 pages
Per week: 4 chapters, 88 pages

In addition to the required reading, I’ll also be participating in every session taking place at

If you want more to read, see my post on additional recommended reading for developers.

Learning Goals

My learning goals are pretty fuzzy at the moment. I’ve learned that there is so much that I don’t know that I can’t possibly know what it is I need to learn or how it will benefit me in the future. That’s a very convoluted way of saying, “I want to learn whatever is written in the books I’ll be reading, and I hope it’s all good for me.”

That said, there are a few things I hope to learn (or better understand) by the time I’m done here. Once I’ve concluded the 16 week course I’ll circle back and update this post with a nice concise list of things actually learned. Until then, here are just a few for-instances:

  • Learn and leverage the common best-practice mnemonic devices (e.g. SOLID, DRY, etc.).
  • Understand the merits and best approaches of Test-Driven Development (TDD).
  • How to efficiently refactor crufty code without destroying everything.
  • How to recognize a problem as an identified pattern with a repeatable solution.
  • Better understand the purposes and capabilities of Object Oriented Programming (OOP).
    • Specifically: when to use constants, static, public, private, or protected properties and methods.
    • How to avoid “singletons” and other the many other pitfalls OOP-beginners typically make.
  • Understand and better leverage Model-View-Controller (MVC or MV*)-style architecture.
  • Better understand and implement RESTful practices.
  • And the coding utopia: the best ways to write cleaner, efficient, and more effective code.

Course Schedule

Week 1: Clean Code, Chapters 1–4
Week 2: Clean Code, Chapters 5-8
Week 3: Clean Code, Chapters 9–12
Week 4: Clean Code, Chapters 13–17
Week 5: Pragmatic Programmer, Chapters 1–4
Week 6: Pragmatic Programmer, Chapters 5–8
Week 7: Design Patterns, Chapters 1 & 2
Week 8: Mid-Semester Reflection + WP Developer Handbook
Week 9: Design Patterns, Chapter 3
Week 10: Design Patterns, Chapter 4
Week 11: Design Patterns, Chapter 5
Week 12: Design Patterns, Chapter 6
Week 13: The Grumpy Programmer’s Guide To Building Testable PHP Applications
Week 14: Refactoring, Chapters 1-5
Week 15: Refactoring, Chapters 6-10
Week 16: Refactoring, Chapters 11-15

Join Me?

If you’re at all interested in this, I urge you to follow along. The only real financial commitment is the cost of the books – if you choose to buy them – which is far less cumbersome than a single college credit, I can tell you that much. Join the mailing list or leave a comment below and let me know you’re following along!


Becoming a Better Developer: Precursor

Here are a few posts I’ve read recently that have helped get me in the frame of mind for the semester of learning I’m designing for myself.

Be sure to check out this recommended reading for developers post I put together on Sunday, and the Back to Basics post I published on Monday. On Friday I’ll work on published the list of books I intend to read over the next 4 months and the specific topics I intend to study and write about over that course of time.

Have a great article to recommend that I missed? Leave a comment!