Everyone knows what you have to do to keep your life in balance: Eat healthy, sleep long enough, keep social contacts, don't work long hours, exercise... The trick is cheating yourself into actually doing these things.
Here are a few tricks which help me:
- Treat exercise as a game. I use Nike+ and Wii Fit to cheat me into looking at exercising as a game I play, trying to achieve better scores. Nike+ has the added advantage that you can make your numbers public, so you know that people know when you slack off. Wii Fit is nice because it shows you a graph of your weight, which helps you immediately identify when you're gaining weight. Something else I do is listen to audiobooks only when I'm exercising, so if I want to know how a story continues, I have to go for a run
- Have an ergonomic work place. This is part of exercising. Make sure you sit correctly; get a good chair. Find a way to work while standing. Take regular breaks: go outside for a few minutes each hour.
- Have a landline. Nowadays, tons of people don't have landlines, they only have cell phones. I've had only a cell phone for about 5 years, and I've found that it discourages people from calling you, hurting your social life. In the few months since I've gotten a landline, I've literally had more random calls from friends than in the five years I've had only a cell phone. This really helps get my mind of work, and encourages me to go out, go to parties, or invite friends over.
- Avoid interruptions when working. Programming is an activity you do while "in the flow." Every interruption costs you at least half an hour of "getting back into the flow" time, thus making it harder for you to finish stuff, thus encouraging overtime. I've heard of software companies with a "no interruption day", which is one day each week when people won't ask each other questions, thus allowing developers to have at least one day per week where they get things done. You can also encourage people to ask questions by mail, and then only check mail manually.
- Have a productive work place. Get a second screen. Get the OS you like. Get a good keyboard and mouse. Install the software you like working with.
- Work from home. This may not be possible for everyone, and it may not work for everyone, but if you can, at least try it. It cuts down on interruptions like nothing else. Even if you have a family it's easier to teach them not to interrupt you while you're working than to teach your coworkers. Also, it allows you to work when you're actually ready to work. I typically find that I'm more alert in the morning, so I tend to work early hours and spend the afternoon doing something other than work. It also allows you to exercise when you feel like it, rather than before or after work hours.
- Don't mix life with your work. If you work from home, have a "work room" with a "work computer." Don't do work on your personal computer, and don't do personal stuff on your work computer. Don't give your employer your cell phone number; if he needs to reach you at all times, he should get you a work cell phone. Don't think about work when you're not working, but as soon as you sit in front of your "work computer," concentrate on the task at hand.
- Don't work 100%. You're a developer. You probably earn enough that you can afford to work less than 100%, so why not do it? Even cutting down only 20% gives you one additional day each week to spend with your family, or to work out, or to just go for a walk and enjoy yourself.
- Have your own projects. I've found that only programming "for work" eventually takes the joy out of programming. If you're working on a big enterprise Java app, why not play around with Ruby at home? If you're working on a huge C# application, why not play around with Objective-C at your Mac at home? You'll learn a lot, you'll discover the fun in programming again, and maybe you'll even write the next million-selling iPhone app :-)
- Schedule your sleeping. I put all of my social activity in my calendar, but sleeping is the most important. Not only should you be reminded by an alarm clock to get up in the morning, you should have reminders telling you to go to bed. Simply staying up and working on something is far too easy, and it'll kill you eventually. It's enormously important to get your body to learn when to sleep and when to get up, and this doesn't happen if you don't sleep regularly each day. Yes, I would even encourage people not to sleep in on sundays. If you sleep enough during the week, you won't need to anyways, and if you'll keep a regular sleeping schedule, you'll eventually wake up automatically each day.
- Catch enough sleep. You probably don't sleep enough; also, coffee is not a valid replacement for sleep. Not sleeping enough will start affecting your mental capacity relatively quickly, which makes it harder to get work done, which forces you to work longer, which takes away sleep time, and so on.
- Cook your own food. Eating healthy is easy to say and hard to do. Most restaurant food is crap, so why not cook your own? It's not hard, and it allows you to control what exactly it is that you eat. You can cook the food the way you like it. Also, cooking is fun. It's an engineering activity; you're basically an interpreter for the cookbook bytecode, but you can improve that program if you find bugs. Also, your friends will love you if you become a good cook.
- Use something like GTD. GTD or similar task management systems allow you to get stuff out of your mind. By scheduling everything, you don't have to think about chores which allows you to concentrate on the task at hand.
- Don't think that you owe your employer anything. You work there because you want to, not because you're forced to. Your employer needs you more than you need him. Do the best job that you can, but don't let your work become your life.
These are a few of the things that come to mind. I do all of these, and in my experience, they really help tremendously. Hope this helps!