Presentation is loading. Please wait.

Presentation is loading. Please wait.

Prof. amr Goneid, AUC1 CSCE 110 PROGRAMMING FUNDAMENTALS WITH C++ Prof. Amr Goneid AUC Part 1. Introduction.

Similar presentations


Presentation on theme: "Prof. amr Goneid, AUC1 CSCE 110 PROGRAMMING FUNDAMENTALS WITH C++ Prof. Amr Goneid AUC Part 1. Introduction."— Presentation transcript:

1 Prof. amr Goneid, AUC1 CSCE 110 PROGRAMMING FUNDAMENTALS WITH C++ Prof. Amr Goneid AUC Part 1. Introduction

2 Prof. amr Goneid, AUC2 1. Introduction Software for Problem Solving Software Production Process Top-Down Design Modules Structured Software & Program Design Some Guidelines for Design Example C++ Program & Module Structures Object Oriented Programming

3 Prof. amr Goneid, AUC3 Software for Problem Solving Use of S/W Problem Domain Problem Domain S/W Decide, Learn, View & Interact, Play, ……. Decide, Learn, View & Interact, Play, ……. TO

4 Prof. amr Goneid, AUC4 Software Production Process Stages of S/W Production Specify Requirements Solution Strategy S/W Production S/W Testing Problem Definition Maintenance Upgrade

5 Prof. amr Goneid, AUC5 Software Production S/W Design Implementation (Programs) Debugging Performance Analysis / Benchmarks

6 Prof. amr Goneid, AUC6 Top-Down Design Divide and Conquer Strategy. Given problem X (Level 0). Divide it into sub-problems X1, X2, …, Xn (Level 1) such that solving X1, then X2, then … solves X completely. Repeat for each sub-problem until we reach basic or trivial implementation level.

7 Prof. amr Goneid, AUC7 Top-Down Design Level X X1X2X3Xn X21X22 0 1 2....

8 Prof. amr Goneid, AUC8 Modules In C++ Implemented as Main Problem X Main Program X Implemented as Sub-Problem Xi Module Xi

9 Prof. amr Goneid, AUC9 Structured Software Design Design Steps Main & Subs Functional Specs Data Specs Algorithm Specs Pseudo- code

10 Prof. amr Goneid, AUC10 Structured Program Design Main Program and Modules X1 Data Actions (Algorithms) X2 Data Actions (Algorithms) Main Data Main Manager X1 ModuleX2 Module Main Program

11 Prof. amr Goneid, AUC11 Some Guidelines for Design Transparency of Purpose Correctness Completeness Ease of Use Efficiency Writability Maintainability

12 Prof. amr Goneid, AUC12 Example of a Design Document Problem Definition: n projects are to be prioritized according to cost (least cost first). Problem size is n Requirement Specification: - Input(s): n, and list of costs in random order. - Output(s): List of costs in ascending order.

13 Prof. amr Goneid, AUC13 Example(continued) Solution Strategy: 1. Input random List of costs 2. Sort List in ascending order of cost. 3. Print sorted List. S/W Design: Structured (Top-Down) Design: Yields a main module and a sorting module

14 Prof. amr Goneid, AUC14 Example(continued) S/W Design (continued): Functional Specification: Main Module: –Input list and its size n –Call Sorting module to sort list –Output sorted list Sorting Module: –Receives list and its size n –Returns sorted list

15 Prof. amr Goneid, AUC15 Example(continued) S/W Design (continued): Data Specification: The cost is an integer number. MAX = 100 to represent maximum list size An Array (a) of size MAX to store list. Algorithm Specification: Sorting module uses the algorithm of Selection Sort.

16 Prof. amr Goneid, AUC16 Example(continued) S/W Design (continued): Main Module: 1. Input n. 2. Check that n does not exceed MAX. 3. Input random list into array (a). Items will occupy locations a 0 ….. a n-1 4. Call sorting module. 5. Output sorted list (a).

17 Prof. amr Goneid, AUC17 Example(continued) S/W Design (continued): Sorting module (Selection Sort): Repeat for list items k from 0 to n-2 1. Consider the sub-array from k to n-1 2. Find location of the smallest element in that sub-array 3. Exchange that element with that at (k)

18 Prof. amr Goneid, AUC18 Example(continued) Implementation Stage: As a C++ Program

19 Prof. amr Goneid, AUC19 C++ Program Structure Compiler Directives Used Modules (Functions) Prototypes Main Function Header { Main Data Declarations Main Function Actions } Used Modules (Functions) are Defined Here

20 Prof. amr Goneid, AUC20 C++ Module (Function) Structure Module (Function) Header { Local Data Declarations Module Actions (Executable Statements) }

21 Prof. amr Goneid, AUC21 Object Oriented Programming Abstraction: Data Model of a physical object or process Methods: Operations (Algorithms) performed on data of an object Class: Entity defining attributes of an object (data and methods) Object: An actual instance of a class


Download ppt "Prof. amr Goneid, AUC1 CSCE 110 PROGRAMMING FUNDAMENTALS WITH C++ Prof. Amr Goneid AUC Part 1. Introduction."

Similar presentations


Ads by Google