Blog

Where we discuss our work, thoughts, and process

Stop Being an Automaton and Be a Programmer

Kris is the creator of the Recess, a RESTful, full-stack PHP framework.

Time and happiness are too precious to allow yourself to repeat yourself over and over and over again. Stop repeating yourself. Computers thrive on the mundane and their cycles are cheaper than yours. Leave the mindless stuff to them.

Ever worked on an ad-hoc web project with a small team? The logistics are often painful. Setting up new projects involves everyone tweaking server configurations. The process of switching between projects varies between dev machines and involves a few minutes in context switch. Deploying is a manual, 5 step process. These repetitive tasks enable development but are not development.

We’ve felt the pain and experienced the costs. The obvious cost is time wasted doing things manually: minutes here and minutes there begin to add up. As team size grows the lost productivity grows with it. The not-so-obvious cost is perhaps far more costly: resistance. When there’s friction in setting up a new project on your own machine you resist trying out a co-workers’ work. When there’s friction in moving between two project’s configurations you resist moving between projects. When there’s friction in getting a new machine setup you resist doing secondary development on a laptop. You get the point.

Not only do you waste time doing repeatable tasks but you resist doing repeatable tasks more often.


“Give a computer a fish and you will smell for a day. Teach a computer to fish and you will eat for a lifetime.” ~Ancient Chinese Proverb

It turns out computers are really good at doing boring, repetitive stuff. My New Year’s resolution: Stop stealing their thunder. Hunt and Thomas’ The Pragmatic Programmer put my mind to work on identifying repetitive tasks and automating everything.

So far this has resulted in a company-wide scripting ‘workbench’. This library of bash scripts is shared across all developer machines. The workbench is a collection of scripts that perform common development tasks. The simple ‘command’ level scripts are operating system independent  and can be composed into higher level ‘macro’ scripts. Need to install a new project? Run the project install script that uses the simpler scripts to check out source, configure and restart apache, modify the tcp/ip hosts file, etc.

The script workbench is shared under a git version control system so as any developer adds a new script or improves an existing one those changes are tracked and circulated immediately. Future posts will cover the workbench in more detail but a couple of quick notes on lessons learned thus far:

  • Using MinGW/MSYS makes scripting across Windows/Mac/*nix environments practically painless. Some handy tools (like wget) are missing from MSYS on Windows, but armed with the core Unix utilities as well as ssh/scp (and PuTTy’s plink) and git has been enough to tackle the repetitive tasks we wanted to eliminate.
  • The learning curve for bash scripts and unix tools like sed is not painless but is more rewarding than you may expect. This tutorial was handy when learning how to navigate the cryptic depths of sed. Though the syntax and regular expressions aren’t completely self-revealing, the feeling of automating common conf file manipulations with sed is pure bliss.
  • Automation is an investment. Especially if you’re learning more about how to automate certain tasks or doing it for the first time. Investment a few days to automate a 10 minute process that happens twice a week will not pay off immediately.

“But why should I build a machine that automatically cleans my room? I rarely ever clean it.” 

Some tasks are rarely performed because they’re rarely needed. Other tasks are rarely performed because you rarely want to perform them. There is a value in automating everything, but the most valuable tasks to automate are the tasks you would do a lot more of if only you didn’t have to do them.

“Civilization advances by extending the number of important operations we can perform without thinking.” –Alfred North Whitehead

Invest some time in yourself and your team to automate the processes you do often and the processes you should do more often. Create a system that allows your co-workers to benefit from each other’s investments in automating repetitive tasks. Foster a culture that enables your programmers to act more like programmers and less like automatons.

 

Comments

 Fren's avatar
Fren

I think it's important to keep personal notes or system-wide notes on the manual steps, and then slowly script chunks of them together. Over time you will add more checks and it'll become more thorough, and probably have more features. Not sure if this is the best approach but in the end it probably ends up as a fairly large, reasonably well structured system. Unless I'm doing it wrong this seems to demonstrate the non-trivial task it was in the first place.

Curtis's avatar
Curtis

"Ancient Chinese Proverb"??

:) Computer is invented in Ancient China?

Anyway, nice article, thanks~

Leave a comment

Real Time Web Analytics