Chapter 9 High-Level Programming Languages: C++. Chapter Goals Describe the expectations of high level languages Distinguish between functional design.

Slides:



Advertisements
Similar presentations
Problem Solving and Algorithm Design
Advertisements

Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Slides modified by Erin Chambers Problem Solving and Algorithm Design.
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. 2 Chapter Goals Determine whether a problem is suitable for a computer solution Describe the computer.
Chapter 6 Problem Solving and Algorithm Design. 6-2 Chapter Goals Determine whether a problem is suitable for a computer solution Describe the computer.
1 Chapter 6 Object-Oriented Software Design and Implementation.
Algorithms and Problem Solving-1 Algorithms and Problem Solving Mainly based on Chapter 6: “Problem Solving and Algorithm Design” from the Book: “Computer.
1 Programming for Engineers in Python Autumn Lecture 5: Object Oriented Programming.
Algorithms and Problem Solving-1 Algorithms and Problem Solving.
Algorithms and Problem Solving
Algorithms and Problem Solving. Learn about problem solving skills Explore the algorithmic approach for problem solving Learn about algorithm development.
Chapter 2: Algorithm Discovery and Design
Chapter 1 Introduction to Object- Oriented Programming and Problem Solving.
High-Level Programming Languages
Chapter 6 Problem Solving and Algorithm Design Nell Dale John Lewis.
Chapter 8 High-Level Programming Languages Nell Dale John Lewis.
Chapter 8: Introduction to High-level Language Programming Invitation to Computer Science, C++ Version, Third Edition.
Chapter 1 Principles of Programming and Software Engineering.
Software Engineering Principles and C++ Classes
Data Structures Using C++1 Chapter 1 Software Engineering Principles and C++ Classes.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Chapter 8: Introduction to High-level Language Programming Invitation to Computer Science, C++ Version, Third Edition.
Problem Solving and Algorithm Design
Chapter 8: Introduction to High-Level Language Programming Invitation to Computer Science, C++ Version, Fourth Edition.
OBJECT ORIENTED PROGRAMMING IN C++ LECTURE
Object-Oriented Design and High-Level Programming Languages
COMP An Introduction to Computer Programming : University of the West Indies COMP6015 An Introduction to Computer Programming Lecture 02.
Introduction To System Analysis and design
Object Oriented Software Development
Chapter 8 High-Level Programming Languages (modified by Erin Chambers)
Chapter 9 Object-Oriented Design and High-Level Programming Languages.
Design Patterns OOD. Course topics Design Principles UML –Class Diagrams –Sequence Diagrams Design Patterns C#,.NET (all the course examples) Design Principles.
Sadegh Aliakbary Sharif University of Technology Fall 2011.
CONCEPTS OF OBJECT ORIENTED PROGRAMMING. Topics To Be Discussed………………………. Objects Classes Data Abstraction and Encapsulation Inheritance Polymorphism.
BIT 1003 – Presentation 7. Contents GENERATIONS OF LANGUAGES COMPILERS AND INTERPRETERS VIRTUAL MACHINES OBJECT-ORIENTED PROGRAMMING SCRIPTING LANGUAGES.
Chapter 4 ADT Sorted List. 2 Goals Describe the Abstract Data Type Sorted List from three perspectives Implement the following Sorted List operations.
Problem Solving and Algorithm Design. 2 Problem Solving Problem solving The act of finding a solution to a perplexing, distressing, vexing, or unsettled.
Chapters 7, 8, & 9 Quiz 3 Review 1. 2 Algorithms Algorithm A set of unambiguous instructions for solving a problem or subproblem in a finite amount of.
11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Chapter 6 Problem Solving and Algorithm Design Nell Dale John Lewis.
Chapter 6 Problem Solving and Algorithm Design. 2 Problem Solving Problem solving The act of finding a solution to a perplexing, distressing, vexing,
Data Structures Using C++1 Chapter 1 -Software Engineering Principles -ADT and Classes.
Chapter 6 Problem Solving and Algorithm Design. 2 Chapter Goals Apply top-down design methodology to develop an algorithm to solve a problem Define the.
Data Structures Using C++1 Chapter 1 Software Engineering Principles and C++ Classes.
Chapter 12 Object Oriented Design.  Complements top-down design  Data-centered view of design  Reliable  Cost-effective.
1 Programming Paradigms Object Orientated Programming Paradigm (OOP)
Chapter 8: Introduction to High-level Language Programming Invitation to Computer Science, C++ Version, Third Edition.
8-1 Compilers Compiler A program that translates a high-level language program into machine code High-level languages provide a richer set of instructions.
Data Structures Using C++ 2E
Chapter 8 High-Level Programming Languages. 2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Salman Marvasti Sharif University of Technology Winter 2015.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Chapter 6 Problem Solving and Algorithm Design. 2 Chapter Goals Determine whether a problem is suitable for a computer solution Describe the computer.
Chapter 2 Principles of Programming and Software Engineering.
Data Structures Using Java1 Chapter 1 Software Engineering Principles and Java Classes.
Algorithms and Problem Solving. Learn about problem solving skills Explore the algorithmic approach for problem solving Learn about algorithm development.
Sadegh Aliakbary Sharif University of Technology Fall 2010.
Algorithms and Problem Solving
About the Presentations
PRINCIPALES OF OBJECT ORIENTED PROGRAMMING
Object-Oriented Design
PROBLEM SOLVING SKILLS
Programming We have seen various examples of programming languages
High Level Programming Languages
Algorithms and Problem Solving
Presentation transcript:

Chapter 9 High-Level Programming Languages: C++

Chapter Goals Describe the expectations of high level languages Distinguish between functional design and object-oriented design Describe the stages of the object-oriented design process Apply the object-oriented design process Understand how the constructs of top-down and object-oriented design are implemented in programming languages 2

3 Meeting Expectations C++ meets the four expectations for a high-level programming language Expectations –Programmer need not manage details of the movement of data items within memory, nor pay any attention to where they are stored

4 Meeting Expectations (continued) Expectations (continued) –Programmer can take a macroscopic view of tasks, thinking at a higher level of problem- solving –Programs written in high-level languages will be portable rather than machine-specific –Programming statements in a high-level language Will be closer to standard English Will use standard mathematical notation

8-5 Functionality of Imperative Languages Sequence Executing statements in sequence until an instruction is encountered that changes this sequencing Selection Deciding which action to take Iteration (looping) Repeating an action Both selection and iteration require the use of a Boolean expression Top-Down Approach: a technique that attempts to solve a general problem in a hierarchical way by decomposing it in sub-problems. Each sub-problem is then refined by using a similar decomposition approach until it cannot be further decomposed.s

6 Object-Oriented Design Object-oriented Design A problem-solving methodology that produces a solution to a problem in terms of self-contained entities called objects Object A thing or entity that makes sense within the context of the problem For example, a student, a car, time, date

7 Object-Oriented Design World View of OOD Problems are solved by –isolating the objects in a problem, –determining their properties and actions (responsibilities), and –letting the objects collaborate to solve a problem What? Say again!

8 Object-Oriented Design An analogy: You and your friend fix dinner Objects: you, friend, dinner Class: you and friend are people People have name, eye color, … People can shop, cook, … Instance of a class: you and friend are instances of class People, you each have your own name and eye color, you each can shop and cook You collaborate to fix dinner

9 Object-Oriented Design Class (or object class) A description of a group of similar objects Object (instance of a class) A concrete example of the class Classes contain fields that represent the properties (name, eye color) and behaviors (responsibilities) (shop, cook) of the class Method A named algorithm that defines behavior (shop, cook)

10 Object-Oriented Design Top-Down Design decomposes problems into tasks Object-Oriented Design decomposes problems into collaborating objects Yes, but how?

11 Object-Oriented Design Steps –isolate the real-world objects in the problem –abstract the objects with like properties into groups (classes) –determine the responsibilities of the group in interacting with other groups

12 Object-Oriented Design Think of design as a mapping from real world objects to classes of objects birth date marriage date dog's birth date Date class Objects Classes of objects

13 Object-Oriented Design Program World simulates these groups class Date dogBirthdate birthdate marriageDate Description Instances

14 Object-Oriented Design Date's Actions in real world ? We call an object's interactions with other objects its responsibilities Create itself Know the state of its fields Compare itself to another date Return a date a number of days hence

15 Object-Oriented Design Responsibilities become methods in the Program World class Date getMonth getDay getYear dogBirthdate birthdate marriageDate

16 Class Definition A class encapsulates both data and actions public class Person // Name the class // Declare Class variables String name String address String telephone String Encapsulation The bundling of data and actions in such a way that the logical properties of the data and actions are separated from the implementation details Data of the class

17 Class Definition // Declare Class Methods Initialize() // Code for Initialize public Print() // Code for Print public String GetName() RETURN name public String GetAddress() RETURN address public String Get () RETURN public String GetTelephone() RETURN telephone 17 Actions of the class

18 Class Definition Figure 9.4 The Class person 18 Example of Object declaration // Create an object of the class Person Person person1; // The object is called person1 The class encapsulates both the data and the actions

19 Object-Oriented Design Methodology Four stages to the decomposition process –Brainstorming to locate possible classes –Filtering the classes to find duplicates or remove unnecessary ones –Scenarios are tried to be sure we understand collaborations –Responsibility algorithms are designed for all actions that classes must exhibit

20 Scenarios and Responsibilities Assign responsibilities to each class There are two types of responsibilities –What a class must know about itself (knowledge responsibilities) Knowledge responsibilities usually just return the contents of one of an object’s variables –What a class must be able to do (behavior responsibilities) Action responsibilities are a little more complicated, often involving calculations

21 Computer Example Let’s examine the problem-solving process for creating an address list Brainstorming and filtering –Circling the nouns and underlining the verbs is a good way to begin

22 Responsibility Algorithms Example: 2 Responsibility of the Person Class Initialize name.initialize() Write "Enter the first and last name; press return.“ Get the name Write "Enter phone number; press return." Get telephone number Write "Enter address; press return." Get address Print name.print() Write “Name: " + name Write "Telephone number: " + telephoneNumber Write " address: " + Address Tells name to initialize itself Tells name to print itself

23 Functionality of OOPs Object class (problem-solving phase) An entity or thing that is relevant in the context of a problem Object class (class) (problem-solving phase) A description of a group of objects with similar properties and behaviors Class (implementation phase) A pattern for an object Object ( implementation phase) An instance of a class 23

24 Functionality of OOPs Encapsulation A language feature that enforces information hiding Classes Different meanings in different places (See next slide) Inheritance A property that allows a class to inherit the data and actions of another class Polymorphism A ability to handle the ambiguity of duplicate names

25 Who am I? I am best known for structured programming. Can you define it? I am also known for my wit. Can you recall some of my witty sayings?

26 Ethical Issues Gambling on the Internet Have you ever visited an Internet gambling site? Should Internet gambling be outlawed? Should Internet gambling be legalized and regulated? Should Internet gambling be taxed?

27 Do you know? How are computers used in tennis tournaments? What predated functionality of Bytecode? What does the word "paradigm" mean? How has its meaning changed over time? How many definitions can you think of for "bow"?