Tips for Writing Computer Programs

Part of the Beginning Programming For Dummies Cheat Sheet

When you’re ready to write a computer program, keep these how-to tips on programming in mind so the program you create has clear instructions for the computer to carry out tasks effectively:

  • Use descriptive variable names.

  • Use appropriate data types.

  • Write programs that are easy to read and understand.

  • Use simple algorithms and data structures whenever possible.

  • Comment your program liberally. (Or, as an alternative, make your code so clear and easy to read that you don’t need comments in the first place.)

  • Write modular programs by dividing a large program into several smaller programs that you isolate from one another.

  • Test boundary conditions by giving your program extremely high and extremely low numbers.

  • Choose the right algorithm and data structure for your program.

  • Eliminate all unnecessary instructions or variables.

  • Make your program work first; then worry about optimizing the program to make it smaller and faster. Remember that a slow, bloated program that works is preferable to a small, fast program that doesn’t work.

  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus

SERIES
Beginning Programming For Dummies Cheat Sheet

Advertisement

Inside Dummies.com