@krammii gave good general advice.
To be more specific on desktop ergonomics :
Chair height : make sure your feet are resting on the floor ; you should be able to slide your hand under your thighs easily
Desk height : arms as close to your body as possible (not extending to reach your keyboard), shoulders rested (take a deep breath), your forearm should rest parallel to your desk, so your desk should be pretty low, lower than elbow height. I'm a short 5"6 (1m65) dude, and this requires a very low desk !
Monitor height : the center/top of your monitor should be at your eye-level (when you are looking straight, not down). This will probably require lifting up your monitor with books/dvds/a box or even better, an adjustable monitor arm.
Monitor distance : you should be able to touch your screen barely with your finger tips, with your arm straight, not bent at all.
Keyboard positioning : your arms should rest as close as possible to your body, shoulders relaxed. Your keyboard should be as close as possible, to not have to extend your arms at all.
Monitor size : get the largest screen you can afford (24" minimum, with at least 1080 resolution), and always make fonts bigger ! I code in Vim with a 17 point font (light colors on dark background). Also, make the font bigger in your terminal.
Don't work (regularly) on a laptop, because you'll break all the rules above : too close to a tiny screen, with tiny fonts, staring down, with a bad back position (leaning forward), and often on a chair and desk that do not match your height ! If you work on a laptop, get an external display, keyboard and a mouse (try a trackball). If you code for a living, invest in the proper setup (40 years later, your body will thank you).
All this is good basic advice every desk worker should know about.
My advice (based on quite some research) is to move as much as possible :
get a standup desk if at all possible (I have a treadmill desk)
no matter what your setup is : take frequent breaks (every hour at least), walk/stretch for a minute (go grab water), play on a balance board. If possible, take breaks outdoor.
There's plenty to read about on the web. A good start here : http://lifehacker.com/5755870/how-to-ergonomically-optimize-your-workspace
2Also useful: get a monitor with a high refresh rate - this reduces tiredness and eyestrain – Rory Alsop – 2013-06-04T17:13:07.787
1Thanks for the reply @Kramii. I am wondering what is the effect of back text on white background? I have seen that is the most common setup on websites, editors etc – mehta – 2013-06-05T04:47:00.750
@mehta: Personally, I find the bright white background quite tiring after a while. In comparison, I find a dark background with green or blue text more restful (I mainly program using Visual Studio and use my own custom theme. It is available on Studio Styles here: http://studiostyl.es/schemes/search?q=kramii). Of course, that won't work for everyone, but by experimenting with different colour schemes I found out what worked well for me.
– Kramii – 2013-06-05T10:16:51.047OK, thats a good finding. I will try that :) – mehta – 2013-06-05T13:13:42.017
Install and run f.luxThis is the most important part of this answer imo! :) – enderland – 2013-06-11T16:52:48.403