The Software Construction Process
Computer System Components Central Processing Unit (Microprocessor) Secondary Storage (Hard Drive, CD-ROM Drive) Primary Storage (RAM) Input Devices (Mouse, Keyboard) Output Devices (Monitor, Printer) Communications Bus Network Interface Devices (Modem, Network Card) Interne t
A Software Requirement Develop a program that finds and prints all numbers between 1 and 10,000 that are divisible by both 7 and 3. For each number found, display the number and the product of the two quotients.
The Requirement and the Design Develop a program that finds and prints all numbers between 1 and 10,000 that are divisible by both 7 and 3. For each number found, display the number and the product of the two quotients. Set number to 1 Number less than or equal to 10,000 Number divisible by 7 Number divisible by 3 Print number information Increment number by 1 S F Yes No
Boards, Tubes, and Patch Cables Application Program
Setting Switches Application Program
I/O Devices and Operating System Application Program Operating System
Assembly Language, Monitor, and Keyboard Application Program Operating System LOOP: LOAD A, R1 LOAD 7, R2 TEST R1, R2 BRZ LOOP Assembler
Compiler (Syntax and Semantics) Application Program Operating System Assembler Compiler #include int main (void) { int anAnswer; float aValue; anAnswer = aValue / 3; printf(“%d\n”,anAnswer); return 0; }
Algorithm in C Source Code aNumber = LOWNUMBER; while (aNumber <= HIGHNUMBER) { firstQuotient = aNumber / FIRSTDIVISOR; if ( (aNumber % FIRSTDIVISOR) == 0 ) { secondQuotient = aNumber / SECONDDIVISOR; if ( (aNumber % SECONDDIVISOR) == 0) { theProduct = firstQuotient * secondQuotient; printf("%d %7.2f %7.2f %8.2f\n",aNumber, firstQuotient, secondQuotient, theProduct); } // End if } // End if aNumber++; // Increment aNumber by one Note: This is only a portion of the complete C program
From Requirements to Running Program Software Design program.c (Source Code) program.o (Object Code) program.exe (Executable Code) Software Requirements Text Editor Compiler (and Preprocessor) Linker Operating System Design Method Design Fundamentals Coding Standards C Header Files Function Libraries Input/Output Facilities
Software Construction Process EDIT and SAVE COMPILE LINK RUN TEST and SQA BASELINE DESIGN Requirements A B C D E Note: See next slide for meanings of A - E
Categories of Errors A: Compiler errors – doesn’t follow preprocessor or C syntax B: Linker errors – functions declared but not defined; no main function; function library not found C: Run-time errors – segmentation fault; out-of- range errors; wrong data types D: Logic errors – wrong use of control statements; errors in function arguments; algorithm coded incorrectly E: Design errors – doesn’t follow design or satisfy requirements; design has flaws