views:

347

answers:

11

Looking back at my life and career as a programmer, there are a number of rituals or habits I have developed when it comes to the actual activity of designing and writing software.

My question is: What is the most effective ritual you have that improves your ability to either design or write software? What would you recommend to others that need to develop healthy habits?

My question is not: What do you do to stay sharp and up to date in the field... rather what is it that helps you to focus and consistently perform with excellence. E.g. stretching before and after running.

I do expect varied answers here and no single "one size fits all" answer - I would like to know what works for different people.

+3  A: 

The ritual that has helped me the most is that, when I think the day is over, I sit at my desk for five or ten minutes with my headphones on, either reading or with my eyes closed, think over what I did that day and try to remember if I left anything I'm either going to want to rush back to fix or lose significant work because of.

If I have things I've left undone and only in my head, I make a note of them so that groggy, first-thing-in-the-morning Jekke won't forget to do them.

This has saved me a lot of potentially lost productivity over the years.

Jekke
+2  A: 

Iterate. Through everything, including user interface prototypes, designs, you name it. Never stop after the first run through.

Robert Venables
A: 

Headphones and highly rhythmic music seem to work particularly well to get into the right state for heavy coding. There's a combination of blocking out distractions with the headphones and getting into a type of trance state from the rhythmic music that is particularly productivity-enhancing.

McWafflestix
+9  A: 

Refactoring code after introducing new functionality. I liken it to sweeping the shop floor before moving on to the next thing.

Allain Lalonde
if you are lucky to have enough time to do that properly it's a great thing.
gnomixa
Agreed, thankfully, doing it leads to more easily maintained code, which I find saves me time in the long run. I'm not talking about a complete restructuring of the app, just a cleanup of sorts, breaking large methods into smaller ones, checking names, splitting objects apart if necessary, etc. Nothing too drastic.
Allain Lalonde
+2  A: 

I shut down the computer, leave the room, and go to the kitchen counter with a pen and a white sheet of paper. I dump my thoughts onto the paper and reorganize them in my mind. I then go back to the machine power it on and then proceed to transform the design into working code. The important part is to leave the comp alone.

Here's an article that was published last week on this exact topic.

http://www.itworld.com/development/67857/programming-magic-rituals-and-habits-effective-programmers

Wayne Hartman
+6  A: 

Drinking coffee in the morning. Don't code without it.

JaredPar
Hummmm. Coffffeeee
Luc M
@Luc M, yeah I know. I wrote this, felt my addiction kick and and went to get a refresher cup.
JaredPar
Only in the morning?
Arve Systad
+1  A: 

Talking with other programmers. For me, finding that balance between protecting my own vision and accepting input from others has often dramatically improved the final product.

jmans
A: 

Meditating after a day of coding.

After thinking about code all day and not interacting with people, I can be rude and anti-social, and my mind tends to drift back to code. Meditation helps this.

Kevin Laity
+2  A: 
  • When you think its ready, reread your code as though you're someone else who has never seen it before.
  • Diff your code one last time right before checkin.
  • Always use thorough, detailed commit messages. Next time you have to read them yourself you'll thank yourself.
  • Get a code review. Fresh eyes see things you can't.
Trampas Kirk
A: 

Here are some of my thoughts (in no specific order):

  1. Start typing something more or less right away. Even though it might not have to do with the problem you are solving. Start refactoring some stuff, move around code. Just to get the fingers going.

  2. Drill down to the core of the problem as fast as possible, to get something going. Do not sit and think too long about something.

  3. Compile and test as often as possible. Even the tinyest piece of code will contain bugs if you aren't careful.

  4. Music, music, music. Jazz works for me when I need inspiration. When I have the inspiration and know what to type I turn to music with more tempo to speed up my fingers even more :)

  5. Constantly revisit your code. There's always something that can be improved.

  6. If things are starting to go bad and you can't wrap your head around what's going on, i.e. when you just can't find that bug etc. Do something else! It doesn't matter what it is! Go for a walk, read a book, watch tv, play a game. The brain needs different input. When you come back your brain is in a different state and it will be easier to see things from a different angle.

There's loads more. But those are the most important things for me.

Cheers!

Magnus Skog
#1 is also a great way to solve writer's block
Kevin Laity
+1  A: 
  • Always use source control. Even for small projects I only work on myself. Just git init, git add ., git commit ... Then start coding.
  • Always diff before checkin and remove temporary things.
  • Make sure it builds before checking in.
  • Check in often.
  • Do test builds on a separate checkout.
FeatureCreep