Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 C++ Plus Data Structures Nell Dale Chapter 1 Software Engineering Principles Modified from the Slides made by Sylvia Sorkin, Community College of Baltimore.

Similar presentations


Presentation on theme: "1 C++ Plus Data Structures Nell Dale Chapter 1 Software Engineering Principles Modified from the Slides made by Sylvia Sorkin, Community College of Baltimore."— Presentation transcript:

1 1 C++ Plus Data Structures Nell Dale Chapter 1 Software Engineering Principles Modified from the Slides made by Sylvia Sorkin, Community College of Baltimore County - Essex Campus

2 2 Software Design Process

3 3 Programming Life Cycle Activities l Problem analysisunderstand the problem l Requirements definition specify what program will do l High- and low-level designhow it meets requirements l Implementation of designcode it l Testing and verificationdetect errors, show correct l Deliveryturn over to customer l Operationuse the program l Maintenancechange the program

4 4 Software Engineering l A disciplined approach to the design, production, and maintenance of computer programs l that are developed on time and within cost estimates, l using tools that help to manage the size and complexity of the resulting software products.

5 5 Toolboxes: l Hardware. l Software l Ideaware (focus of the course!): the shared body of knowledge that programmers have collected over time, including algorithms, data structures, programming methodologies, tools…

6 6 An Algorithm Is... l A logical sequence of discrete steps that describes a complete solution to a given problem computable in a finite amount of time.

7 7 Goals of Quality Software l It works. l It can be read and understood. l It can be modified. l It is completed on time and within budget.

8 8 Specification: Understanding the Problem Detailed Program Specification l Tells what the program must do, but not how it does it. l Is written documentation about the program.

9 9 Writing Detailed Specifications Detailed Program Specification Includes: l Inputs l Outputs l Processing requirements l Assumptions

10 10 Program Design

11 11 Abstraction l A model of a complex system that includes only the details essential to the perspective of the viewer of the system.

12 12 Information Hiding l Hiding the details of a function or data structure with the goal of controlling access to the details of a module or structure. PURPOSE: To prevent high-level designs from depending on low-level design details that may be changed.

13 13 Two Approaches to Building Manageable Modules Divides the problem into more easily handled subtasks, until the functional modules (subproblems) can be coded. Identifies various objects composed of data and operations, that can be used together to solve the problem. FUNCTIONAL DECOMPOSITION OBJECT-ORIENTED DESIGN FOCUS ON: processes FOCUS ON: data objects

14 14 Find Weighted Average Print Weighted Average Functional Design Modules Main Print Data Print Heading Get Data Prepare File for Reading

15 15 Object-Oriented Design A technique for developing a program in which the solution is expressed in terms of objects -- self- contained entities composed of data and operations on that data. Private data << setf...... Private data >> get...... ignore cincout

16 16 More about OOD l Languages supporting OOD include: C++, Java, Smalltalk, Eiffel, and Object-Pascal, C, … l A class is a programmer-defined data type and objects are variables of that type. l In C++, cin is an object of a data type (class) named istream, and cout is an object of a class ostream. Header files iostream.h and fstream.h contain definitions of stream classes.

17 17 Procedural vs. Object-Oriented Code “Read the specification of the software you want to build. Underline the verbs if you are after procedural code, the nouns if you aim for an object-oriented program.” Brady Gooch, “What is and Isn’t Object Oriented Design,” 1989.

18 18 Verification of Software Correctness Testing Debugging Program verification

19 19 l Program Verification is the process of determining the degree to which a software product fulfills its specifications. Program Verification PROGRAM SPECIFICATIONS Inputs Outputs Processing Requirements Assumptions

20 20 Program Testing l Testing is the process of executing a program with various data sets designed to discover errors. DATA SET 1 DATA SET 2 DATA SET 3 DATA SET 4...

21 21 Origin of Bugs Various Types of Errors: l Design errors occur when specifications are wrong l Compile errors occur when syntax is wrong l Run-time errors result from incorrect assumptions, incomplete understanding of the programming language, or unanticipated user errors.

22 22 Design for Correctness

23 23 Robustness l Robustness is the ability of a program to recover following an error; the ability of a program to continue to operate within its environment.

24 24 An Assertion l Is a logical proposition that is either true or false (not necessarily in C++ code). EXAMPLES studentCount is greater than 0 sum is assigned && count > 0 response has value ‘y’ or ‘n’ partNumber == 5467

25 25 Preconditions and Postconditions l The precondition is an assertion describing what a function requires to be true before beginning execution. l The postcondition describes what must be true at the moment the function finishes execution. l The caller is responsible for ensuring the precondition, and the function code must ensure the postcondition. FOR EXAMPLE...

26 26 Design Review Activities l Deskchecking: tracing an execution of a design or program on paper (checklist Fig1.4, pg31). l Walk-through: a verification method in which a team performs a manual simulation of the program or design. l Inspection: a verification method in which one member of a team reads the program or design line by line an the others point out errors.

27 27 Program Testing l Unit Testing: testing a module or function by itself l Data Coverage: testing all possible input values (Black Box Testing) l Code Coverage: testing program paths (Clear/White Box Testing) l Test Plans l Planning for Debugging l Integration Testing

28 28 Tasks within each test case: l determine inputs that demonstrate the goal. l determine the expected behavior for the input. l run the program and observe results. l compare expected behavior and actual behavior. If they differ, we begin debugging.

29 29 Integration Testing l Is performed to integrate program modules that have already been independently unit tested. Find Weighted Average Print Weighted Average Main Print Data Print Heading Get Data Prepare File for Reading

30 30 Integration Testing Approaches Ensures correct overall design logic. Ensures individual modules work together correctly, beginning with the lowest level. TOP-DOWN BOTTOM-UP USES: placeholder USES: a test driver to call module “stubs” to test the functions being tested. the order of calls.

31 31 Practical Considerations

32 32 Life-Cycle Verification Activities: l Analysis l Design l Code l Test l Delivery l Maintenance


Download ppt "1 C++ Plus Data Structures Nell Dale Chapter 1 Software Engineering Principles Modified from the Slides made by Sylvia Sorkin, Community College of Baltimore."

Similar presentations


Ads by Google