Chapter 11 An introduction to object-oriented design.

Slides:



Advertisements
Similar presentations
Chapter 10 THINKING IN OBJECTS 1 Object Oriented programming Instructor: Dr. Essam H. Houssein.
Advertisements

Chapter 10 Introduction to Objects and Classess 1.
Object-Oriented Analysis and Design
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 11 Classes and Object- Oriented Programming.
Object Oriented System Development with VB .NET
Slide 1 Systems Analysis & Design CS183 Spring Semester 2008 Dr. Jonathan Y. Clark Course Website:
Fall 2007ACS-1805 Ron McFadyen1 Programming Concepts Chapter 4 introduces more advanced OO programming techniques. Construction of a programs usually requires:
© 2005 Prentice Hall8-1 Stumpf and Teague Object-Oriented Systems Analysis and Design with UML.
OBJECT ORIENTED ANALYSIS & DESIGN Vassilka Kirova Department of Computer & Information Science NJIT.
Object Oriented Programming.  OOP Basic Principles  C++ Classes  September 2004  John Edgar 22.
CS 2511 Fall Features of Object Oriented Technology  Abstraction Abstract class Interfaces  Encapsulation Access Specifiers Data Hiding  Inheritance.
ASP.NET Programming with C# and SQL Server First Edition
Chapter 13: Object-Oriented Programming
Introduction to Object Oriented Design Lecture 11.
Simon Woodworth Object Oriented Design What is it? Why do it? Simon Woodworth, 19 August 2004.
Object Oriented Software Development
1 A Student Guide to Object- Orientated Systems Chapter 4 Objects and Classes: the basic concepts.
OBJECT AND CLASES: THE BASIC CONCEPTS Pertemuan 8 Matakuliah: Konsep object-oriented Tahun: 2009.
An Object-Oriented Approach to Programming Logic and Design
OBJECT ORIENTED PROGRAMMING CONCEPTS ISC 560. Object-oriented Concepts  Objects – things names with nouns  Classes – classifications (groups) of similar.
IS0514Slide 1 IS0514 Lecture Week 5 Introduction to Object Orientation.
Introduction to Objects Adapted from “TEN STEPS TO OBJECT-SPEAK” a CPT Tech Talk by Joy Starks September 17, 1999.
An Introduction to Java Chapter 11 Object-Oriented Application Development: Part I.
11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
Object Oriented Programming Principles Lecturer: Kalamullah Ramli Electrical Engineering Dept. University of Indonesia Session-3.
1 Object-oriented design requires that we interact with a problem in much the same way that we interact with our world – we treat it as a set of separate.
Object-Oriented Design Simple Program Design Third Edition A Step-by-Step Approach 11.
OBJECT-ORIENTED PROGRAMMING (OOP) WITH C++ Instructor: Dr. Hany H. Ammar Dept. of Electrical and Computer Engineering, WVU.
CSC241 Object-Oriented Programming (OOP) Lecture No. 1.
Chapter 11: Introduction to Classes. In this chapter you will learn about: – Classes – Basic class functions – Adding class functions – A case study involving.
An Object-Oriented Approach to Programming Logic and Design Chapter 3 Using Methods and Parameters.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
Learners Support Publications Object Oriented Programming.
CS451 - Lecture 2 1 CS451 Lecture 2: Introduction to Object Orientation Yugi Lee STB #555 (816) * Acknowledgement:
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 12 Object-Oriented Programming Starting Out with Games & Graphics.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Chapter 12 Object-oriented design for more than one class.
1 Software Engineering Lecture 15 Object Oriented Software Design in Java.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Programming Models/ Paradigms Chapter 5: Programming Languages.
Topic 8Classes, Objects and Methods 1 Topic 8 l Class and Method Definitions l Information Hiding and Encapsulation l Objects and Reference Classes, Objects,
Java Programming, Second Edition Chapter Three Using Methods, Classes, and Objects.
Chapter 2 Principles of Programming and Software Engineering.
An Introduction to Programming with C++ Fifth Edition Chapter 14 Classes and Objects.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Object-Oriented Paradigm (OOP) Course Code: SE 101 Lecture No. 1.
Chapter 11 An introduction to object-oriented design.
Chapter 5 Introduction to Defining Classes Fundamentals of Java.
Re-Intro to Object Oriented Programming
Programming Logic and Design Seventh Edition
The Movement To Objects
Object Oriented Programming F3031
Topics Procedural and Object-Oriented Programming Classes
Object Oriented Concepts -I
OBJECT ORIENTED CONCEPTS
HIGHLEVEL REVIEW Chapter 9 Objects and Classes
Computer Programming.
Classes & Objects CSCE 121 J. Michael Moore.
Corresponds with Chapter 7
Object-oriented Design in Processing
Object-Oriented Programming
Object-Oriented Programming
Object-oriented Design in Processing
CIS16 Application Development and Programming using Visual Basic.net
Introduction to Object-Oriented Programming
Object-Oriented Programming
Object-oriented Design in Processing
Programming For Big Data
CS 4310: Software Engineering
Object-oriented Design in Processing
Presentation transcript:

Chapter 11 An introduction to object-oriented design

Objectives To introduce object-oriented design To define objects, classes, attributes, operations and information hiding To introduce public and private operations, accessors and mutators To list the steps required to create an object-oriented design solution to a problem

11.1 Introduction to object-oriented design

Objects - Real world

Introduction to object- oriented design Characteristics/Attributes Size/liquid capacity Make Tasks it can perform/Methods Filling Pouring Handle to pass messages

Introduction to object- oriented design Characteristics/Attributes Make Model Number of doors Engine size Actions it can perform/Methods Accelerate Stop Brake Turn

Introduction to object- oriented design Objects – Can be considered as a container for a set of data and the operations that need to be performed on it – Objects have the following properties It has an identity that is unique for the lifetime of the object It has data in a form of a set of characteristics or attributes A set of operations or methods that can be performed on the date It is a instance (example) of a class

Introduction to object- oriented design Classes and Objects – Describes groups of objects that share some common property – Each class in a system should bear a unique name – Each object is an instance of the class it belongs – Process of creating objects from classes is called instantiation

Introduction to object- oriented design Classes and Objects – Inheritance – the ability of an object to have the same attributes and methods common to the class of objects it belongs.

Introduction to object- oriented design Attributes – An object’s data is stored in attributes – Attributes are the properties or characteristics that describe that particular object – Objects of the same class will have an identical set of attributes

Introduction to object- oriented design Methods – Objects usually have a set of operations called ‘methods’ – Includes all operations required to be performed on an object, and are the same as modules in procedural programming

Introduction to object- oriented design Class diagram – Object-oriented programming requires classes, attributes and methods to be represented in a class diagram – Consists of a rectangular box divided into three section with the name of the class at the top, the attributes of the class in the middle and the methods at the bottom

Introduction to object- oriented design Class name Attribute 1 Attribute 2 … Method 1 Method 2 … Car Make Model Doors BodyLength EngineSize Color Speed Accelerate() Stop() Brake() Turn(direction)

Introduction to object- oriented design SVU478 : Car Make = “Toyota” Model = “Corolla” Doors = 5 BodyLength = 200 EngineSize = 4 Color = “Red” Speed = 60 Accelerate() Stop() Brake() Turn(direction) RVJ635 : Car Make = “Ford” Model = “Falcon Doors = 4 BodyLength = 300 EngineSize = 6 Color = “Blue” Speed = 0 Accelerate() Stop() Brake() Turn(direction)

Introduction to object- oriented design Encapsulation and information hiding – Objects are said to be encapsulate (enclose together in a single indivisible unit) – In object-oriented design, each object can be regarded as a ‘black box’ whose internal workings are hidden from all other objects

OO Design - Example Design a class that will receive a fraction in the form of a numerator and a denominator, convert that fraction to a percentage and print the result. Your program is to use OO design techniques InputProcessingOutput nume deno Get nume, deno Convert fraction to percentage Print percentage percentage Defining Diag. in Procedural technique

OO Design - Example Class diag. in OO design Fraction Nume Deno setFraction() convertFraction() printPercentatge()

11.2 Public and private access methods

Necessary to consider whether the attributes and operations of an object are to have private or public access This concept is called ‘visibility’ Private access means that the attribute and methods are invisible to the rest of the system Public access means that the operation is visible other objects

Public and private access methods Instantiating objects – Every time an object is instantiated from a class, a special operation, or set of instructions known as a ‘constructor’ method is called or invoked – Constructors may: Have no parameters – new objects is assigned all the default vales for its attribute Have parameters that initialise the attributes with specific values

Accessors and mutators – The values in the attributes of an object should be available to all operations in that object, but hidden from external objects – Accessor operations pass attribute values to external objects – Mutator operations enable objects to change the values stored in attributes Public and private access methods

Message – Communication is achieved when one object passes a message to another – Message from one object to another usually initiates the processing of an operation in the receiving object Public and private access methods

11.3 Steps in creating an object- oriented solution

Three steps in creating an object- oriented solution for a problem with just one class: 1.Identify the objects and their attributes, responsibilities and operations 2.Design the algorithms for the operations and methods using structured design 3.Develop a test or driver algorithm to test the solution

Summary Object-oriented design focuses on the objects that make up a program rather than on the processes. An object can be defined as a container for both a set of characteristics and a set of operations that can be performed on the data. Objects encapsulate their data and operations, and can be regarded as ‘black boxes’ for the purposes of large system design.

Summary Operations that are accessible by external objects are described as having public access. Operations that are internal to the object are described as having private access.

Summary The steps in designing an object- oriented solution for a programming problem are: 1.Identify the classes and their attributes, responsibilities and operations. 2.Design the algorithms for the operation, using structured design. 3.Develop a test or driver algorithm to test the solution.