Chapter 11 An introduction to object-oriented design.

Slides:



Advertisements
Similar presentations
Looking inside classes Fields, Constructors & Methods Week 3.
Advertisements

When is Orientated Programming NOT? Mike Fitzpatrick.
Chapter 10 THINKING IN OBJECTS 1 Object Oriented programming Instructor: Dr. Essam H. Houssein.
Solutions to Review Questions. 4.1 Define object, class and instance. The UML Glossary gives these definitions: Object: an instance of a class. Class:
Visual C++ Programming: Concepts and Projects Chapter 13A: Object-Oriented Programming (Concepts)
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.
2-1 © Prentice Hall, 2007 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
Slide 1 Systems Analysis & Design CS183 Spring Semester 2008 Dr. Jonathan Y. Clark Course Website:
C# Programming: From Problem Analysis to Program Design1 Creating Your Own Classes C# Programming: From Problem Analysis to Program Design 3rd Edition.
© 2005 Prentice Hall8-1 Stumpf and Teague Object-Oriented Systems Analysis and Design with UML.
Object Oriented Programming.  OOP Basic Principles  C++ Classes  September 2004  John Edgar 22.
ASP.NET Programming with C# and SQL Server First Edition
Chapter 13: Object-Oriented Programming
Introduction to Object Oriented Design Lecture 11.
Object Oriented Software Development
Chapter 4 Objects and Classes.
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill CampusDr. Paul Walcott COMP6325 Advanced Web Technologies Dr. Paul Walcott The University.
Writing Classes (Chapter 4)
An Object-Oriented Approach to Programming Logic and Design
Object Oriented Concepts & Principles Ingrid Kirschning & Gerardo Ayala.
OBJECT ORIENTED PROGRAMMING CONCEPTS ISC 560. Object-oriented Concepts  Objects – things names with nouns  Classes – classifications (groups) of similar.
Introduction to Objects Adapted from “TEN STEPS TO OBJECT-SPEAK” a CPT Tech Talk by Joy Starks September 17, 1999.
Unified Modeling Language, Version 2.0
An Introduction to Java Chapter 11 Object-Oriented Application Development: Part I.
Chapter 6 Object-Oriented Java Script JavaScript, Third Edition.
Advanced Object- Oriented Programming Programming Right from the Start with Visual Basic.NET 1/e 14.
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.
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.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 4 Defining Your Own Classes.
Topic 1 Object Oriented Programming. 1-2 Objectives To review the concepts and terminology of object-oriented programming To discuss some features of.
Chapter 10 Defining Classes. The Internal Structure of Classes and Objects Object – collection of data and operations, in which the data can be accessed.
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.
Programming with Microsoft Visual Basic 2012 Chapter 11: Classes and Objects.
CS451 - Lecture 2 1 CS451 Lecture 2: Introduction to Object Orientation Yugi Lee STB #555 (816) * Acknowledgement:
Chapter 5 Introduction to Defining Classes
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 12 Object-Oriented Programming Starting Out with Games & Graphics.
Chapter 12 Object-oriented design for more than one class.
1 Unified Modeling Language, Version 2.0 Chapter 2.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 27 I Love this Class.
Slide 1 Systems Analysis and Design With UML 2.0 An Object-Oriented Approach, Second Edition Chapter 2: Introduction to Object-Oriented Systems Analysis.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Chapter 11 An introduction to object-oriented design.
Java Programming, Second Edition Chapter Three Using Methods, Classes, and Objects.
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.
Basic Characteristics of Object-Oriented Systems
CPS120: Introduction to Computer Science Lecture 16A Object-Oriented Concepts.
Chapter 5 Introduction to Defining Classes Fundamentals of Java.
2-1 © Prentice Hall, 2004 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
Programming Logic and Design Seventh Edition
The Movement To Objects
Topics Procedural and Object-Oriented Programming Classes
Microsoft Visual Basic 2005: Reloaded Second Edition
Object Oriented Concepts -I
Creating Your OwnClasses
Chapter 7 Classes & Objects.
Encapsulation & Visibility Modifiers
Corresponds with Chapter 7
Programming with Microsoft Visual Basic 2008 Fourth Edition
Chapter 9 Classes & Objects.
Lecture Set 11 Creating and Using Classes
Object-Oriented Programming: Inheritance and Polymorphism
CIS16 Application Development and Programming using Visual Basic.net
Introduction to Object-Oriented Programming
Chapter 11 Abstraction - The concept of abstraction is fundamental in
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 – 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 – Object is created from a template or pattern, called a class which defines the basic relationship, attributes and operations available to the objects of that class – Each class in a system should bear a unique name – Process of creating objects from classes is called instantiation and an object is described as an instance of its class

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 Inheritance – Allows a new object to inherit the same attributes and methods as an existing object

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

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.