The process goes in cycles. You start with a design, and try to write code to implement that design. As you write the code you may come across problems that send you back to the design stage. Once you have code written you try to compile it. If there are errors or other problems you go back to editing the source code and eventually try again. If your code compiles you try to link it. If that doesn't work you usually have to go back to editing the source code again.
The Programming Process Developing a program involves steps similar to any problem-solving task. There are five main ingredients in the programming process: Defining the problem Planning the solution Coding the program Testing the program Documenting the program Let us discuss each of these in turn. Defining the Problem Suppose that, as a programmer, you are contacted because your services are needed. You meet with users from the client organization to analyze the problem, or you meet with a systems analyst who outlines the project. Specifically, the task of defining the problem consists of identifying what it is you know (input-given data), and what it is you want to obtain (output-the result). Eventually, you produce a written agreement that, among other things, specifies the kind of input, processing, and output required. This is not a simple process. Planning the Solution Eniac: Figure 1: Flow Chart Symbols and Flow Chart For Mailing Letter Two common ways of planning the solution to a problem are to draw a flowchart and to write pseudocode, or possibly both. Essentially, a flowchart is a pictorial representation of a step-by-step solution to a problem. It consists of arrows representing the direction the program takes and boxes and other symbols representing actions. It is a map of what your program is going to do and how it is going to do it. The American National Standards Institute (ANSI) has developed a standard set of flowchart symbols. Figure 1 shows the symbols and how they might be used in a simple flowchart of a common everyday act-preparing a letter for mailing. Pseudocode is an English-like nonstandard language that lets you state your solution with more precision than you can in plain English but with less precision than is required when using a formal programming language. Pseudocode permits you to focus on the program logic without having to be concerned just yet about the precise syntax of a particular programming language. However, pseudocode is not executable on the computer. We will illustrate these later in this chapter, when we focus on language examples. Coding the Program As the programmer, your next step is to code the program-that is, to express your solution in a programming language. You will translate the logic from the flowchart or pseudocode-or some other tool-to a programming language. As we have already noted, a programming language is a set of rules that provides a way of instructing the computer what operations to perform. There are many programming languages: BASIC, COBOL, Pascal, FORTRAN, and C are some examples. You may find yourself working with one or more of these. We will discuss the different types of languages in detail later in this chapter. Although programming languages operate grammatically, somewhat like the English language, they are much more precise. To get your program to work, you have to follow exactly the rules-the syntax-of the language you are using. Of course, using the language correctly is no guarantee that your program will work, any more than speaking grammatically correct English means you know what you are talking about. The point is that correct use of the language is the required first step. Then your coded program must be keyed, probably using a terminal or personal computer, in a form the computer can understand. One more note here: Programmers usually use a text editor, which is somewhat like a word processing program, to create a file that contains the program. However, as a beginner, you will probably want to write your program code on paper first. Testing the Program Some experts insist that a well-designed program can be written correctly the first time. In fact, they assert that there are mathematical ways to prove that a program is correct. However, the imperfections of the world are still with us, so most programmers get used to the idea that their newly written programs probably have a few errors. This is a bit discouraging at first, since programmers tend to be precise, careful, detail-oriented people who take pride in their work. Still, there are many opportunities to introduce mistakes into programs, and you, just as those who have gone before you, will probably find several of them. Eventually, after coding the program, you must prepare to test it on the computer. This step involves these phases: Desk-checking. This phase, similar to proofreading, is sometimes avoided by the programmer who is looking for a shortcut and is eager to run the program on the computer once it is written. However, with careful desk-checking you may discover several errors and possibly save yourself time in the long run. In desk-checking you simply sit down and mentally trace, or check, the logic of the program to attempt to ensure that it is error-free and workable. Many organizations take this phase a step further with a walkthrough, a process in which a group of programmers-your peers-review your program and offer suggestions in a collegial way. Translating. A translator is a program that (1) checks the syntax of your program to make sure the programming language was used correctly, giving you all the syntax-error messages, called diagnostics, and (2) then translates your program into a form the computer can understand. A by-product of the process is that the translator tells you if you have improperly used the programming language in some way. These types of mistakes are called syntax errors. The translator produces descriptive error messages. For instance, if in FORTRAN you mistakenly write N=2 *(I+J))-which has two closing parentheses instead of one-you will get a message that says, "UNMATCHED PARENTHESES." (Different translators may provide different wording for error messages.) Programs are most commonly translated by a compiler. A compiler translates your entire program at one time. The translation involves your original program, called a source module, which is transformed by a compiler into an object module. Prewritten programs from a system library may be added during the link/load phase, which results in a load module. The load module can then be executed by the computer. Debugging. A term used extensively in programming, debugging means detecting, locating, and correcting bugs (mistakes), usually by running the program. These bugs are logic errors, such as telling a computer to repeat an operation but not telling it how to stop repeating. In this phase you run the program using test data that you devise. You must plan the test data carefully to make sure you test every part of the program. Documenting the Program Documenting is an ongoing, necessary process, although, as many programmers are, you may be eager to pursue more exciting computer-centered activities. Documentation is a written detailed description of the programming cycle and specific facts about the program. Typical program documentation materials include the origin and nature of the problem, a brief narrative description of the program, logic tools such as flowcharts and pseudocode, data-record descriptions, program listings, and testing results. Comments in the program itself are also considered an essential part of documentation. Many programmers document as they code. In a broader sense, program documentation can be part of the documentation for an entire system. The wise programmer continues to document the program throughout its design, development, and testing. Documentation is needed to supplement human memory and to help organize program planning. Also, documentation is critical to communicate with others who have an interest in the program, especially other programmers who may be part of a programming team. And, since turnover is high in the computer industry, written documentation is needed so that those who come after you can make any necessary modifications in the program or track down any errors that you missed.
> The Programming Process The procress of creating a program consists the following stages: - Design - Writing Source Code - Compiling - Linking - Debugging The process goes in cycles. You start with a design, and try to write code to implement that design. As you write the code you may come across problems that send you back to the design stage. Once you have code written you try to compile it. If there are errors or other problems you go back to editing the source code and eventually try again. If your code compiles you try to link it. If that doesn't work you usually have to go back to editing the source code again. If the code links then you try running it. If it doesn't do what you wanted (if there are bugs that is), or if it just plain doesn't work, then you probably need to go back to the source code again, or you may even need to go back and change the design. Here's a rough outline of what happens at each step. **Design** Decide what you need the program to do. Try to break the problem down into functional blocks; pieces that you can turn into functions or classes in a programming language. The design process can be further broken down. First there is a basic investigation process, where you try to figure out what needs to be done and how, in theory, it could be done. Secondly you determine the functional blocks of the system and define their interfaces. Thirdly you design the details of interal processing for each functional block. **Writing Source Code** Write a text file (source file or source code) which contains text in the programming language you are using. There should be a file for each class, or each closely related group of functions or classes. There may be one file for each functional block in the design, or the blocks may be split up into smaller pieces. Some parts may even be split off into separate libraries. **Compiling** Take the source code and compile it into object code. Object code is a translation of the instructions you wrote in the programming language into the native language of the computer (basically lots of numbers, also called machine language). Each source file is translated into one object file. **Linking** Link all the object code files for the program together to create an executable. An executable is a file in the native language of the computer arranged so that it can be read from a disk into the computer's memory and executed (or run) from start to finish. If you are using libraries you may have to include those libraries, which are sets of object files archived together for easy access. **Debugging** Almost no programs run perfectly, or even well, the first time they are run. You will have to find out what is wrong with a program and probably go back to the source code to fix the problem. This process is called debugging, and for some programs it never seems to end. Debugging should include testing, which means component testing (each functional block alone), integration testing (combinations of functional blocks and their interfaces) and system testing (the whole system). After all that the program is finished. Except, of course, that you will always find some new feature you want to implement, or piece of code you want to tweak. At that point you go back to step one and design your modifications, and start into the cycle again.
The programming process consists of 5 steps. These are really only guidelines that have come to be recognized as being part of writing good, easily understood, and useful computer programs. 1. Analyzing the problem 2. Designing the solution 3. Coding the solution 4. Testing the solution 5. Documenting the solution Problem Analysis: This is where the clear statement of the problem is stated. The programmer must be sure that he understands the problem and how to solve it. He must know what is expected of the problem, i.e. what the program should do, the nature of the output and the input to consider so as get the output. He must also understand the ways of solving the problem and the relationship between the input and the expected output. Design: The planning of the solution to the problem in the first stage takes place in this stage. The planning consists of the process of finding a logical sequence of precise steps that solve the problem. Such a sequence of steps is called an algorithm. Every detail, including obvious steps should appear in the algorithm. The three popular methods used to develop the logic plan are: flowcharts, a pseudo code, and a top-down chart. These tools help the programmer break down a problem into a sequence of small tasks the computer can perform to solve the problem. Planning may also involve using representative data to test the logic of the algorithm by hand to ensure that it is correct. Coding: Translation of the algorithm in stage two into a programming language takes place here. The process for writing the program is called coding. The programmer uses the algorithm devised in the design stage along with the choice of the programming language he got from stage three. Testing and Debugging: The process involves the location and removal of error in the program if any. Testing is the process of checking if the program is working as expected and finding errors in the program, and debugging is the process of correcting errors that are found (An error in a program is called a bug.). Documentation: This is the final stage of program development. It consists of organising all the material that describes the program. The documentation of the program is intended to allow another person or the programmer at a later date, to understand the program. Internal documentation remarks consist of statements in the program that are not executed, but point out the purpose of various parts of the program. Documentation might also consist of a detailed description of what the program does and how to use the program. Other types of documentation are flowchart and pseudo code that were used to construct the program. Although documentation is listed as the last step in the program development cycle, it should take place as the program is being coded. It is sometimes the first step during program execution because the programmer can use program documentation in developing a new program by just improving on the previous work. Thanks