views:

4345

answers:

53

How do you keep your mind from racing late into the night, thinking about programming problems, keeping you awake? My sleeping disorder / computer addiction has impacted my personal life in a very negative way and I'm having a hard time doing anything about it.

Taking pills won't help because part of me wants to stay awake. I keep on telling myself "just 5 more minutes and I'll figure this out", but this goes on for hours.

Has anyone else experienced the same thing? How do you solve it?

+8  A: 

I really enjoy reading before I go to bed. That usually puts me to sleep. Oh ya, and make sure it's not technology related. Read something semi-soothing... a self improvement book, novel, bible?, etc.

JP
This usually works for me too.
Matt Refghi
+34  A: 

I had this problem ( still do occasionally ). The best way I found to cure it is pure willpower. Set a bedtime, mine is 1 hour before I need to be asleep. So by this time I am in bed, lights off just waiting for my mind to cool down.

At first this is hard to do but patterns are very powerful tools.

Oh and keep a pen/paper next to your bed because often enough you will solve the problem by not thinking about it. This will test you the most, you really want to get up and fix it. Don't. Write down the solution and deal with it tomorow.

Brian Paden
David Schmitt
Also +1 for that, but simply because I usually "solve" the problems i've been trying to solve for hours as soon as I'm away from my PC - On the Bus to or from work, in the bed, in a restaurant...
Michael Stum
Also +1 for the pen and paper - with practice you can just about make out your blind scribblings the following morning too!
Andrew
+1 for the pen and paper because everybody else thinks it's cool and I want to appear cool :P
Teifion
It was an afterthought but thinking about it, probably the most important part of what I said.
Brian Paden
+1 because not only does this help you sleep, but it often results in better software design in the end. Sitting at a computer is *not* the place to fix design.
slim
Adam Liss
Artur Carvalho
A: 

Just take it out of your system - program as much as you can for a couple months and then it'll ease for a while. It usually works in cycles for me.

Svet
+18  A: 

Exercise is your friend. Depending on your level of fitness, this could be yoga, walking, running, or lifting weights. Exhaust yourself physically, and your body will do the right thing and put you to sleep. There are also other obvious health benefits of this technique. I must admit that this advice falls in the category of "do what I say, not what I do" - but I'm pretty sure it will work. Worth a try, anyway.

Bruce
cannot agree more.. excercise WILL make you feel better. Every time. Force yourself to do it if necessary, just take a long walk or something. You can think about programming while you're walking! :)
Jeff Atwood
+82  A: 

Here's what you do:

  • Do not touch a computer after 7PM. Don't watch TV late into the night either. Read a book or magazine, work a puzzle - stay away from the TV and PC.
  • Exercise regularly. Doesn't have to be intense but do something. Try a 1-2 mile walk every other evening. It will do wonders for you.
  • Try to figure your sleeping rhythm out. Every 90 minutes or so, there's this moment where you feel extra tired. Identify the hour in the late evening when this happens, which should be fairly regular, and try to be in bed 15 minutes before that time.
  • No caffeine. In fact, try not to eat 3 hours before bed.

Do these things and you will sleep better.

swilc0x
Easy there. No caffeine!?!A caffeine ban three hours before bedtime is sufficient for me.
slim
I notice a total caffeine ban improves my sleep even compared to a single morning coffee a day. Even a beer with dinner seems to wreck my sleep a little. Still...
Nat
!Caffeine for me starts at 5-6PM
BCS
@Nat, one or two beers and I'm out like a light.
Simucal
Mike Rosenblum
I quit caffeine (except for whatever one finds in a chocolate chip cookie or the equivalent) and it has been delightful. You must get good sleep though, which for me is the hardest part - going to bed. Otherwise, a caffeine free lifestyle is so much better.
EnocNRoll
Oh, it has be 76 days since I quit caffeine. On certain days I find it a bit of a struggle, but I do not find myself reaching for it, probably because it's the hardest thing I have had to ever do and I don't feel like failing it. I also keep a spreadsheet to log my work time and records like this.
EnocNRoll
Some stuff about coffee: http://amazinghealth.org/americas-no1-drug-problem-coffee.html
Svish
A full belly does help you sleep, because your body is digesting the food which actually burns calories thus working your system and in turn makes you tired. That's why babies tend to have a nap after eating. On the other hand, food gives you energy too, so once that part is over, the energy can kick in and keep you awake.
Kezzer
no pc after 7 and no caffeine mate? bleh, might as well change profession...
Andreas Grech
I think I'd become a marathon runner before I gave up using my PC after 7pm.
Brian Ortiz
+1  A: 

The problem is not that you can't sleep, but that you conform to the social norms of sleep :)

Work when you feel creative, sleep only when you're tired. I find I'm much more productive this way.

Of course, this only works well if you're a freelancer or work for yourself. The 9-5 gang can't follow this advice.

For those that can't, look into melatonin.

Subimage
I can understand why this was voted down, but I partially agree with it. I found that my best working time is usually 5-9 and I prefer to sleep from 9-5. Some people just have a different sleep cycle that may not always be compatible with your working hours.
Michael Stum
I used to think this way, but it eventually ruined my life. No joking. You can do this when you're living out of your dad's basement but the second you move in with your partner your whole world will change.
Gili
Gili I live with my girlfriend. She doesn't seem to care. Just depends on the partner you choose :)
Subimage
+1  A: 

Ah a toughie, something many geeks can suffer from.. I often find myself staring at the ceiling or wanting to "just get this bit done"..

  • First of all, GET OFF THE COMPUTER! It's too easy to keep thinking and doing more when it's right there.
  • Have a relaxing hot drink, malt drinks or hot milk are good because they naturally contain chems that make you feel sleepy.
  • Reading can help, especially fiction.. It takes your mind off the programming and will help make you tired.
  • Get used to "clearing your mind".. Close your eyes, listen to relaxing music.. Just STOP thinking! It takes some practice, but once you start to get it, you can refresh yourself quickly.. I recently wrote a blog post on "keeping fresh". Even though the post is actually focused on working more, you may find some points about "doing something else" useful.
Rob Cooper
+2  A: 

You might have bipolar mania... I would see a doctor.

Edit: regarding the comment below... please notice the wording... "You might.." it's not a medical diagnosis!

Talking to a doctor might give you better answers than asking a bunch on techies. I think I have a good point here.

Paul
Why did this get voted down? What if he's right? Sheesh.
MrBoJangles
seems like a big jump to "bipolar mania" to me although seeing a doctor is never bad advice
Jeff Atwood
Yeah, I dunno. Developers. Bipolar mania. Not sure if it is a huge stretch...?
Nat
I think making medical diagnoses on a programming Q-)
kronoz
+1  A: 

Engaging in mentally stimulating activities directly before attempting to sleep is always going to result in problems - the mind will carry on with the work, and the sleep won't come.

You've just got to wean yourself off the rush that problem-solving can provide. The problems will always be there, and a good rush first thing in the morning can replace your coffee.

If you really believe your addiction to problem-solving is an issue, seek out a cognitive therapist - their goal is to help you understand how and why you think the way you do. As soon as you realise why you're gleaning such a rush, you're in a better position to counteract it.

moobaa
+3  A: 

Have a notepad handy by your bed, so if you do have a true "AH HA!" moment, write it down so you don't forget it! Otherwise, I always have to read something - and to avoid getting too caught up in the book, it's usually some old that I've read a lot of before. LOTR, Clancy novel... Bible is always a good one... :)

Sleep is a good thing though - many times a difficult problem has unwound itself while I sleep, and the next morning I look at the code and realize it was something dumb like forgetting a semicolon.

DGM
+3  A: 

First, tell yourself it's time to stop and get ready to go to bed. To stop worrying about "just one more thing", write down what you're doing and what still needs to be done. That way, you can still be on a roll tomorrow after you wake up. Making a list of everything you need to do tomorrow can help you "let go" and think about other things until you need to be working on tech stuff again.

Keep a pen and paper or a recorder next to your bed. Try to stop thinking about the technology related things you've been doing. If one pops into your head with some new ideas, you can write it down. Writing is very cathartic and will make it much easier to think about something new.

Also, turn off any clocks. I heard this suggestion a lot and thought it was BS. But after a move I didn't have a clock anywhere visible from my bed. I found that I fell asleep much easier. You don't have to worry so much about falling asleep if you can't keep track of what time it is.

Martin W
+1  A: 

Moderation is a key concept in my general approach to life, not just programming. You need to understand that anything in excess is probably not good for you and you have to find a balance that work for YOU. Whatever your occupation, you need to be able to master self control and self discipline, and part of that practice is to command your mind to think about a problem, and then do a 'context switch', to be able to let go and turn your attentio to other things (such as sleeping). In the long run if you acquire this control it will let you avoid burnout and other associated problems at work.

What I'd do is to create a schedule and force yourself to stick to it not matter what.

Roman M
+2  A: 

Scott, play with the kids! Read them stories instead of sitting in front of the computer! :P

er, Scott didn't ask the queston
Duncan Smart
+1  A: 

This normally occurs for me if I'm writing code just before I go to bed. If I'm not exhausted then sometimes my brain will wander and I can't fall asleep. Other times working late might affect my dreams and I'll get really bad sleep while I'm working on problems.

The solution for me is to just not do work right before I go to bed. If you "can't" keep away from problem solving before you try to sleep then you probably need help from a professional. Alternatively, you could always set an automated task on your computers which forces them to shut down at, say, 1 AM.

Good luck.

kooshmoose
A: 

I experience the same problem, wish 1 day = 36 hours (lol). I think most programmers have similar issue. I find that regular exercise helps alot. It keeps you in balance and makes you feel more aware of your health. Try to set boundary of your working hours, and stick to it. The most important thing is that you have to be focused and motivated to realy control yourself. I usually use my people surrounds me as my motivation, because every litle thing that I do affects them. Just my 2 cents.

RWendi
+4  A: 

Most of the answers people have posted so far are equivalent to telling a mentally retarded person: "just think harder". Your drive and motivation to stay up late is more likely to be biological in origin rather than intellectually driven.

I would most likely suspect you are suffering from either hypomania or bipolar disorder. Don't scoff at this possibility. It is a disorder that is very common amongst people who do creative work, such as musicians, writers, artists, AND computer programmers.

I'd encourage you to take this seriously and go see a psychiatrist as they can prescribe medications that aren't sleeping pills, but will stabilize you and make your sleep patterns more predictable. Why live another day with this frustration? There are proven solutions. Visit a shrink. Now.

Uh. I think thats a little alarmist. There are fairly reasonable ways to improve sleep before getting psychiatric medication.
Justicle
Bad analogy, considering the rest of the answers here work reasonably well. Also, I'm of the opinion that those types of diagnoses by psychiatrists are questionable, as are the medications they prescribe. Many of these disorders are "voted in" rather than proven. Your urgency in suggesting this approach concerns me.
Syntax Error
+12  A: 

The real root of the problem:

1) Normal human bio cycle is 25h

2) The typical sitting lifestyle of high tech professional creates WAY lesser load on your body then typical hunter-gatherer experience the body is wired too genetically.

3) the highly dynamic / changing setting generated by computer is setting our hunter-gatherer brains are wired to process in very alert and energetic fashion (hunt, search, real time analysis)

Result: Body is NOT tired, brain is high powered, and its 4am already!

Attacking different parts of the equation helps solve it as whole

1) Tire your body. Make plans to actively tire your body during the day. Running, biking, rollerblading, heavy yard work, etc. Amazingly enough even 30-60 min of sports make big difference in going down to sleep the same evening.

2) Melatonin is my friend! So is sominex and unisome. I think melatonin is better since its natural, yet sominxe/unisome are WAY more powerful. If i feel too energized i go sominex, and i take melatonin every other "normal" day.

3) small but valuable addition to melatonin is simple ear plugs available in every store. melatonin pushes your alertness down. ear plugs prevent more triggers from crossing that alertness. melatonin + ear plugs gives you very deep, restful uninterrupted sleep.

4) Climb it down. Its hard to go from full speed to zero, but it simpler to go slowly down in a course of a hour. when i feel its time, i take the pills, then take book, or notepad for design work, or laptop and go to bed. staying in bed with book/laptop is less intensive then full 4-monitor spread. when pills kick in in 30-40 min, all you need to close the lid/book and go to sleep.

5) the point is not about following arbitrary system, the point is in winning. if you feel you ARE in the zone, the code flying and intensity is high - don't break it! its uncommon enough to support it. when you feel you not going to be in the zone tonight/today - take the pill and convert the low returns time into rest and energy for next day.

Do you have a reference for the length of the bio cycle? I'm curious about that.
Scottie T
A: 

Establish objectives and milestones for the work you need to do. You can then decide what needs to be done today, what can be offset for tomorrow onwards.

Y'know, it is like those video games that do not allow you to save the game at any moment you like. You need to reach a "safe point", a milestone, before you can save your progress.

There will be some times, of course, when you simply cannot clear the level properly to reach the safe point. You should then consider abandoning the quest and starting over the next day. I know I have done that many times playing games, and do so similarly with work.

icelava
+24  A: 

Remember this simple fact:

Nobody ever died wishing they could have more time to write code

Programming is just a means to an end, or at best, an enjoyable hobby. There are far more important things in your life; don't miss out on them because you were too busy developing.

Kevin Pang
Hm I'm not sure you're as passionate about coding as a lot of other people here myself included!!
kronoz
Hehe! Do we have a non-believer? "Maaa! where's my pitch-fork?!" ;oP
Andrew
I am passionate about coding, but you have to draw the line somewhere. Family, friends, love, happiness - all come before programming. There are priorities in life and sometimes programmers forget that. If your final words are "if only I had more time to write code", then I stand corrected.
Kevin Pang
My final words would probably be something like those. And being a social outcast helps you stay focused on the really important things, like thinking and programming :-)
RoadWarrior
I've tried staying away from programming - but it didn't workout I just got depressed...
Subtwo
Nobody says to stay away from it, just make sure you have some sort of balance in your life. There's bound to be *something* else that makes you happy other than programming, so make sure you spend some time doing it.
Kevin Pang
+1  A: 

I think the realization that you don't want your life to go on like that is a very good step in the right direction :)

I think to succeed here you need to actually change your life pretty drastically, because you will need a clear cut between work and family life. I can recommend excersize to help you reach this. You have to accept though, that the considerable time you spend on this (I try to do it everyday, at least an hour) is reserved. But it will benefit you in many ways (also possibly high blood pressure) so...

Robse
+2  A: 

I feel reading always helps. I have a huge stack of Calvin and Hobbes that I read before going to bed. I've found that it not only lightens up the mood, but also makes you laugh. What better way to end the day than laughing?

Nikhil Kashyap
+2  A: 

I have the same problem. I find just getting a good book to read or doing some drawing really helps me break away from the PC, or sometimes even just playing a bit of "Wii Fit" to get up and moving can sometimes help me get away from the "all I can think about is computers feeling"

Nathan W
+5  A: 

Gili, you are suffering from stress. It is characterised by elevated levels of adrenaline (i.e. no sleeping). Stress has a number of negative health effects, including you know, early death.

While most of the advice here is good advice, see a doctor or suitable health professional.

Probably best not to ask IT professionals about health problems, particularly those that would not reccomend seeing a doctor as a good idea.

Yes, it is possible to enjoy stress (=excitement), but too much of a good thing...

Nat
A: 

I agree with the suggestion of most people to exercise, specially if it requires your full concentration.

I personally practice Aikido and it keeps my head busy during training. After training my mind is usually clear and I feel that I can solve problems heaps better!

Though sometimes I might get myself trying to figure out some tricky bit that happened during training, and then I end up trying to solve two problems instead. :)

Marcel Tjandraatmadja
+5  A: 
  1. Know you priority. Keep in mind of what is urgent and important first. At 2 a.m. sleep is very urgent important because you need it to be productive on the next day.

  2. Do other things. I believe geek life is not just in front of the computer. Switch to another thing like reading books or watching discovery channel.

  3. Make a TODO list of what need to be done. Not for do it now, mark it as the task that should be done when you are wake up in the next morning.

  4. Take a break regularly. Let say for every 30 minutes, take a walk around the house, look at the sky. You will know there's a life outside the computer.

  5. You need a rest. Enough of what you have accomplished today. You can reward yourself by going to the bed and consider it as a big accomplishment because at last you can stay away from you computer. This can be as a source of motivation on the next day. Remember that you have enough sleep last night and there should be no reason not to be productive on the next day.

rasyadi
+1  A: 

I have a similar problem. I found that the best way to get around it is actually to go out.

Go grab some friends and goto the flicks, a cafe, a bar, a library... Anywhere where accessing a computer is quite difficult.

If your friends are like minded the conversations will often veer towards technology anyway which is where you'll get your tech fix...

Once you come home, chill out... Watch a little TV or read a book. Don't even check email because the danger is that you'll get an email "Can you just look at this..." and it'll start again.

The idea is just avoid the computer.

pobk
A: 

Exercise at least 2 hours before sleeping. Eat at least 3 hours before. If that doesn't work take a good swig of beer or such right before. Not a whole pint or anything, just a minor bit... sometimes it works, sometimes the thinker is going to keep going regardless of what you might need to do, wanting to figure something out is generally much more powerful than simple needs - like sleep.

A: 

Above all don't take the computer/phone to bed. It's not bad per-se, they just keep you awake in ways a book can't. It's probably the light levels from the screen.

Stephen
+1  A: 

Stop running your own business... oh no wait, that one's for me ;-)

But seriously... the stress issue is huge, I've found getting another hobby I really enjoy can help break the cycle. I find tennis really enjoyable and it gets me some exercise and away from the computer.

If you don't enjoy it, then you won't do it, so make sure it's something you enjoy doing away from the computer.

Dan Harper - Leopard CRM
A: 

No caffeine certainly helps.

Finding a different hobby also helps, like photography or painting or sports. So sometimes I just went out and play tennis with my buddies, went home exhausted, took a shower and passed out!

A: 

Create a daily recurring calendar entry telling yourself to go to bed.

Each time it pops up, snooze it for 10 to 15 minutes rather than dismissing it.

The continual popping up/snoozing will help you realize that you didn't solve it in 5 minutes, will help you realize how late it is getting, and will keep reminding you of your intention to go to bed.

Stephen Denne
A: 

There is already lots of good advice here - particularly about reading and cutting down the caffeine. You didn't put your age on your profile - but if you are getting past 30 - you'll find your body is changing and sleep is getting harder (especially true as you get through your mid 40's) I don't turn clock off, but I make sure it's turned away from the bed so I can't see it unless I physically get up to look at it.

The key thing is to be as calm and relaxed as possible. I like to try to "visualize" a calm and relaxing place. My wife and I went to France on our honeymoon - and we went for a walk on a park on a hill overlooking Nice. In one direction there was the view of the city - and the other the Mediterranean. I try to “take myself” there – imagine I’m walking through the park and sitting down at the café. The key thing is to clear your mind.

fuzzbone
A: 

I've had this happen fairly often; although, I find I'm not limited to programming problems. My mind races on any kind of puzzle/challenge that really captures my attention. What I found that works is to go watch TV, something completely different, such as Family Guy. The episode format (30 minutes) keeps me from clock watching, and the submersion into humor (even bad humor) lets my mind stop racing. I then go to bed.

Good luck.

Dan
A: 

Realise that those five minutes will be more effective in the morning after a decent night's sleep. Set your alarm five minutes earlier if you want to. Your mind will be fresher and have been subconsciously running the problem over.

I find using logical arguments with yourself works well as a programmer.

Get into a routine of having at least 30 minutes of AFK before bed. Reading fiction can be very helpful to take your mind off of coding problem.

Garry Shutler
A: 

Perhaps your job isn't challenging you sufficiently. If you are left thinking about programming problems in the evening you may be compensating for having not been sufficiently intellectually stimulated during the day.

I often find myself trying to squeeze as much time as possible out of an evening in order to work on interesting programming problems, reluctantly aware of the fact that I have to move some header on some report + debug some awful legacy code all day tomorrow.

However I think it's good you spend time in your spare time to focus on programming, the best coders are constantly practising and developing themselves. swilc0x, dude, the people that follow that advice about not thinking about programming post-7pm are the kind of developers I don't want to work with, i.e. the 9-5 'it's just a job' brigade.

Kevin Pang - I couldn't disagree more, as I'm sure many others would. I for one might well die hoping I'd written some more code. I'm very passionate about programming, how is that different from the many other passions people have in their lives?

Having said all that I think it's important to solve this problem, and I totally agree with Brian Paden, it's a matter of willpower and just switching everything off and lying there. Eventually your brain will get the message :-)

kronoz
A: 

You need to take control on yourself. I will try to list some points that I have applied successfuly to my self. IMO pills are only hacks, you cannot relay on them to solve your problems. This must be done by your "I".

  1. Belive or not your brain is "like" a computer. You can program it to improve yourself. But you must take care of it! It needs to sleep. Some people needs 6 hours, others 10. In my case between 6 and 8 is fine. You must know how much time is enought to you.
  2. I try to work with computers only by day, but several times i have to work at night (because i love computers or due my work).
  3. Take into account that when you are working with computers you brain is hard working and you aren't perceiving the real world (is like you are in another world). So after the job is done, you should come back to the reality giving a break to your brain, let him gets its common activity. In my case I used to read a book/comic for a while.
  4. Use some kind of timer. I use Minutes (OSX dashboard) to control the time i spend on my work. If i'm playing WoW (World of Warcraft) i try to get into the bed not latter than 4.30am (only during weekends).
  5. Programming is like puzzle solving. I love to solve them, but i should not be thinking on the all the time because it could be insane.
  6. Buy a moleskine notebook (or whatever other brand) and get used to writte down all your thinkings about programming. If you are playing with some programming problem and can't solve it, then writte down where you are and go to sleep. Tomorrow when you awake you can come back to your notes just to refresh your memory (like virtual memory works). Belive or not because your brain has rested he will reward you with the solution.
  7. And of course, go for a walk and take some bears (or your favorite drink) with your friends. May be someone has the solution to your programming problem, who knows?
Gravstar
+8  A: 
Scottie T
The second photo is all the motivation I need to go out and exercise :-)
Justicle
This answer needs more clip art.
Pete
+1  A: 

One word: melatonin.

Gordon Mackie JoanMiro
+1  A: 

I listen to podcasts. Concentrating on the podcast helps to power my brain down and then sleep comes easily, especially if I'm tired.

A: 

Having had the same problem for years I now have a routine:

Always read before I try to sleep, if I am reading some technical book then make sure I have something non-techie to read for a bit afterwards.

Always have milk and honey with biscuits, might sound a bit lame, but I know it helps me and also informs my body that it is time for sleep.

When it comes to turn the light off and actually sleep, if my mind is racing then I focus on one thing, and one thing only, if my mind wanders off then bring it back to the one thing. It has to be quite a narrow subject to avoid getting off the topic, for example a particular class within a module, or one specific design problem. By exhaustively concentrating on the topic I find I fall asleep quite quickly.

That maybe sounds a bit bizarre but after several years of doing it I have found that it works for me, even if I can't remember the solution the following morning!

J16saw
+2  A: 
JBB
A: 

Take up a hobbey of some sort. I play a game of magic or two pretty much every day during lunch, and it works wonders for my concentration; and screwing around with my decks before bed is a good way to unwind.

watchwood
A: 

I've experienced it a few times, generally with dread over something having to be done ASAP and I've spent at least a few days on the point that I'm stuck. Part of a solution is to keep things in perspective: Will the world end if I don't figure out how to do ABC by tomorrow? Why do I feel like I'm obsessed with this puzzle or problem? Those are a couple of things to ponder.

Another tact is to get your body into a routine, e.g. go to bed at 10pm each night for a few weeks. If you can get into a habit, that can also help with some of the sleep and restlessness as your body generally will have cues on when to eat, sleep, etc.

JB King
+1  A: 

Read Power Sleep. It changed my view on sleeping in general and sleeping "disorders" in particular.

As others have pointed out, most sleeping problems are psychological, and this book references a lot of interesting research in the area of sleep. It also contains a lot of practical advice on how to "optimize" your sleeping.

Anders Sandvig
A: 

I'm learning to "Sharpen the saw". Just as a saw works more effectively when you maintain it, so does my brain. When I recognised that I actually solve problems quicker if I sleep on them, then I found it easier to let go and get some sleep.

I also find that taking care of myself properly in other ways helps, too: good food, a proper routine, excercise (still struggling with this one), focusing on other things / people, prayer, meditation etc. all help me.

Kramii
A: 

I used to have the same problems when I worked at home... I know it won't any good to Scott but a couple of cans, or a glass or 2 of wine used to help me

cheeves
A: 

I agree with exercise as part of an answer to this. Biologically, we're designed to a lot of it. Also, we're supposed to (basically) go to sleep at sunset, and wake up at sunrise. Try camping for a week without using any artificial lights, and sure as taxes you'll rapidly take on this sleeping pattern.

For these reasons I would agree with the Melatonin approach and the sunrise lamp alarm. Personally for this, I would try last any suggestions that advocate seeing a western-style medical practitioner. Maybe first see a Traditional Chinese Medicine practitioner or similar; they've been around for thousands of years and are paid when people in the village are well, not when they are sick. I think your final thing to try if nothing else is effective, is to take drugs to change a "disorder". Our ancestors didn't have those things. Maybe try the camping thing for a week and see how you go, huh?

(Part of) my solution was to take up martial arts. Prior to this most of my peer group were technology people, and it was somewhat surprisingly quite a shock to spend time with non-IT people. However I've found that a good experience in itself, although very challenging at times. In fact, I've found coming to understand and relate to the range of people at karate as challenging as the work itself.

After 1-2 hours of workouts and drills, both your mental and physical bodies are exhausted. And with one of the better types of clubs, the culture will incorporate a healthy attitude of self improvement as well.

Just one thing, you have to be careful not to start doing the same thing again, but now with martial arts. I started training at 7pm last night, and didn't leave the dojo until 12:30. Oh well, at least it solved my up-late-at-the-computer behaviour. :)

Jon DellOro
A: 

I think you've already made a big step into calming your addiction. I know a lot of people who are still in denial that they spend too much time on the computer (whether it be games or instant messaging), at least you realize your problems and that is the biggest step for some people. Now that you realize whats wrong with your situation, act upon it. You said you enjoy programming, write yourself a program that pops up every hour or something to annoy you to get fresh air, or go for a walk. Anything that will help you.

John T
+1  A: 

You mention the problem "impacts your personal life," which means you still have one. Have someone distract you from the computer shortly before bedtime. Details are left to the creativity of the reader, but part of the process should include turning the computer off so you'll be less likely to go back to it.


Ok, I confess I don't turn mine off at night, either. At least turn off the monitor; it's powerfully symbolic. :-)

Adam Liss
+1  A: 

The answers already given about avoiding TV and the Computer for a good long while prior to bedtime are excellent advice: A sleep specialist MD I consulted told me that light stimulates the visual cortex and interferes with the brain's natural cyclic shutdown. Other tips included letting your body going into its natural cool-down cycle (avoid a hot tub), stay away from alcohol, read stuff that isn't going to stimulate you -- he liked professional journal articles as opposed to novels. Get up at the same time each morning (Even on weekends).

Leonard
A: 

MY (bad) solution is to program (or read, or whatever) till I'm about to get tired and then go to bed.

The only good part is the part about not going to bed if your not tired and to go to bed if you are. Laying around in bed, not going to sleep doesn't do you any good at all. (just don't go back to programming)

If you are worried about programming soaking up to much of your life, then do something else last thing before bed, hang out with friends at the coffee shop or what not.

BCS
A: 

If you are working toward a large, long-term goal such as releasing a product or building a website, pace yourself. Set realistic milestones so you know when you're on track. That way you know when you can afford to take a break.

If, however, you are obsessively working with no particular goal to achieve, you may need to consider this a medical issue. I didn't address my sleeping issues until I got married. The path I took to resolve my own sleeping problems changed my life.

Dave Swersky
What path did you take?
Gili
Started with sleep studies and CPAP, which I had tried before I got married with little progress. Eventually led to surgery on my nose and throat, which is a fairly extreme step but in my case it made an enormous difference.
Dave Swersky
A: 
  1. Don't use the computer past 7:30. And avoid bright lights. The light emitted from your computer interferes with sleep-inducing chemicals in your head. And also, most people who say they're aren't afraid of the dark really are. Train yourself not to be. Don't use the night light!
  2. Eat whole grain foods, chicken, fruits, and don't skip breakfast. I remember when last year, I couldn't wake up early enough to eat breakfast and I had greasy pizza and hamburgers at lunch with a bunch of junk food and candy on the side. The problem with sugar is that based on the Biological structure, sugar gives you a high amount of energy for a short period of time and suddenly drops down. So you end up more tired.
  3. Early to bed, early to ? :)
  4. When it's time to sleep, close your eyes. If you're not feeling tired, don't watch television. Read! That raises IQ. Ari Bruening, one of the 13 students in the United States who got a perfect score on the Standardized Tests (SATs), said 5 exercise yourself to exhaustion. a standing jog while catching up news on TV is what i do

QUOTE When we were kids, we were expected to read, not to watch TV.