So it's dark and you're on some back road driving like you own a light cycle. You come around a corner at blazing speeds and wham! You get hit with light from some on coming drivers high beams.
Given that you had yours on as well you quickly switch to low beams, just as your road comrade does the same. You pass the other driver knowing that he's giving you the approving nod of good road citizenship because you respected the shared space the two of you where in.
The unspoken rule of quickly switching to low beams to show your common man respect and to play it safe isn't a new idea. I sometimes wonder if two horse-drawn carriages were approaching each other, was it an expectation of the horseman that each would dim their lamps as to not blind the other with the shearing light of a 1x candle (I have a long commute into work)?
I also wonder, more appropriately, what unspoken road rules should I be following as a developer to show my fellow committer respect or what things can I do that will help them safely stay on the road? Here are my top five:
1 Respect the road - be a Boyscout not a Zealot
When I was a boyscout I was constantly told: "Leave the campsite in better shape than you found it." We also had moments where we'd setup camp leave to go do boy-scouty things and come back and the leaders had changed the camp around completely leaving us all to wonder where our tents were. There is a difference between cleaning up and rewriting and there is an appropriate time for each. Working effectively with legacy code
2 Pull over to help someone change a flat
If you see someone struggling with code (especially code you wrote) stop and help them. It is a certainty that you will need the same some day and there is no telling what things you'll learn by paring up. How to pair program
3 Stay out of the bus and bike lanes
Not that you cannot cross through those lanes but if someone is preparing for a release or trying to solve an issue in a section of code stay out of the branch that they are in unless you're helping out (see above). Pushing code on top of something that is in "gold" or that is in an unstable state will just frustrate your code comrades
4 Cover your trailers
You ever been driving behind a truck or trailer and something comes flying out - you swerve, freak out and cause collateral damage. We all have technical debt, it happens. When creating new code make sure its covered; when changing legacy code make sure your changes are covered. The idea is simple: cover your code with tests - you'll appreciate it and so will you're road buddies. If you aren't familiar with code coverage / testing checkout this quick tutorial to help get you started.
5 Maintain your car
Have you ever been behind that car that is leaking something or that is providing a spy-like smoke screen because it's burning oil? Are you that car? Just like you maintain your car machine you have to maintain your code machine. Make sure to factor into your estimates or code-thoughts some re-factor time. Think of it this way, if you are not refactoring your code or you can't think of better ways to do what you have done - you might not be learning anything. The fact is that there is no such thing as the holy-grail pattern; with every new framework or language or protocol there is often a "better way" or a more efficient approach. If you are afraid of changing legacy code, imagine what your manager or customers must think - maintain your car.
These are my top five "respect the road" rules - what are yours?