Felitaur Site
Offerings
|
   
|
[Webscripting Homepage] | [Javascript Homepage] | [Perl/CGI HomePage]
Program Design Concepts
Programs, even "simple" web scripts, can turn out to be fairly complicated
endeavors. Planning and designing a program can save you hours of time in
developing, and "de-bugging" a program.
Some elements of good program design:
- Well documented (use comments! // in javascript)
- Modular (design functions that do a specific job and can be reused)
- Lay out the logic of your program using a flowchart or pseudocode
- Use variable names that make sense and are descriptive
- Don't assume anything about what the user will "know to type"
- Remember that programming languages, especially scripts
- Are sequential (they go down the line by default)
- Have various control functions (decisions, such as if elseif
else)
- Should have one starting point and one stopping point (if
possible)
- Should use variables instead of actual numbers as often as
possible (makes the program more adaptable and readable)
- Should use functions to avoid repetition of code
- Have many predefined functions and keywords that you should
use. Why reinvent the wheel.
- A copy of the CodeLearn Program Design
Course has been ported to felitaur.com with permission granted on the
author's web page www.codelearn.com
Designing Programs:
- Flow Charts
These are a more complicated than psuedocode, but allow you to trace the
flow of the program with much greater ease, and see mistakes that you have
made in logic and flow control
- Pseudocode
This is where you write out in "almost human english" what you want the
program to do, step by step. As you use pseudocode more and more, you'll
note that your pseudocode will start to look more like the actual
programming syntax. :)
|
|