The Programming Process
Processes to write a program
1.) Clearly define what the program is to do; 2.) Visualize the program running in the computer; 3.) Use design tools such as hierarchy chart, flowcharts, or pseudocode to create a model of the program; 4.) Check the model for logical errors; 5.) Type the code, save it, and compile it; 6.) Correct any errors found during compilation. repeat steps 5 and 6 as many times as necessary; 7.) Run the program with test data for input; 8.) Correct any errors found while running the program. Repeat steps 5 through 8 as many times as necessary; 9.) Validate the results of the program.
3.) Use design tools such as hierarchy chart, flowcharts, or pseudocode to create a model of the program;
An hierarchy chart is a diagram that graphically depicts the structure of a program. It has boxes that represents each step in the program. The boxes are connected in a way that illustrates their relationship to one another. A hierarchy chart begins with the overall tasks then refines it into smaller subtasks. Each of subtasks is then refined into even smaller sets of subtasks, until each is small enough to be easily performed. This process is known as top down design. A flowchart is a diagram that shows the logical flow of a program. It is useful tool for planning each operation a program performs and the order in which the operations are to occur. Pseudocode is a cross between human language and a programming language. Although the computer can't understand pseudocode, programmers often find it helpful to write and algorithm in a language that's "almost" a programming language, but still very similar to natural language.
6.) Correct any errors found during compilation. repeat steps 5 and 6 as many times as necessary;
If the compiler reports any errors, they must be corrected. The steps 5 and 6 must be repeated until the program is free of compile-time errors.
Object-Oriented Programming
It is centered on the object., An object is a programming element that contains data and the procedures that operate on the data.It is a self-contained unit. The objects contain, within themselves, both information and the ability to manipulate the information. Operations are carried out on the information in an object by sending the object a message. When an object receives a message instructing it to perform some operation, it carries out the instruction.
4.) Check the model for logical errors;
Logical errors are mistakes that cause the program to produce erroneous results. Once a hierarchy chart, chart, flowchart, or pseudocode model of the program is assembled, it should be checked for these errors. The programmer should trace through the charts or pseudocode, checking the logic of each step. If an error is found, the model can be corrected before the next step is attempted.
5.) Type the code, save it, and compile it;
Once a model of the program has been created, checked, and corrected, the programmer is ready to write source code on the computer. The programmer saves the source code to a file and begins the process of translating it to machine language. During this step, the compiler will find any syntax errors that may exist in the program.
7.) Run the program with test data for input;
Once an executable file is generated, the program is ready to be tested for runtime errors. A runtime error is an error that occurs while the program is running. The are usually logical errors, such as mathematical mistakes. Testing for runtime errors requires that the program be executed with sample of data or sample input. The sample data should be such that the correct output can be predicted. If the program does not produce the correct output, a logical error is present in the program.
Procedural programming
The programmer constructs procedures (or functions). The procedures are collections of programming statements that perform a specific task. The procedures each contain their own variables and commonly share variables with other procedures. procedural programming is centered on the procedure or function.
Programming Process
The programming process consists of several steps which include design, creation, testing, and debugging activities.
8.) Correct any errors found while running the program. Repeat steps 5 through 8 as many times as necessary;
When runtime errors are found in a program, they must be corrected. You must identify the step where the error occurred and determine the cause. Desk-checking is a process that can help locate runtime errors. The term desk-checking means the programmer starts reading the program, or a portion of the program, and steps through each statement. A sheet of paper is often used in this process to jot down the current contents of all variables and sketch what the screen looks like after each output operation. When a variable's contents change, or information is displayed on the screen, this is noted. By stepping through each statement, many errors can be located and corrected. If an error is a result of incorrect logic (such as an improperly stated math formula), you must correct the statement or statements involved in the logic. If an error is due to an incomplete understanding of the program requirements, then you must restate the program purpose and modify the hierarchy and/or flowcharts, pseudocode, and source code. The program must then be saved, recompiled, and retested. This means steps 5 through 8 must be repeated until the program reliably produces satisfactory results.
9.) Validate the results of the program.
When you believe you have corrected all the runtime errors, enter test data and determine whether the program solves the original problem.
1.) Clearly define what the program is to do;
identify the purpose of the program, the information that is to be input, the processing that is to take place, and the desired output.
2.) Visualize the program running in the computer;
try to imagine what the computer screen looks like while the program is running. If it helps, draw pictures of the screen, with sample input and output, at various points in the program. Ask yourself What messages should the program display? What questions should it ask? By addressing these concerns, you will have already determined most of the program's output.