1 Chapter-01 Programming Methodologies Procedural/Structured Design Objected-Oriented Design.

Slides:



Advertisements
Similar presentations
Problem Solving and Algorithm Design
Advertisements

COMPSCI 105 S Principles of Computer Science 12 Abstract Data Type.
Slides modified by Erin Chambers Problem Solving and Algorithm Design.
Computers Are Your Future
6-1 Chapter Goals Determine whether a problem is suitable for a computer solution Describe the computer problem-solving process and relate it to Polya’s.
Problem Solving and Algorithm Design
Chapter 6 Problem Solving and Algorithm Design. 6-2 Chapter Goals Determine whether a problem is suitable for a computer solution Describe the computer.
© Janice Regan Problem-Solving Process 1. State the Problem (Problem Specification) 2. Analyze the problem: outline solution requirements and design.
1 Chapter 6 Object-Oriented Software Design and Implementation.
Important Definitions Class: A structured data type that is used to represent an abstract data type (ADT) Class member: A components of a class. It can.
Department of Computer Science University of Maryland, College Park
Chapter 6 Problem Solving and Algorithm Design Nell Dale John Lewis.
C++ Programming: From Problem Analysis to Program Design, Second Edition Chapter 13: Inheritance and Composition.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
C++ fundamentals.
OBJECT ORIENTED PROGRAMMING IN C++ LECTURE
Chapter 9 High-Level Programming Languages: C++. Chapter Goals Describe the expectations of high level languages Distinguish between functional design.
Introduction To System Analysis and design
Chapter 11: Inheritance and Composition. Objectives In this chapter, you will: – Learn about inheritance – Learn about derived and base classes – Redefine.
Introduction to Object-oriented programming and software development Lecture 1.
GENERAL CONCEPTS OF OOPS INTRODUCTION With rapidly changing world and highly competitive and versatile nature of industry, the operations are becoming.
1 Basic Concepts of Object-Oriented Design. 2 What is this Object ? There is no real answer to the question, but we ’ ll call it a “ thinking cap ”. l.
CHAPTER ONE Problem Solving and the Object- Oriented Paradigm.
Top-Down Design and Modular Development
Problem Solving and Algorithm Design. 2 Problem Solving Problem solving The act of finding a solution to a perplexing, distressing, vexing, or unsettled.
1 Chapter 4 Program Input and the Software Design Process.
1 Chapter 4 Program Input and the Software Design Process.
1 Chapter 4 Program Input and the Software Design Process Dale/Weems/Headington.
1 Chapter 4 Program Input and the Software Design Process CS185/09 - Introduction to Programming Caldwell College.
Computer Concepts 2014 Chapter 12 Computer Programming.
1 C++ Plus Data Structures Nell Dale Chapter 1 Software Engineering Principles Modified from the Slides made by Sylvia Sorkin, Community College of Baltimore.
1 Systems Analysis and Design in a Changing World, Thursday, January 18, 2007.
1 ISA&D7‏/8‏/ ISA&D7‏/8‏/2013 Methodologies of the SDLC Traditional Approach to SDLC Object-Oriented Approach to SDLC CASE Tools.
CHAPTER ONE Problem Solving and the Object- Oriented Paradigm.
Programming Life Cycle Problem analysisunderstand the problem Requirements definition specify what program will do High- and low-level designhow it meets.
Data Structures Using C++1 Chapter 1 Software Engineering Principles and C++ Classes.
The Programming Process Define the problem* Make or buy software? Design the program * Code (write) the program Test (debug) the program Document the.
Design.ppt1 Top-down designs: 1. Define the Problem IPO 2. Identify tasks, Modularize 3. Use structure chart 4. Pseudocode for Mainline 5. Construct pseudocode.
CSC1201: PROGRAMMING LANGUAGE 2 Aseel Al Hadlaq 2nd Term
1 Chapter 4 Program Input and the Software Design Process Dale/Weems/Headington.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved More about.
1 Chapter 4 Program Input and the Software Design Process Dale/Weems.
Learners Support Publications Object Oriented Programming.
No I/O is built into C++ l instead, a library provides input stream and output stream KeyboardScreen executing program istreamostream 1.
1 Chapter 4 Program Input and the Software Design Process Dale/Weems/Headington.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
1 Program Input and the Software Design Process. 2 Chapter 4 Topics  Input Statements to Read Values for a Program using >>, and functions get, ignore,
Dr D. Greer, Queens University Belfast )Chapter Six 1 Software Engineering Chapter Six Software Design Quality Learning Outcomes.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
CSI 1340 Introduction to Computer Science II Chapter 1 Software Engineering Principles.
Chapter 4 Program Input and the Software Design Process.
C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 13: Inheritance and Composition.
Chapter 1 Data Abstraction: The Walls CS Data Structures Mehmet H Gunes Modified from authors’ slides.
Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation.
Chapter 11: Inheritance and Composition. Introduction Two common ways to relate two classes in a meaningful way are: – Inheritance (“is-a” relationship)
Chapter 2 Principles of Programming and Software Engineering.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved More about.
Object-oriented programming (OOP) is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their.
Chapter 4 Program Input and the Software Design Process
C++ Plus Data Structures
Chapter 1 Software Engineering Principles
Problem Solving and Algorithm Design
No I/O is built into C++ instead, a library provides input stream and output stream Keyboard Screen executing program istream ostream 1.
The Programming Process
Programming We have seen various examples of programming languages
Chapter 4 Program Input and the Software Design Process
Chapter 11: Inheritance and Composition
Data Structures Goal: organize data Criteria: facilitate efficient
Dale/Weems/Headington Program Input and the Software Design Process
Presentation transcript:

1 Chapter-01 Programming Methodologies Procedural/Structured Design Objected-Oriented Design

2 Object Autonomy? OOP

3 Algorithm (Unstructured Version) / * Algorithm to read and count several triples of distinct numbers and print the largest number in each triple. * / 1. Initialize count to 0 2. Read a triple x, y, z. 3. If x is the end-of-data flag then go to step Increment count by If x > y then go to step If y > z then go to step Display z. 8. Go to step If x < z then go to step Display x. 11. Go to step Display y. 13. Go to step Display count. Note the spaghetti logic!

4 Algorithm (Structured Version) / * Algorithm to read and count several triples of distinct numbers and print the largest number in each triple. * / 1. Initialize count to Read the first triple of numbers x, y, z. 3. While x is not the end-of-data-flag do the following: a. Increment count by 1. b. If x > y and x > z then display x. Else if y > x and y > z then display y Else display z. c. Read the next triple x, y, z. 4. Display count.

5 Different Programming: 1.Spaghetti code -with goto statements 2.Structured Programming -reduction of program into its constituent elements. 3.OOP -decomposes a problem into related subgroups Each subgroup becomes a self- contained object that contains its own instructions and data that relates to that object. Complexity is reduced and the programmer can manage large programs.

Bazlur Rasheed Functional Decomposition A technique for developing a program in which the problem is divided into more easily handled subproblems, the solutions of which create a solution to the overall problem. In functional decomposition, we work from the abstract (a list of the major steps in our solution) to the particular (algorithmic steps that can be translated directly into code in C++ or another language).

Bazlur Rasheed Functional Decomposition FOCUS is on actions and algorithms. BEGINS by breaking the solution into a series of major steps. This process continues until each subproblem cannot be divided further or has an obvious solution. UNITS are modules representing algorithms. A module is a collection of concrete and abstract steps that solves a subproblem. A module structure chart (hierarchical solution tree) is often created. DATA plays a secondary role in support of actions to be performed.

Bazlur Rasheed Compute Mileages Write Total Miles Module Structure Chart Main Get Data Round To Nearest Tenth Initialize Total Miles Open Files

Bazlur Rasheed 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 setw

Bazlur Rasheed More about OOD l languages supporting OOD include: C++, Java, Smalltalk, Eiffel, CLOS, and Object-Pascal 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 and fstream contain definitions of stream classes l a class generally contains private data and public operations (called member functions)

Bazlur Rasheed Object-Oriented Design (OOD) FOCUS is on entities called objects and operations on those objects, all bundled together. BEGINS by identifying the major objects in the problem, and choosing appropriate operations on those objects. UNITS are objects. Programs are collections of objects that communicate with each other. DATA plays a leading role. Algorithms are used to implement operations on the objects and to enable interaction of objects with each other.

Bazlur Rasheed 12 Two Programming Methodologies Functional Object-Oriented Decomposition Design FUNCTION OBJECT Operations Data OBJECT Operations Data OBJECT Operations Data

Bazlur Rasheed 13 What is an object? OBJECT Operations Data set of functions internal state

Bazlur Rasheed 14 An object contains data and operations Private data: accoutNumber balance OpenAccount WriteCheck MakeDeposit IsOverdrawn GetBalance checkingAccount

Bazlur Rasheed Why use OOD with large software projects? l objects within a program often model real-life objects in the problem to be solved l many libraries of pre-written classes and objects are available as-is for re-use in various programs l the OOD concept of inheritance allows the customization of an existing class to meet particular needs without having to inspect and modify the source code for that class--this can reduce the time and effort needed to design, implement, and maintain large systems

Bazlur Rasheed 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

17 A commercial for OOP: Two programming paradigms Procedural: ( C, FORTRAN, and Pascal ) –Action-oriented — concentrates on the verbs of a problem's specification –Programmers: Identify basic tasks to be performed to solve problem Implement the actions required to do these tasks as subprograms (procedures/functions/ subroutines) Group these subprograms into programs/modules/libraries, which together make up a complete system for solving the problem Object-oriented: ( C++, Java, and Smalltalk) –Focuses on the nouns of a problem's specification –Programmers: Determine what objects are needed for a problem and how they should work together to solve the problem. Create types called classes made up of data members and function members to operate on the data. Instances of a type (class) are called objects.