with c
play

WITH C++ Prof. Amr Goneid AUC Part 1. Introduction Prof. amr - PowerPoint PPT Presentation

CSCE 110 PROGRAMMING FUNDAMENTALS WITH C++ Prof. Amr Goneid AUC Part 1. Introduction Prof. amr Goneid, AUC 1 1. Introduction Software for Problem Solving Software Production Process Top-Down Design Modules Structured


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

  2. 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 Prof. amr Goneid, AUC 2

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

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

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

  6. 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. Prof. amr Goneid, AUC 6

  7. Top-Down Design Level 0 X 1 X1 X2 X3 Xn 2 X21 X22 . . Prof. amr Goneid, AUC 7

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

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

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

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

  12. 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. Prof. amr Goneid, AUC 12

  13. 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 Prof. amr Goneid, AUC 13

  14. 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 Prof. amr Goneid, AUC 14

  15. 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. Prof. amr Goneid, AUC 15

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

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

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

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

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

  21. 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 Prof. amr Goneid, AUC 21

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend