1.1 C Program Development Cycle
The creation of a program in C or any other high- or middle-level language,usually follows a sequence of steps or phases designated as a program development life cycle.Figure 1.1presents the program development life cycle followed in this book.
Figure 1.1 C Program Development Cycle:its phases and iterative process towards problem solution enhancement
★ Problem statement
A few lines of text which clearly defi ne the problem or objective should be written in this phase to mainly express problem requirements and output of the problem solution.For instance,“convert odd decimal numbers greater than 20 and lower than 30 to binary and display the sequence of bits on the screen”.
★ Analysis
This phase tries to understand the problem at hand,i.e.,what is supposed to be solved.Basically,all solutions’ constraints(e.g.,20<n<30 where n is an odd number)and requirements(e.g.,input variables of type integer,a function to convert from decimal to binary,and an output variable of type array of integer)should be identified and enumerated in order to solve the problem described above.
★ Design
This phase tries to answer how the problem solution will meet the above enumerated requirements,based on the known constraints.Basically,it consists of the identification of subsystems or modules and development of algorithms(e.g.,Figure 1.2)to solve the problem as understood at the analysis phase.
Figure 1.2 An algorithm expressing the decimal2binary conversion for odd numbers greater than 20 and lower than 30
★ Implementation
This phase mainly focuses on aspects such as coding and documentation of the problem solution.A programming language,in this case C,is used to write the actual programming statements for each individual steps of the above developed algorithms,producing,for instance,source(i.e.,.c)and/or header(i.e.,.h)files.
★ Testing and debugging
The main focus of this phase is on verifying whether the written code meets the problem requirements under known constraints Basically,the written code,after being compiled,is tested by inputting several data,including corner cases ones(e.g.,negative or even numbers),and check if the desired output is generated Typically,tests should be performed when concluding each function and modules,as well as when integrating functions and modules in the final program.
★ Evolution
Real programs naturally evolves to accommodate new features or functionalities(i.e.,changes in requirements)as well as to fix some pinpointed bugs or errors detected after the program deployment and usage.The evolution or maintenance phase should address such required solution enhancements by repeating all previous phases.