Hi Ho Silver! Away!

Remember the Lone Ranger? Believe it or not, I actually watched it as a kid. I don’t know why he was called the Lone Ranger, he always seemed to have Tonto - his Indian sidekick with him. Often, I code alone (I thought about rewriting the "I Drink Alone" song to "I Code Alone" but I had only had 1 small cup of coffee when I wrote this) and I’ve been thinking of some "tricks" to help me with my lonely quest.

I work with a lot of distractions with people very close on either side of me and no cubicle walls. That often includes the two talking around me (and me leaning forward or backward depending on their location). So often, to hear myself think .. I’ll put on my headphones and put on some music. That seems to drown out the noise and activity around me. And it is an absolute MUST when I have an incredibly boring task.

Psudo-Code is good
I will often write on paper what I am trying to accomplish it. I remember reading in The Art of Project Management (by Scott Berkun) where the author has a little sign, ‘What are you trying to accomplish?” … and often, I’ll write that at the top of the page then write to figure out what I’m actually trying to do. If I’m having a logic problem, I’ll write my code I’m having problems with in psudo-code (yes, its IS useful post-college) and then try to write it a different way. For example, maybe if I’m not understanding how using this variable as true in my if statement is working, perhaps I should try it as NOT true and see if that makes more sense for this application.

This is a new technique I’ve been using recently. With my recent forays into perl, ruby (looking longingly to Python, which I think will be my next languge crush) I have been learning alot of new techniques, idoms etc. However, when my situation calls for PHP... I will think.. Ok, how would I write this in ruby or perl? I may discover there is a function in another language that does this same thing and even looking at its parameter list and usage of it will give me some solid clues on how to implement similar in PHP. Also sometimes I avoid re-inventing the wheel and look to find any code snippits, I reviewed a few sites in this article.

Time Mangement
I’m reading Time Management for System Administrators (By Thomas A. Limoncelli) (I'm more of an arm-chair sys admin). He suggests making a todo list BEFORE even checking your email. Another thing I think I heard from on PerlCast's interview with Thomas Limoncelli (PerlCast BTW is a great listen, even for PHP programmers), is to set a timer and work on that particular task for 1 hour. Don’t stop to check email, bloglines or the weather (funny how important the weather seems in the middle of a boring task, OMG its RAINING in Tulsa!!).

I think another reason for writing things down on paper, is it gets my eyes off the monitor and not as tempting to click on that new email alert or wander off to a website. And probably a good break for your eyes and wrists as well!

Often, us programmers has MTOWTDI, giving us a variety of ways to do thing...well what is the best way? When I’m faced with a decision like this, I will list out broadly my options. For example: save data in database, csv file or yaml file. Then pick out a few of them and write some psudo-code and requirements for that idea. I’ll do that for a couple of them, write some pros and cons then think about it some more. Then I may ask someone hey, what do you think?? And go from there. Often I’ll sketch these out on paper too,

Rewrite it
I’ve been hacking on some old code that I’m updating, but I think the time has come to just rewrite the dern thing, which I probably should have done quite some time ago. But Live and Learn huh? … Once Keith said to me "Just don't make the same mistake twice!"

I wrote about some of the debugging methods I use in my article Caveman Debugging in PHP. Another one of the ways I like best is to print out the code and spread it on the floor. I even do this at the office. People walk by and say "oooh boy, she's getting serious" You Dern Right I AM! I’ve found some pretty wild bugs this way. I sit and go through each line, I will often use highlighters and connect the if/while/switch statements to their closing brace which helps me to see code that is improperly nested. Though in an ideal world, one most likely does not have an IF statement that spans several pages.

Any techniques you use when you are working alone??

Lots of things

I say lots of things, I'm glad you found something useful in there.

My goal is that - if I'm going to make mistakes - to make all new mistakes whenever I can... no sense repeating the same old ones.

oh thats right

you said something like ...just make sure each mistake is new ...