• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 28. Programming CGI Scripts > Planning Your Script

Planning Your Script

Now that you've seen a script's basic structure, you're ready to learn how to plan a script from the ground up:

  1. Take your time defining the program's task. Think it through thoroughly. Write it down and trace the program logic. When you're satisfied that you understand the input, output and the transform process you'll have to do, proceed.

  2. Order a pizza and a good supply of your favorite beverage, lock yourself in for the night, and come out the next day with a finished program. This sounds cute, but it is oddly good advice. Sometimes, it seems as if more bugs stem from interruptions while programming—which cause loss of concentration—than from any other source. And while you're sequestered, don't forget to document your code as you write it.

  3. Test, test, test. Use every browser known to mankind and every sort of input you can think of. Especially test for the situations in which users enter 32KB of data in a 10-byte field (using MAXSIZE within your input tag does not protect you from receiving more input than expected), or they enter control codes where you're expecting plain text.

  4. Document the program as a whole, too—not just the individual steps within it —so that others who have to maintain or adapt your code will understand what you were trying to do.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint