15 Good Programming Habits


1. Before sitting down for coding, you must have formal or a paper-napkin design of the solution to be coded. Never start coding without any design unless the code is trivial one.

2. Good code documentation is as important as good knowledge of a programming language. Write brief logic for each major block of your code as comments in source code file itself. Its good to mention creation and modification dates of your program along-with why modification was required.

3. Maintaining versions of your program is another important task. Some present-day programming tools already have a built-in version management. Whenever you make any change to your program, they save its copy as .bak file.

My approach is to maintain 3 versions of a program. Say, I have a file program.c which is used by other project team members also. I copy this file as program.c.old as backup and make another copy as program.c.wrk where I do modifications. When modifications are successfully compiled, replace program.c with .wrk file.

You can also append a date or some explanation phrase to your program versions like program260505.c or programReadFnWrking.c .

4. If your project contains multiple source files then maintain a README file stating purpose of each source files, data files, intermediate and log files (if any). You may also mention the compilation and execution steps.

5. Ever wondered why your IF statement is not working as it should do. May be your are using single equal i.e. "=" instead of "==" in the condition check. A good approach is to write condition in reverse order. So, your condition should read something like this:

if ( 10==i) .... So, if you put single equal sign by mistake then it will be detected at compilation time only as an error.

6. While using loops and conditional statements, always first put closing braces corresponding opening braces and then write the inner statements i.e.

1) for(int i=0;i





Related News



Personal Tech: Army to use video games for training - Salt Lake Tribune

Personal Tech: Army to use video games for training
Salt Lake Tribune, United States -Dec 1, 2008
It will watch trends in commercial video games and look for technologies that can be used in training -- but it does not plan to compete with the industry. ...

Padlock your personal data - PSU Collegio (subscription)

Padlock your personal data
PSU Collegio (subscription), KS -9 hours ago
Low-tech scams include mail theft, dumpster diving, rummaging through rubbish containing personal information, solicitation and shoulder surfing, ...

10 Things You Can Do to Give Your Computer a "Makeover" - MarketWatch

10 Things You Can Do to Give Your Computer a "Makeover"
MarketWatch -Dec 2, 2008
This according to BluePhone ( www.bluephone.com), the personal tech support hotline and "At Home Help Desk" that helps consumers get maximum value out of ...

Personal Tech: Digital cameras go big on video - Salt Lake Tribune

Personal Tech: Digital cameras go big on video
Salt Lake Tribune, United States -Nov 24, 2008
By Ron Harris AP Writer The holiday season brings good tidings for shutterbugs. Whether you're shopping for someone new to digital cameras or a seasoned ...

First Western Trust Bank Opens New Office in Denver Tech Center - MarketWatch

First Western Trust Bank Opens New Office in Denver Tech Center
MarketWatch -14 hours ago
First Western's new location, at 5460 South Quebec Street, Suite 200, is a full-service office, providing private banking, investment management, personal...

Can Clean Tech Beget ... - InternetNews.com

Can Clean Tech Beget ...
InternetNews.com -19 hours ago
"We found new ways to use personal computers and solve things." Now, he adds, the demand for energy is more, not less. Deninger, speaking at the AlwaysOn ...

Gridiron: Gridiron nation shows no mercy - UW Badger Herald

Seattle Post Intelligencer

Gridiron: Gridiron nation shows no mercy
UW Badger Herald, WI -Dec 3, 2008
He also led the Longhorns to victory over three top 10 opponents before falling to Texas Tech on a last-second pass. While rival quarterback Sam Bradford ...
Behind the scenes of the Bowl Championship SeriesBaylor University The Lariat Online
This computer and pollster give OU the nod over TexasSportingNews.com
LIKE IT IS : Big 12 foolish to let BCS standings break tieArkansas Democrat Gazette
Dallas Morning News - Denver Post
all 2,274 news articles


For Dominique Davis, game time finds new meaning - Boston Herald

Boston Globe

For Dominique Davis, game time finds new meaning
Boston Herald, United States -Dec 3, 2008
Davis has been doing his best to scrounge extra tickets from teammates who won’t be using their personal allotment of six. “I think I’ve got the whole city ...
Wisconsin, Virginia Tech set for Kohl Center ‘Challenge’UW Badger Herald
(18) Boston College (9-3) vs. Virginia Tech (8-4)IdahoStatesman.com
all 260 news articles

Cancer-stricken swimmer on comeback trail - International Herald Tribune

Cancer-stricken swimmer on comeback trail
International Herald Tribune, France -5 hours ago
Shanteau finished second to Olympic gold medalist Ryan Lochte in the 200-yard individual medley, beating his personal best when he touched in 1 minute, ...

AMD lowers revenue target, cites weak demand - MarketWatch

AFP

AMD lowers revenue target, cites weak demand
MarketWatch -9 hours ago
... said AMD's move highlights the softening tech market, particularly for PCs. Intel and AMD are the top makers of microprocessors for personal computers. ...
Three local tech companies lower earnings forecastsAustin American-Statesman
AMD Warns of a Revenue ShortfallBusinessWeek
all 205 news articles