Master your tools
January 10, 2017
The Effective Engineer by Edmond Lau has been one of the most influential pieces of literature that I’ve read in the recent years. The book is a guide to becoming the most impactful engineer you could be, and I think it does a wonderful job at emphasizing what you should keep in mind in order to be effective. In this post I want to chat about some of the tools I’ve been learning in order to optimize my productivity.
My primary job right now is being an Android developer for a startup in Denver. Even before reading The Effective Engineer I’ve had an affinity towards the automation. After all, I got into programming to help automate peoples’ servers and to automatically play video games for me. As programmers we have almost unlimited control over any technology. Some technologies might take more effort to control, but they can almost always be controlled.
The first “tool” that I’ve spent time mastering is my text editor vim. Vim is a wonderful program that helps you more gracefully and quickly modify text. Programming in its purest form is typing commands to the computer, so being able to type efficiently is a must have. I’m not telling you to use vim, you can use whatever text editor you want, but I suggest you learn as many of the ins and outs of it as you can. Vim makes it easy to do text transformations and substitutions, but my most commonly used feature are the ways vim lets you navigate text. You can navigate by words, by lines, by screens, by half screens, by white space, by paragraphs, etc. After years of using vim I can do most of these swiftly with little to no mental overhead and it really helps me write code as quickly as possible.
Next I want to talk about learning common command line programs. I use a MacOS computer at work, and I have Ubuntu on my home desktop, so my examples will be biased as such, but Windows and other OSs have alternatives. Like I mentioned above, I mostly only work on an Android app, but I try to dabble in other projects if I can. The other evening someone reported a simple typo in an error message that was being displayed to the user. When it was reported, everyone else was busy, and the person who wrote the code was being unresponsive about which file the typo was in. I was able to use grep and recursively search through that project and found and fixed the typo within a few seconds. Being comfortable on a command line has a lot of other benefits. I’ve had to build libraries for my coworker before because he wasn’t sure how to go about it. Another common case of command line comfort being useful is when your version control isn’t working as expected. This is a great segway into the next tip.
We use git for version control at work, which I’m already comfortable with thanks to previous experience. Some of my coworkers don’t know how to use it from the command line and can actually only push/pull code from the GitHub GUI program, or from within their respective plugins for version control. This is fine for 99% of the time, but if there are merge conflicts, some coworkers don’t really understand how to go about resolving those. In my daily environment I use git for version control, and I use Android Studio as my IDE. (I have a vim bindings plugin for Android Studio so that I can still leverage that experience.) So it makes sense for me to learn about both of these so that I can use them to their potential.
In this episode of the Fragmented Podcast, an engineer from JetBrains talks about how IntelliJ (and so it’s fork Android Studio) has it’s keymap designed in such a way that you never need to use your mouse to do any development. Some of the shortcuts are definitely more useful than other ones. For example, I have ALT+O bound to open a search of classes in my project. ALT+SHIFT+O will let me find a specific file. I’ve saved myself collective hours by being able to zip to a file in under a second, as opposed to opening up the list of files and having to navigate through the directories to find the file to open it. I would suggest that you find something you do 3 or more times in a day and bind it to a hotkey or you can write a script which is the next “tool”!
Scripting is such a powerful asset in the toolbelt of the programmer. For example, our graphic designer has a particular way that he likes to export assets, because it’s the easiest way for him to do it in Sketch. Unfortunately, none of these assets are in a folder structure that’s useful to me, nor are they named in a way that I can even use them. Every time I would want to dump assets from him, it would take me probably up to an hour if not more making sure each file is in the correct folder. If you’re not familiar, Android apps have different folders with copies of the same asset at different pixel densities. This is for adjusting your app to different sized devices. Anyways, I wrote a Python script that would grab all of the assets and place them into their appropriate folders. Not only does this save time, but it’s also much less likely to run into problems. As a human doing mundane and repetitive tasks, it’s easy for me to accidentally rename a file incorrectly or place it into the wrong directory. My script will never get bored of checking for “xxxhdpi” being in the file name.
I have one last but very short example. At my last job we’d have to occassionally audit all the live hosts for their installed version of software. For some reason in the past, someone would have to remotely login to each one of these servers one by one, and fill out a spreadsheet for each piece of software. There was approximately 40 hosts and about 15 pieces of software that needed to be verified. This process would take hours, and would most likely take up the whole day for the person who had to do it. As soon as I found out about this, I read through the instructions for getting each bit of information, and wrote scripts to do all of it. Not only that, but I formatted everything into a CSV that could be opened by Excel. After a couple hours of work on my end, the task of having to painstakingly go through all of these servers went from taking a day to happening in seconds. That was by far the most impactful automation I’ve ever done.
Find the things that you do the most often, and see if you can reduce the time taken to do them. You’d be surprised at what things can be automated entirely if you’re a little persistant. However, with all that being said, only automate the things that you find are taking up too much of your time, and only find tools to augment what you normally do if you do it a lot. I write code for a living so becoming swift at doing that with a powerful text editor made sense. Exporting assets for my app happens a lot and it took less time to write the script than it took to export the assets just once. With all that being said, here are two xkcd comics that are a nice little poke at what I’m talking about.
Thanks for reading