I love programming. I can truly say that of all the things I enjoy, I enjoy programming the most. There’s nothing quite like the feeling you get when you create something. Writing code is a lot like building your own little universe.
When you build stuff, you’re in complete control, and, no matter how hard you fight it, your code directly reflects yourself. If you write sloppy code, I can almost guarantee you’ll be a sloppy person. If you haphazardly throw code around with any care or passion, it’s likely you treat yourself the same way.
I tend to think of myself as a passionate programmer (subsequently, this is one of the best books I’ve ever read). When I’m building things, I do so with a lot of care. I like to:
- Take my time, and not rush myself.
- Maintain 100% strict style rules across the code base. I’m a style Nazi.
- Ruthlessly refactor old or ugly code.
- Put a lot of thought into the APIs available, and think of ways to minimize or get rid of them all together.
- Keep a single, clear, and minimalistic purpose for the project.
I try to make every piece of code I touch a bit more like me (for better or worse). With the above in mind, here’s my method for programming stuff.
Step 1 - Isolate
I work best in complete isolation (excluding the companionship of my dog, Scribbles). I find that when I’m completely alone, with no distractions, I’m able to really get into the proper mood for building things.
Being alone gives me a lot of confidence. If you’re by yourself, you have absolutely nothing to lose working on that funky feature branch that will probably never work out, or attempting to refactor an enormous method that you later realize was written that way for a very important reason. When you’re by yourself, there is nothing to be embarrassed about. You have complete creative freedom to try new things without consequence.
Maybe it’s because I’m deeply anti-social at my core, but for some reason, I’m just not myself around other people. As (odd?) as that may be, being around other people seems to really drain my energy and sap my creativeness. Despite my best efforts, I just don’t have the same energy around other people as I do by myself. When I’m isolated, I have an enormous amount of mental energy that I just can’t help but use in creative endeavors.
I find that while alone, I’m able to make better use of available information. For instance, when I’m working with other people (physically), I tend not to use information resources as much. I won’t google things, or read articles about the topics I’m working on. When alone, I tend to spend much more time researching relevant information, best practices, and learning skills that can help me do what needs to be done.
Step 2 - Eliminate
When it’s time to really build things, the second thing I do is eliminate all unnecessary information. This includes:
- Closing all browser tabs and starting fresh.
- Closing all terminal sessions.
- Closing all IM conversations.
- Moving everything off my desk.
With everything out of the way, I’m able to easily focus on programming things. The code almost flows out naturally when nothing else is in the way, stopping it.
THOUGHT: Maybe we’re all meant to be programmers, and our environment is simply stopping us from coding. In this case, it is our duty to eliminate all distractions and return to our natural state!
Step 3 - Code Ruthlessly
Coding ruthlessly is something I strongly believe in. I think that of all the things I’ve learned over the years, this has been the most important.
There is no room in this world for fear while programming. As a programmer, you have to be courageous, bold, fearless, and ruthless. If you can’t bring yourself to remove legacy code because you may need it later, you’ve failed. Whenever I feel hesitation while programming, I make a mental note to seriously reconsider what I’m doing. If it makes me feel uncomfortable, there’s a good chance I need to do that shit right away.
Being ruthless with your code means you make commits that fix whitespace, fix indentation, remove entire source files, deprecate API calls, and drastically change functionality–whatever needs to be done, you do it without a bit of regret.
There have been countless times that I’ve worked on code for a week or two, just to realize I went off on a tangent and completely strayed from the main objective. In times like this, the only thing to do is remove everything and move on. There is no room for ego in success.