What are some techniques you use to concentrate while programming?
-
I find that I can only code efficiently if I am extremely concentrated for several hours at a time. Sometimes it's hard to do this, due to outside factors, food cravings, daydreaming, people, etc. What are some methods, techniques, habits, environments, rules, and tools that you use regularly to get into a mode of pure concentration while coding? (List as many as you find useful) Also, where do you think it's best to work? Home, library, coffee shop, outside? And, what time of day do you work most efficiently?
-
Answer:
When I want to crank out code -- which is not the entire development process -- it's mostly about minimizing distractions. When working at an office: Get into an enclosed area with as few other people as possible and orient myself such that I can't see any movement while I'm facing the computer. If this means facing into a corner, so be it. Other people are able to get a lot done in big open areas with coworkers constantly walking by, but I'm not one of them. When working at home: Keep a different sleep schedule than my wife, who as a non-developer doesn't truly understand how speaking just one innocent-sounding sentence to me, or even just entering the room to get something from a desk drawer, can ruin an entire coding session by breaking my focus. If I'm offset from her by 4 hours or so, that's 4 hours of prime coding time. When at a coffee shop: Enjoy my coffee and then leave. Writing code in that kind of environment is a complete non-possibility for me. In general: Temporarily edit hosts file to prevent access to sites like Reddit, Facebook, and (yes) Quora. While I enjoy all those sites, it's too easy to "take a break" and suddenly find that an hour or two has passed. I can't close down my web browser or disconnect from the Internet because I need to look up APIs and such, but I can at least make it less easy to dive into my most frequent time sinks. When I actually do need a break, I can get up and walk around a little, which is good for my health anyway. Keep a list of small incremental goals that can be finished in 30 minutes or less. Some people use systems like the . The important thing is to have something specific and achievable to focus on rather than just a general notion that there's a lot of stuff to do. On that topic, a bit of an aside: Tools like can be helpful for this, but frankly I usually just use a text file or greppable comments in the code to keep a list of these micro-goals, in part because it gives me the freedom to write them up using shorthand that may make zero sense to anyone but me. I've found that when I write tasks out in clear detail such that other people could pick them up, I tend to not bother writing as many small tasks down because it takes too much effort relative to the task size: an item like "hks esc" is enough to jog my memory as long as I get to it within a day or two and takes little enough time that I can write it down while remaining completely focused on the code, but writing it out as, "Modify handleKeystroke to dismiss the country selector when the user hits Esc" requires enough cognitive power to break my flow. But I may do the latter anyway depending on the project's collaboration style. Get my surroundings as quiet as possible -- close doors and windows if any, put noisy computer hardware in a closet rather than on my desk, turn off my cell phone ringer (or even the entire phone). Some people listen to music while coding, but personally I only do that if it's the only available means to drown out environmental noise. When I do use music, it's instrumental-only without a lot of sudden changes in volume level. Lyrics or sudden crescendos will pull my attention away from the code. As for times of day, this definitely varies from person to person. I am most productive in the morning and at night, least productive during the middle of the day. But I am productive in different ways at different times: in the morning I am better at "grunt work" kinds of coding (I know what I need to do and how to do it, the code just doesn't exist yet) and in the evening I am better at problem-solving. You need both, so on a given project I'll tend to alternate between doing most of my work first thing after getting up and doing most of my work in the hours before I go to bed. That's what works for me. Maybe none of it will work for you, but it's an additional few points of data, anyway.
Steven Grimm at Quora Visit the source
Other answers
Music is very useful for entering the so-called "flow state", especially if it's a kind of music you enjoy and are familiar with. I like using headphones (as opposed to ear buds) because they also block out environmental noises. I do all my coding at work, so my environment is somewhat determined for me already, but I make sure that I have a medium level of lighting. That is, not overhead fluorescents, but rather a lamp of some kind providing indirect light. Natural light is even better, at least when the sun is not shining directly on to your desk. Face away from an area where someone or something is likely to enter your field of view. Steven Grimm's comment about a single sentence being able to derail you is exactly right btw. Also resist the urge to surf the internet (advice I'm not following at the moment...) between compiles. Even if you're just staring at a progress bar for a minute, it will keep you focused on the task. Losing focus can cost you 10 or 15 minutes trying to re-load your brain with all the things you need to keep in mind while coding. I personally find that I'm the most focused when I'm in the middle of a task and have a limited time remaining to work on it. The "just one more thing..." effect kicks in, though you do need to be careful that you don't get sloppy. I find I get my best work done in the late evenings or late morning. Afternoons are less productive for me, but I think everyone's going to have a different schedule that works for them.
Dan Higdon
Maybe I am not experienced enough to answer this but I'll still give my 2 cents. Whenever I am happy and I am in a good mood my productivity simply doubles on the contrary when there is something bothering me I am hardly able to code even simple problems. So my idea of doing well at programming is to take a break whenever I feel stressed (this may not go well with your dead lines though :p) Also I totally work my ass off when I am feeling good.
Tarun Kumar
I use Self Control for Mac. The only things that distract me are quora and whatsapp. I block my Phone's Mac Address, so as to restrict wi-fi access and I don't have a data plan on my phone, so it works well. Library is the most productive environment for me.
Anonymous
Music without lyrics helps me. I don't code anymore, but when I did that helped. It still helps me focus. Has to be without lyrics. If it has lyrics part of my brain is listening to the words to try to understand them. Also shut down email and put the phone away. Take breaks that don't include surfing the web. Breaks where you step away from the computer or at least look away from the screen.
Kayvaan Ghassemieh
Just plug in to headphone and play the music of your kind and start programming. It would help you a lot and the focus will be either in your laptop or in the music not elsewhere. Plus I would prefer night time for programming even though the time doesnot matter for that.
Sujit Shakya
I use a mix of white noise, ambient noise and soft music to help me concentrate on day-to-day coding. I don't know why or how but I always hit my highest productivity numbers whenever I work listening to John Mayer's Paradise Valley.
Segun Bright
I was facing the same problem which I solved by changing my habits. Try to find out what are the things which is attracting you while you try to concentrate on something. With me whenever I want to concentrate on something I put mobile phone somewhere else so that notification don't attracts me. If I am on laptop I close facebook, gmail and other tabs which can change my focus. Generally human mind can't concentrate on two or three thing together so if you listen to songs or TV sound or anything else you will loose your concentration. Try to seat at place where you find silence which will also help you in concentration. If you are thinking of someone or something is regarding family, friends affecting your thought just talk to them. Hope this helps you.
Urvesh Patel
I work best with some soothing background noise, like the sound of the UPS rhythmically beeping because the battery needs to be replaced. I better get that done...right after I finish this section of code. I can concentrate best first thing in the morning, before my mind gets cluttered with other things that happen throughout the day.
Diane Ulrich
You definitely want to close yourself to the outside world. How you do this is up to you. I use headphones playing metal music. Most of the time I'm not even listening to the music. The music helps block out all the sounds and distractions from the environment. This is also the reason I choose to code mostly during the night when most people are sleeping. Also try and have everything you need right by you. Like your phone, water, drinks, snacks. So you don't have to get up. But remember to take breaks as well.
Abdurahman Brown
Related Q & A:
- What are promotional techniques working best for you and why?Best solution by Yahoo! Answers
- What are the techniques of sale?Best solution by conversionchamp.com
- What are the techniques of Trade sales promotion?Best solution by Yahoo! Answers
- What are the techniques of Consumer sales promotion?Best solution by Yahoo! Answers
- What are some techniques on burping loudly?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.