Tips for programming in 5 min segments? [closed]
Asked Answered
O

14

10

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?
Onyx answered 4/8, 2009 at 0:31 Comment(1)
Subjective poll questions should generally be made community wiki.Arleenarlen
S
26

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.

Schafer answered 4/8, 2009 at 0:41 Comment(0)
R
7

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.

Ronen answered 4/8, 2009 at 0:39 Comment(0)
G
6

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

Gujral answered 4/8, 2009 at 0:42 Comment(0)
A
5

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

Arroba answered 4/8, 2009 at 0:34 Comment(0)
A
3

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!

Antler answered 4/8, 2009 at 0:31 Comment(0)
S
3

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.

Sesterce answered 4/8, 2009 at 0:37 Comment(0)
N
2

Learn all the keyboard shortcut keys.

Nonillion answered 4/8, 2009 at 0:34 Comment(0)
S
2

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...

Silverpoint answered 4/8, 2009 at 0:50 Comment(0)
K
2

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.

Kantianism answered 4/8, 2009 at 1:7 Comment(2)
if you are banging out 5 minute solutions to project euler problems other than the first 6-8, you are my hero.Schafer
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.Kantianism
O
1

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.

Onyx answered 4/8, 2009 at 0:31 Comment(0)
O
1

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.

Operetta answered 4/8, 2009 at 0:38 Comment(0)
C
1

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.

Coprology answered 4/8, 2009 at 0:54 Comment(0)
A
0

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.

Alaska answered 4/8, 2009 at 0:31 Comment(0)
R
0

Read a few pages of Code Complete 2

Rustice answered 4/8, 2009 at 0:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.