My Code Quality Challenge

I have an honest question for you:

“How good is your code?”

It’s a hard question to answer, even for somebody like myself that has been writing code for 20 years or so. There’s a lot of nuance into what makes ‘good code’ and as your career progresses you’ll find that a lot of it comes from a personal perspective as well.

With that in mind, this past January I took part in something that I found surprisingly enlightening, Ben Orenstein’s Code Quality Challenge. It was delivered via a daily email with each day having a new challenge for you to attempt to achieve with your daily codebase(s). The idea was that you’d spend at least 20 minutes each morning working on the day’s challenge, which would range from tooling and knowledge updates to changes to how you actually write your code.

To summarize, I found it surprisingly difficult, even if at first glance the individual challenges seem simple enough. With large, years-old repos there’s a surprising amount of things that can be made better beyond the stuff that you probably fight with every day while doing your job.

Here’s a quick summary of my favourite exercises from the challenge, if you want to explore the rest, unfortunately, there isn’t another cohort of the email delivery planned, but the exercises are on display in the forums.

Update your README

I had thought our app’s README was pretty good, but we were actually missing a few key items:
* Where to ask questions
* Who to get to review PRs
* Where to look at the output of our CI pipeline

Trim the branches / Tidy your open PRs/issues

These were two separate tips, but they’re similar enough that I feel they can be combined easily-enough.

I was surprised by how many branches that were sitting around for PRs that had been merged/closed, or simply were too old to ever consider merging (2 years). If you’re using a tool like Github it’s easy to see which branches are lingering on your master branch (on origin) but the tip itself also offers lots of techniques for cleaning up for your local copies of repos as well.

Extract a compound conditional

The article explains it better than I can do here without blatantly plagiarizing the thing. Even with code that I thought was pretty simple to understand, once I started implementing this concept I noticed code immediately started to read more clearly than it used to. Sometimes it’s the simplest ideas that have the biggest impact 🙂

Nuke TODO comments

I have to admit, this one hurt…

The title says it all, grep your codebase for TODO/FIXME etc. and either fix them then and there, remove the TODO comment, or ensure that it’s actually tracked in whatever work-for-future-you system your organization is using. I pulled the plug on this one at 20 minutes with still 400 comments left to review, but I did set a reminder to revisit the results each week.

Create a bin/setup script

What if instead of all those instructions to get started in your README, you simply had a script that did the majority of the work for you? That’s what this challenge suggests, and it’s highly worth exploring if it works for your project.

Want to try for yourself?

Unfortunately, Ben has at this time decided to not run another cohort of the challenge for the time being. I’m secretly hoping that it’ll come back in the future so that I can send all my coworkers here and unleash these learnings across all our repos.

If that doesn’t happen, the list of exercises is currently available here. Maybe set a weekday reminder for yourself to take a look through a new topic every day? I promise you’ll learn something, and your code couldn’t possibly end up in a worse state after completing even some of these challenges.

What did you think of the challenges? Do you have challenge ideas of your own? What do you do to make sure your repos are in top shape? Let me know in the comments.

Posted by Wally, 0 comments

Known Unknowns?

Recently I tweeted this:

Afterwards I continued to wonder whether coming away from a tech talk with more questions than I started with was a good thing or not. It can certainly shake your confidence and make you feel like you might not know as much as you thought you did about the topic being discussed. 

On the other hand, perhaps the fact that you have questions reflects the simple fact that the speaker simply has a different perspective from your own. Perhaps if you were to talk about what you were working on they’d have as many questions come up as you did. 

There’s so much available to be known these days in the tech world, especially when it comes to the web I feel. As a result, it’s incredibly easy to get discouraged, or to constantly feel the weight of all the things that you know you don’t know. I know I certainly struggle with this. 

I’m not sure what the answer is, but my strategy is going to be to try to be ok with not knowing everything. Maybe it comes with age and maturity, but it’s obvious to me now that aiming to know everything, no matter the topic, is a fool’s errand.

I’ve always been a great consumer of information. Recently though I’ve been trying to shift my focus towards only needing to know enough to take the next few steps I need on my journey. Once I’ve taken those steps I’ll be able to look from that new position of knowledge and experience and know what needs to be known next to keep going. I feel like this will help with overloading myself with information without really figuring out how to apply any of it.  

After all, who cares what you know if you can’t do anything productive with that knowledge?

Posted by Wally, 0 comments

Just shared my list of podcasts for developers

Take a look over to the right, I’ve just shared a new page with my favourite podcasts aimed primarily at developers.  I’ve had this list sitting in a draft form for nearly two years now and I’m not really sure why it’s taken this long to publish it.  Given the amount of time since I first put it together, I ended up having to do a number of edits to the list, both to remove things that are either not being published anymore, or, thankfully, to add some of the awesome things I’ve been listening to lately.

I’d love to get some feedback on this list, or even better, any suggestions you have for other podcasts that I might find interesting but don’t have listed.

Get your earphones ready!

Posted by Wally, 0 comments

What I’ve been up to…

If you’re at all wondering what I’ve been doing the last little while, head over to another site of mine at wallyanderin.com and read all about the Habitat for Humanity trip that my wife and I just return from in Kenya.  It was a great time and Kenya and it’s people are totally amazing.

We have a number of blog posts and pictures up already, with a few more still to come so please check it out.  I’ll be getting back to the technical stuff again soon.

Posted by Wally, 0 comments

The attack of the zombie hard drives

I don’t know what has been going on with the world lately, but being the only computer guy in my close group of friends with an IT support background definitely has it’s down sides.  Since August I have experienced 5 catastrophic hard drive failures.  I wish I could blame them all on one common factor, like bad firmware or something, but I simply cannot.  The drives were of different ages and from a variety of manufacturers and system builders.  Only one of these drives was mine, the rest belonged to friends and family.  Care to take a guess at how many of these drives were backed up?


Luckily for me, my drive that failed was in an external enclosure and was only used for backup anyway.  The rest though, were the main system drives from my friend’s primary PCs.  I was able to get most of the data off of one of them, but the other 3 were completely toast.  Based on the look that shows up on people’s faces when I tell them that I can’t restore any of their pictures or home business files from a failed drive, I might as well be a surgeon informing family of an unfortunate surgical outcome for a family member.  It’s absolutely gut-wrenching.  I don’t wish it on anybody.

I’m a firm believer that if your data does not exist in at least 3 places, it doesn’t exist at all.  Burning DVDs of pictures or copying them to an external hard drive are great, but you need to have a copy OUTSIDE of your home as well.  The method that works for me is that I have an external hard drive that I leave in my desk at work, every other weekend I bring it home and copy my data onto it.  Monday morning I put it back in my desk at the office and I feel much more protected.  Some people like to ‘cloud’ option as well, however with Cogeco having a 60gig per month bandwidth cap, it’ not an option for me (my backup drive is almost 200gigs.)

Really though, I don’t care how you do it, just BACK UP YOUR STUFF!

Posted by Wally, 0 comments