While I don't work in a cubicle, I do have my own office. So it's sort of like a cubicle, just bigger and better. Here is what I have found:
First, as others have mentioned, lighting can work wonders. The overhead lights (florescent) are about the worst thing you can use in an office environment with computers. On the other hand, too little light can be just as bad. I had a floor lamp (one of the ones that opens up toward the ceiling) that had a bulb go out, so I temporarily used a small (and very dim) desk lamp. It was about as bad as having too much light. The floor lamp is much better.
Also, here's a few other tips (some have been mentioned previously) that work for me:
Keep background noise and distractions to an absolute minimum. This will do wonders in improving your train of thought.
If you have the luxury of a DOOR for your office (or cubicle) then CLOSE IT. If you do not have a door, install one.:)
Find some good classical music to listen to as you work. If you have an Internet connection at the office, check out my favorite [mostlyclassical.com]. (If you don't, check out the local radio stations.)
Most phone systems have a DND (Do Not Disturb) button on the individual phones. It's there for a reason -- use it. If you don't have a phone in your office, be thankful.
On a similar note, if your phone system has direct dialing from outside (either via DNIS or an automated transfer) only give your extension number to close friends/family that you don't mind interrupting your coding. (Make everyone else go through the operator.) If you DND your phone, they will usually get your voice mail if they dial you direct, but still, if you phone doesn't have DND, this is your second line of defense.
Don't keep your E-Mail client open while you work on other things. I have found that doing so creates a temptation to go read your new mail whenever it comes in.
Minimize any other distractions that you may come across. Encourage people to send E-Mail or leave voice mail when they need something, instead of bothering you personally. Every time you stop and help someone, you have to spend time getting back into the swing of things. (I know this may sound a bit mean, but you do have a job you have to get done, right?)
Depending on your network and/or what type of access you have to things, you may be able to install VNC [att.com] on your machine and then work remotely from home if things get too nasty.
Customize the color configuration of your software. I do as one other person has mentioned here - black backgrounds with white (or gray) text. Most of the time I even turn off the syntax highlighting of my favorite editor [vim.org] when coding.
Anything else that might make you more comfortable and able to be more productive...
Remember this -- you aren't there to look pretty, you are there to do your job. If you need to make modifications to your environment in order to improve your job performance, then it's worth it. I personally wear jeans, a sports shirt, and tennis shoes to work every day. It's a lot easier to work in that than it is to work in dressy clothes.
Also, a lot of what works and doesn't work will depend on the person and possibly the company you are in. Each person has their own needs and what environment works for me may not work for others. YMMV.
Oh, and if your phone system uses standard phones (in other words, no proprietary multiline garbage, your call hold/transfer/conference uses flash hook, and you can use standard Wal-Mart phones on it) then you most likely don't have a DND button. Nortel's Meridian system can have add-on cards to support standard phones, as can many others. Just buy a project box, mount a SPST switch in it, connect one leg of the switch to one leg of a 600 ohm resistor, the other leg of the switch to one side of the phone line, and the remaining leg of the resistor to the other side of the line. When you flip the switch, it puts a 600 ohm load across the line, which is like taking the phone off hook. Instant busy signal.:) (Just make sure it is a standard phone compatible system -- else things can get a bit hairy when you start plugging things in like that.)
Here's what I do ... (Score:5, Informative)
First, as others have mentioned, lighting can work wonders. The overhead lights (florescent) are about the worst thing you can use in an office environment with computers. On the other hand, too little light can be just as bad. I had a floor lamp (one of the ones that opens up toward the ceiling) that had a bulb go out, so I temporarily used a small (and very dim) desk lamp. It was about as bad as having too much light. The floor lamp is much better.
Also, here's a few other tips (some have been mentioned previously) that work for me:
Remember this -- you aren't there to look pretty, you are there to do your job. If you need to make modifications to your environment in order to improve your job performance, then it's worth it. I personally wear jeans, a sports shirt, and tennis shoes to work every day. It's a lot easier to work in that than it is to work in dressy clothes.Also, a lot of what works and doesn't work will depend on the person and possibly the company you are in. Each person has their own needs and what environment works for me may not work for others. YMMV.
Oh, and if your phone system uses standard phones (in other words, no proprietary multiline garbage, your call hold/transfer/conference uses flash hook, and you can use standard Wal-Mart phones on it) then you most likely don't have a DND button. Nortel's Meridian system can have add-on cards to support standard phones, as can many others. Just buy a project box, mount a SPST switch in it, connect one leg of the switch to one leg of a 600 ohm resistor, the other leg of the switch to one side of the phone line, and the remaining leg of the resistor to the other side of the line. When you flip the switch, it puts a 600 ohm load across the line, which is like taking the phone off hook. Instant busy signal. :) (Just make sure it is a standard phone compatible system -- else things can get a bit hairy when you start plugging things in like that.)