Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I find it fairly simple keep focused on a task at hand whilst I am actively engaged on it, however, during a long compile (and our current main project can compile in 5-10 mintues on a bad day) that my focus will drift.

I'll start procrastinating, check the web, talk to someone, start thinking about something else, and just generally lose my attention, and realise that the compile had finished a while back and I have lost my train of thought, or worse, a lot of time.

This is hurting my productivity, and whilst it has not been mentioned by anyone, I think it's a habit I should stop. I have tried white-noise generators (brilliant whilst I have something to focus on), shutting down my web connection and the like, however, through long compiles what can I do rather than stare at the monitor?

What tricks or tips can be used to keep focused without spending large amounts of your day starting at a compile in boredom, just to ensure you don't miss it finishing?

Hang on, my build broke 10 minutes ago ... :)

Finally, I am fairly sure this question isn't a dup of this, as as I am talking specifically about compile times, rather than waining motivation. Foosball is not an option, rather the problem :)

EDIT People trying to gloat about their language of choice compiling faster are not really helping, nor being particularly amusing. Thanks anyway.

share|improve this question
    
Wow. Guess I'm not the only one. XD Nothing gets me out of the zone more than a lengthy compile. –  Jonn Oct 21 '10 at 1:42
1  
My team is working in python. So I don't have that problem... for now =] –  Falmarri Oct 21 '10 at 1:47
    
Or a long test run: a test run that takes only a minute can ruin one's flow. –  Frank Shearar Oct 21 '10 at 5:42
    
What is with all these long compile times. I've worked on some fairly large projects and never had to wait more than a minute for a compile. Are you guys using 286 machines or something, or are you including the time required to run unit tests in the "compile" time? –  JohnFx Oct 21 '10 at 21:52
    
Response to the edit: Removed for diplomacy, but it wasn't a joke or a jab. Your question was basically "How do you guys work around the painful side effects of tool X", to which I feel perfectly justified in responding "I use tool Y for the same purposes; it's just as good in most situations and doesn't have those side effects". –  Inaimathi Oct 22 '10 at 12:41
show 1 more comment

7 Answers

You might want to raise the issue with the project-lead and manager to see if you can collectively come up with a means of either shortening the compile-time or requiring less-frequent compiles.

I've been in a similar situation where the effort required to do basic tasks continued to grow to the point that it was impossible to remain focused and be effective. After a year of trying my best to offer alternatives and suggest changes I hadn't seen much response--and it ultimately led to me changing jobs.

Perhaps more constructively; could you spend the time on related--but non-coding tasks (such as time-accounting, updating ticket-statuses, code-reviews, etc). While they might not address the main issue of you losing your focus they at least keep you up-to-date on the pencil-pushing during a big downtime.


Also, just noticed you mentioned "don't want to miss it finishing". A simple solution is to have an egg timer you can quickly set to 10-minutes; or possibly explore if there's a notification of the build-completing that you can use. For example, if it can send you an email, and you use Outlook, you can create an Outlook rule that says "when mail received from buildserver@example.com with title 'Build Complete' then play sound Alert.wav"

share|improve this answer
    
Nice points, I do like the idea of a 5 - 10 minute 'egg timer'. Maybe I can just start building one whilst the compile is going on ... –  johnc Oct 21 '10 at 1:06
    
I can't get SO and Programmers out of my related non-coding tasks. XD –  Jonn Oct 21 '10 at 1:47
1  
@Jonn if you buy into Spolsky's take on Evidence Based estimates then they are part of your time-on-task :) –  STW Oct 21 '10 at 13:19
    
Wow. That's a great read. –  Jonn Oct 21 '10 at 15:14
add comment

(During a compile) I had an idea of Visual Studio alerting me to an end of compile and found an answer on (of course) Stack Overflow. This will help, at least, to warn me that the build is done.

share|improve this answer
    
Thanks, I actually did that. I can't stand to sit around and do nothing during compiles so now I can browser SO/SE and it alerts me when its done compiling :) –  Rachel Oct 21 '10 at 14:23
add comment

I like to thread my development tasks.

After kicking off a build to test my latest changes on task #1, I'll immediately jump back to the editor and start working on task #2. By the time I'm done with #2, the build for task #1 will be ready for testing. Eventually I'll start a build to test issue #2, giving me time either to return to issue #1, or start on #3 if I'm done with #1.

Obviously this can only work if you can find two tasks such that development in one area shouldn't affect the other. You'll also have to deal with the overhead of switching threads - sometimes it would take me a few seconds to remember which change I was supposed to be testing in the new build.

share|improve this answer
add comment

The biggest problem with a long compile phase is that it lengthens the amount of time in the code-test-fix cycle which breaks flow, increasing development time and decreasing your effectiveness as a developer. The best way to maintain flow in this case is to avoid compiling. To do this you can spend a little extra time before compiling to ensure that when you do compile it will be effective (e.g. waiting even 1 minute to find out you made a syntax error is a waste) and that the code you write will work the first time (because a stupid/simple logic error will cost you an extra 5-10 minutes).

To become more productive you need to alter your development process to reduce errors when it's cheap, in this case before you compile. The Personal Software Process introduces a personal inspection phase before compilation to help accomplish this. So rather than following a code-compile-test-fix cycle you would follow a code-inspect-fix-compile-test-fix cycle. With practice, inspections can be quite effective, and having an effective inspection step will let you get away with compiling less often.

There are other techniques for "defect filtering" used in the PSP, but I've found personal inspection to be one of the most simple, effective, and universally applicable techniques to use.

share|improve this answer
1  
Damn, I knew someone would come up with a 'greater discipline' answer ;p Actually, whilst I think I do that a lot already, that would be a brilliant habit to entrench. It's so tempting at times to let the compiler tell me what I need to work on next, rather than have to think about it. –  johnc Oct 21 '10 at 2:39
add comment

Where I work, a clean compile takes 45 minutes. A squeaky clean compile from scratch takes 4.5 hours. One line changes take about 5-10 minutes each. And this is on a machine that has 32 cores and 128 GB of ram.

How I get around this is to have a separate compilation for my module alone. This also has the added advantage of being more modular, since I will know all the dependencies of the module. Also unit tests give the execution context needed for the module. So I have a ready made unit test framework also. Only after all unit tests pass, will I start compiling with the platform and do integration testing. Compilation time for individual modules are typically within seconds.

share|improve this answer
2  
Jesus! What are you compiling? The Hadron Colider software? –  Mike42 Oct 21 '10 at 23:11
    
Sounds like it's on pair with a Windows compile... –  Note to self - think of a name Oct 22 '10 at 16:22
2  
The Linux kernel for x86 and arm architectures and about 45 products on top of it. Overall it's about 13 million SLOC. One line changes takes so much time just for linking. The software is for an intelligent router. –  aufather Oct 25 '10 at 1:57
add comment

Don't focus, it's the perfect time for a short break, programmers are human and they need rest too, don't they?

share|improve this answer
1  
When you use a test-driven methodology in conjunction with C++ you will find that you get more compiler-ordained breaks than you need or want. –  Konrad Rudolph Oct 21 '10 at 21:36
    
@konrad I haven't done any test-driven development with C++ but still I think i can give a simple suggestion that might help: separate interface(header files) and implementation(source files), that usually happens to reduce compiling time. –  tactoth Oct 22 '10 at 1:15
    
I’m working on a massive header-only library (necessary, since it’s templated) so we can’t have separate compilation units, unfortunately. The library is already heavily modularized so that only the smallest subset necessary will be included, but compilation time is still a bummer. –  Konrad Rudolph Oct 22 '10 at 15:03
    
@Konrad then you might spend the time your code compiles on thinking how to make a better C++ compiler to handle templates. –  tactoth Oct 25 '10 at 6:46
    
a lost cause, I fear: drdobbs.com/blog/archives/2010/08/c_compilation_s.html :-( –  Konrad Rudolph Oct 25 '10 at 6:48
add comment

I don’t. :-( We actually bought swords for the office.1

Still, the following helps:

Immediately start some writing task. You know, that one method you wanted to write documentation for but never got around? There’s one piece of code that badly needs an explanatory comment. Work log needs updating? Now is the time.

It’s very important to find a writing task immediately, otherwise the 10 minutes delay will be too small to get anything done. To help this, I keep a list of “to do” items that is either already opened in the background or can be opened by a single command.

An alternative is littering the code base with TODO Documentation/comment tags. I do this a lot, and by and by these TODOs get replaced. I don’t know if this works for everyone but it works for me.


1 Bokken, actually.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.