Fundamentals of OO. CSCI 265Dale Roberts Example: Classroom Attending the lecture we have several individuals –Wade - loves Chinese food –George - an.

Slides:



Advertisements
Similar presentations
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 12Slide 1 Software Design l Objectives To explain how a software design may be represented.
Advertisements

Visual Basic: An Object Oriented Approach 2 – Designing Software Systems.
1 Chapter 6: Extending classes and Inheritance. 2 Basics of Inheritance One of the basic objectives of Inheritance is code reuse If you want to extend.
Object-Oriented Analysis and Design: Object Modeling – Class Diagrams
Chapter 22 Object-Oriented Systems Analysis and Design and UML Systems Analysis and Design Kendall and Kendall Fifth Edition.
Georgia Institute of Technology Workshop for CS-AP Teachers Chapter 3 Advanced Object-Oriented Concepts.
Classes and Object- Oriented... tMyn1 Classes and Object-Oriented Programming The essence of object-oriented programming is that you write programs in.
OBJECT-ORIENTED PROGRAMMING. What is an “object”? Abstract entity that contains data and actions Attributes (characteristics) and methods (functions)
ITEC200 – Week03 Inheritance and Class Hierarchies.
2-1 © Prentice Hall, 2007 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
1 Software Testing and Quality Assurance Lecture 12 - The Testing Perspective (Chapter 2, A Practical Guide to Testing Object-Oriented Software)
L3-1-S1 OO Concepts © M.E. Fayad SJSU -- CMPE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room.
Chapter Object-Oriented Practices. Agenda Object-Oriented Concepts Terminology Object-Oriented Modeling Tips Object-Oriented Data Models and DBMSs.
Irwin/McGraw-Hill Copyright © 2004 The McGraw-Hill Companies. All Rights reserved Whitten Bentley DittmanSYSTEMS ANALYSIS AND DESIGN METHODS6th Edition.
OBJECT ORIENTED ANALYSIS & DESIGN Vassilka Kirova Department of Computer & Information Science NJIT.
OBJECT ORIENTED ANALYSIS & DESIGN Vassilka Kirova Department of Computer & Information Science NJIT.
7M701 1 Class Diagram advanced concepts. 7M701 2 Characteristics of Object Oriented Design (OOD) objectData and operations (functions) are combined 
1 Inheritance and Polymorphism Inheritance (Continued) Polymorphism Polymorphism by inheritance Polymorphism by interfaces Reading for this lecture: L&L.
Requirements Analysis 2 What objects collaborate to achieve the goal of a use case?
Object-oriented Programming Concepts
Lecture 13: Object- Oriented Concepts Anita S. Malik Adapted from Schach (2004) Chapter 7.
Chapter 10 Classes Continued
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter N - 1 Chapter 13 Polymorphism is-a relationships Interfaces.
2-1 © Prentice Hall, 2004 Chapter 2: Introduction to Object Orientation (Adapted) Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra,
Object-oriented design CS 345 September 20,2002. Unavoidable Complexity Many software systems are very complex: –Many developers –Ongoing lifespan –Large.
CSCI-383 Object-Oriented Programming & Design Lecture 15.
The Unified Modeling Language (UML) Class Diagrams.
2.5 OOP Principles Part 1 academy.zariba.com 1. Lecture Content 1.Fundamental Principles of OOP 2.Inheritance 3.Abstraction 4.Encapsulation 2.
CPT 140 Programming Constructs1 OBJECT ORIENTED TECHNOLOGY Terminology and Basic Concepts.
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.
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.
Polymorphism, Inheritance Pt. 1 COMP 401, Fall 2014 Lecture 7 9/9/2014.
Database Management System Prepared by Dr. Ahmed El-Ragal Reviewed & Presented By Mr. Mahmoud Rafeek Alfarra College Of Science & Technology Khan younis.
11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
Object-Oriented Modeling Chapter 10 CSCI CSCI 1302 – Object-Oriented Modeling2 Outline The Software Development Process Discovering Relationships.
CS3773 Software Engineering Lecture 04 UML Class Diagram.
OBJECT-ORIENTED PROGRAMMING (OOP) WITH C++ Instructor: Dr. Hany H. Ammar Dept. of Electrical and Computer Engineering, WVU.
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.
Design Model Lecture p6 T120B pavasario sem.
Relationships Relationships between objects and between classes.
Object Oriented Analysis: Associations. 2 Object Oriented Modeling BUAD/American University Class Relationships u Classes have relationships between each.
ITEC 3220A Using and Designing Database Systems Instructor: Gordon Turpin Course Website: Office: CSEB3020.
Object Oriented Analysis and Design Class and Object Diagrams.
CSC 131 Fall 2006 Lecture # 6 Object-Oriented Concepts.
CS451 - Lecture 2 1 CS451 Lecture 2: Introduction to Object Orientation Yugi Lee STB #555 (816) * Acknowledgement:
Chapter 12 Object-oriented design for more than one class.
1 Introduction to Classes. 2 Terms and Concepts A class is... –The most important building block of any object- oriented system. –A description of a set.
Chapter 4 Basic Object-Oriented Concepts. Chapter 4 Objectives Class vs. Object Attributes of a class Object relationships Class Methods (Operations)
Banaras Hindu University. A Course on Software Reuse by Design Patterns and Frameworks.
Chapter 11: Inheritance and Composition. Introduction Two common ways to relate two classes in a meaningful way are: – Inheritance (“is-a” relationship)
COP 4331 – OOD&P Lecture 7 Object Concepts. What is an Object Programming language definition: An instance of a class Design perspective is different.
Concepts in Object-Oriented Design CSCI 240 Dale Roberts, Lecturer Computer Science, IUPUI
CSCI 383 Object-Oriented Programming & Design Lecture 15 Martin van Bommel.
Java Programming: Guided Learning with Early Objects Chapter 9 Inheritance and Polymorphism.
2-1 © Prentice Hall, 2004 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
Object-oriented programming (OOP) is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their.
UML Diagrams: Class Diagrams The Static Analysis Model
The Movement To Objects
Object-Oriented Analysis and Design
Fundamentals of OO.
Object Oriented Analysis and Design
Concepts in Object-Oriented Design
Object Oriented Analysis and Design
Chapter 22 Object-Oriented Systems Analysis and Design and UML
The Object Paradigm Classes – Templates for creating objects
Presentation transcript:

Fundamentals of OO

CSCI 265Dale Roberts Example: Classroom Attending the lecture we have several individuals –Wade - loves Chinese food –George - an outdoorsman –Wendle - is a sports nut –Lee - doesn't eat anything with a vowel in its name These are the students of our lecture Wade GeorgeWendle Lee

CSCI 265Dale Roberts Abstraction and Classes From our perspective, we see them as an instantiation of a "Class", Student –has a name –attends class –has a grade –completes assignments A Class defines an "Abstraction" OO Abstractions are based on –data (name, attendance) "Attributes" simple access –behavior (completes assignments, attends class) "Operations/Methods" complex properties –relationships (student in course) external implementations

CSCI 265Dale Roberts Objects, Instances of a Class Classes define what properties will exist Objects provide distinct instances that exhibit those properties George : Student · Name=“George” · Attendence=100% · Current Grade=A Lee : Student · Name=“Lee” · Attendence=85% · Current Grade=B Class Objects Notice that the data members are replicated in each object. Each object is an instance of Student. It does not make sense to replicate member functions.

CSCI 265Dale Roberts Encapsulation and Objects Classes form the interface for interaction, Objects provide the implementation –they are instances of a class (student) –they have unique behavior –they have state Student · GetName() ClassObjects

CSCI 265Dale Roberts Messaging Supports Encapsulation We interact with objects through "messages" Messages allow object to determine implementation rather than the sender determining the implementation for each instance

CSCI 265Dale Roberts Polymorphism Supports Encapsulation Allows an object of any implementation type, which satisfies the interface defined by the abstraction, to be used by a generic reference to an abstraction. Promotes a separation of interface and implementation float calculate Score(Student s); GraduateStudent Wade; calculateScore(Wade)

CSCI 265Dale Roberts Hierarchies Organize lower level abstractions into more complex abstractions Hierarchies allow more complex abstractions to be understood Two basic forms –Inheritance Generalization - Specialization Base Class - Derived Class Parent - Child Abstract Class - Concrete Class –Aggregation Whole - Part Containership Collection Group

CSCI 265Dale Roberts Inheritance Hierarchy an "is-A" relationship Inheritance –for type - a re-use of common interface –for class - a re-use of common interface and implementation Person · Name Student · Name · Attendence · Current Grade

CSCI 265Dale Roberts Aggregation Hierarchy a "has-A" relationship assembly-part - where the aggregation of parts makes up the whole –ex: airplane is an aggregation of wings, wheels, motor, prop, etc. container-contents - where the container exists with or without contents –ex: classroom is an aggregation of students, instructor, tables, chairs, etc. group-member - where members are logically associated with whole –ex: course has students and teachers as members "weak has-A" - where there is more of a peer-to-peer relationship between abstractions (association) –ex: Instructor has students, Students have instructor

CSCI 265Dale Roberts Summary of Object-Oriented Concepts Abstraction –Class –Attribute –Behavior –Relations –Encapsulation Object –Message –Polymorphism Hierarchies –Inheritance –Aggregation “Is-A” relationships are implemented through inheritance. “Has-A” relationships are implemented through data members. Data structures are used to implement the various “Has-A” relationships. For example, multiple children are maintained through container data structures such as arrays and linked lists.

CSCI 265Dale Roberts Comparison of Functional vs. OO Views Register Student Print Transcript Submit Grade Students Grades Student/Grades

CSCI 265Dale Roberts Addition of a New Student Type Changes in data types cause significant impact to functional approaches OO approaches allow new object types to re-define functionality Register Student Print Transcript Submit Grade Students Students/ Pass Fail Students Grades/PF Student/Grades/PF Impact Areas function override

CSCI 265Dale Roberts Addition of New Report Type Changes in functionality based on stable data causes significant impact across objects Functional approaches allow new functions to augment functionality Print Transcript Submit Grade Students Grades Student/Grades/PF Register Student Print Report Card Student/Grades/PF Impact Areas

CSCI 265Dale Roberts Re-organization of OO Abstractions Data dependent behavior handled by derived classes New functionality handled by new associated classes ("wrappers", "adapters", "views")

CSCI 265Dale Roberts Exercise: Identifying OO Properties Provide examples of the following concepts using an Answering Machine. –Class: –Attribute: –Behavior: –Object: –Association: –Inheritance: –Aggregation:

CSCI 265Dale Roberts Provide examples of the following concepts using a domain you are familiar with. Prepare your results on a transparency for presentation to the class. –Class: –Attribute: –Behavior: –Object: –Association: –Inheritance: –Aggregation: Assignment: Identifying OO Properties

CSCI 265Dale Roberts Sample Package View

CSCI 265Dale Roberts Sample Class View Notice that this sample class view does not include visibility indicators. Diamond implies composition: All MediaTopics together comprise a CardCatalog.

CSCI 265Dale Roberts Acknowledgements This presentation is an adaptation of material developed by Jim Stafford, John Hopkins University. Used by permission.