If you blog it they will come?

Sunday, May 16, 2010

My dev environment

I wanted to describe my dev environment and work processes but it wouldn't make sense unless I describe the shape of my work so let me do that first:

Dev Cycle

Our dev cycle is pretty simple: create and checkout a branch associated with a ticket, make changes to that branch, merge it into a master branch, test it on a staging environment, push it live. It's common for a single developer to have several branches in progress at once.

I'm primarily concerned with reading/editing the stack of html/javscript/python/SQL. When I have questions, I lean heavily on log files, ipython, the mysql command line client, git, grep, testify, and a slew of other odds-n-ends. I also run virtual machines, mostly for browser compatibility testing.

In other words there's a set of varied tasks I need to be able to do efficiently and cohesively. Mental "context switching" is expensive so there's value in grouping related work and quarantining anything not immediately relevant. That's the idea, at least, for how I try to manage to complexity of multiple files, branches, documentation, etc. with minimal overhead.

All of this is done using Terminal on a MacBook Pro:



Dev Environment

So the smallest unit is a solitary file, in a lone buffer, in a single tab in vim, .... No file is an island, however, and if I'm doing anything reasonably interesting I'll probably need to view at least 2 files at once.

The next step up then is a vertical split (:vs in vim). If I'm working on a large screen I may split one more time for a grand total of three files sharing the same space. I've got shortcuts mapped in vim so that I can traverse them using Ctrl+H, Ctrl+J, etc.

As I open more files, I start opening tabs (:tabnew). They may stay open, or I may close them again immediately to reduce clutter (I mapped ,tn and ,tc to tab new/close so it's faster to do so).

I may evict existing screen splits and move them into a new tab if it makes life easier. I mapped Ctrl+I and Ctrl+O for navigating through tabs left and right. Again, judicious closing of tabs can make life easier.

Ctags is also useful for navigating, as are other plugins such as NERDTree. I use a few vim plugins; they should be a separate post though.

I am also doing all of this in a screen session. Each branch I'm actively working in will have its own virtual terminal, which I navigate using Ctrl+a. When you return to the original branch you were working in, it'll be just as you left it, and therefore easier to resume.

I'll also use screen to keep separate terminals open for tailing logs, running ipython/bash/sql commands, etc.

Also, all this work is taking place on a remote machine. If I need to work locally or connect to a different machine, I open a new tab in terminal (cmd+T) and proceed from there. I switch terminal tabs using cmd+{ or cmd+}.

The stack tops out with Expose/Spaces. I rarely need to use it extensively but I'll use different spaces for different browsers and running virtual machines. These are navigated using Ctrl+(arrow keys).

Oh, and I also use terminal in transparent mode (the "Pro" color scheme specifically). You can read documentation or examples without turning your head!

Summary

Here's what it looks like in action:



  • 2 files side-by-side

  • 2 other tabs open (the gray tabs on the top)

  • Another active screen session (green bar)

  • Another tab open in Terminal

  • Transparent terminal for readin' docs



the full stack / hotkeys:

vim file < vim split screen < vim tabs < screen vterms < terminal tabs < spaces
n/a < ctrl+h/j/k/l < ctrl + i/o < ctrl+a n/p/# < cmd+{/} < ctrl+(arrow keys)

No comments: