views:

465

answers:

14

I have a laptop and bunch of 5 min segments throughout my day. I used to think this was simply too short a time to do 'anything'. Though with a little practice and a few minor behavioral changes (like unplugging) I have realized that I can get something done in each segment. So now I am reaching out to all you quick-draw-programmers out there for more tips that will let me get something done in the shortest time segment.

  • What did you do?
  • How long do you work?
+2  A: 

Learn all the keyboard shortcut keys.

Lance Roberts
+4  A: 

Read through random posts on SO and learn something new :-)

Ed Swangren
+3  A: 

Boring back story: I was in a similar situation when I had to look after my ten year old sis for a day. While we were waiting for a friend to come over I really wanted to get some features done on a personal project.

I found that playing a ~20 second acoustic bit of music and clearing my head before I wrote anything was really useful, along with spending the first 5 minutes making a threadbare list of things I wanted to complete.

Tarks
+1  A: 

I think the biggest hurdle is knowing what task can fit into 5mins. So the first thing I'd do is break down a bigger piece of work into a bunch of bite sized tasks, each of which will fit into 5mins. That way when you have your spare 5mins, you don't have to context switch to a large problem, then try to work out what needs doing & then try to get something done. Instead you just look at your task/todo list & grab the top item.

Alconja
+7  A: 

Adopt Test Driven Development.

A big cost in task switching is figuring out where you were last.

If you always write the test before you start, it's a no-brainer to pick up where you left off. Run the tests, whatever fails, that's what you do next.

Andrew Shepherd
+22  A: 

Here's an idea: when you have larger chunks of time, write some unit tests for functionality you plan to implement. Then, when you have a 5 minute increment, choose a test and write code to satisfy it. This way you aren't spending any of your 5 minutes deciding what to work on, you already did that and documented it in the form of unit tests.

And hey, you get TDD and test coverage for free. Bonus.

anthony
A: 

Read a few pages of Code Complete 2

Jason
+4  A: 

Believe it or not, there's a website called Five Minute Videos, and they have a Software section.

http://www.5min.com/Category/Tech/Software

dj_segfault
+2  A: 

I also sometimes program in short bursts, like while waiting for trains. My method is to throw an exception that says 'TODO: Next step is to return a query here'. When I open my laptop, I run the module I'm working on and it blows up, telling me what to so with a stack trace telling me where in the code to start.

Also, don't ever bother closing your IDE...

HoratioCain
ha i never close my IDE
Jason
+1  A: 

Programming involves two processes: thinking about your program, and typing the code into the computer. Try defining everything into small projects that should take no more than ten minutes. If you pre-compute what you want to type in and learn how to type well, you can knock some good work out in 5-10 minutes.

James Thompson
+2  A: 

Project Euler!

Project Euler is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve. Although mathematics will help you arrive at elegant and efficient methods, the use of a computer and programming skills will be required to solve most problems.

http://projecteuler.net/

Also you can read The Daily WTF, 5 minutes worth spent.

Rodrigo
if you are banging out 5 minute solutions to project euler problems other than the first 6-8, you are my hero.
anthony
And solved in brainf*ck!!Seriously, project euler problems are very atomic and can be solved thinking 5 minutes each time (a lot of time indeed!), writing your thoughts in a classic plain text file.
Rodrigo
+1  A: 

I use standby on the laptop instead of Hibernate because it gets me to the IDE faster. I had expected to have battery problems because of this but it seems to work quite well.

Arthur Ulfeldt
+2  A: 

Massive use of TODOs. When you start on a new class (I'm a java programmer), write all the method names, and TODOs instead of code, this usually takes (the infamous) five minutes. Then, when you have your next five, start with chosing a random TODO, and write the code. I prefer doing them in a random order, but you might find that writing all the TODOs in a method first works better, just try:)

As I'm not a full-time programmer, but a student and hobby-hacker, most of my programming is done at home, the library or a cafe. I'll complete one or two TODOs, and surf the web a bit, watch people walking by, order a new coffee or get some snacks from the kitchen.

This propably won't work in a production-setting, but for personal projects it's king!

drRoflol
A: 

I think an answer to another question has a good idea. jalf suggests:

A very simple trick might be to subscribe to the RSS feed for C++ questions here on SO.

A wide range of questions get answered here, on every difficulty level, and they generally get very detailed answers.

It won't replace a good book on C++ of course, but it might be a good way to discover a wide range of concepts, pitfalls and solutions you might not have known about otherwise.

So when you have 5 minutes here & there, check out an RSS of a particular tag in Stack Overflow and read (and answer?) questions.

Pete