Class Relationships Lecture Oo10 Dependencies. References n Booch, et al, The Unified Modeling Language User Guide, Chapt 5 p.69, Chapt 9 130, Chapt 10.

Slides:



Advertisements
Similar presentations
Data Structures A data structure is a collection of data organized in some fashion that permits access to individual elements stored in the structure This.
Advertisements

Programming Languages and Paradigms
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 12Slide 1 Software Design l Objectives To explain how a software design may be represented.
Abstract Data Types Data abstraction, or abstract data types, is a programming methodology where one defines not only the data structure to be used, but.
Design Patterns for Object Oriented systems CSC 515 Ashwin Dandwate.
1 Software Testing and Quality Assurance Lecture 12 - The Testing Perspective (Chapter 2, A Practical Guide to Testing Object-Oriented Software)
CHAPTER 3 COLLECTIONS Abstract Data Types. 2 A data type consists of a set of values or elements, called its domain, and a set of operators acting on.
Objects and Classes First Programming Concepts. 14/10/2004Lecture 1a: Introduction 2 Fundamental Concepts object class method parameter data type.
Software Testing and Quality Assurance
Java Collections. Lecture Objectives To understand the concepts of Java collections To be able to implement Java programs based on Collections.
Class template Describing a generic class Instantiating classes that are type- specific version of this generic class Also are called parameterized types.
Spring 2010CS 2251 Design Patterns. Spring 2010CS 2252 What is a Design Pattern? "a general reusable solution to a commonly occurring problem in software.
Slides prepared by Rose Williams, Binghamton University Chapter 16 Collections and Iterators.
Lecture 9 Concepts of Programming Languages
 By Wayne Cheng.  Introduction  Five Tenets  Terminology  The foundation of C++: Classes.
Object Oriented Software Development
Software Construction Lecture 5 Class Diagrams. Agenda 2  Topics:  Examples of class diagrams  Navigation, visibility, named associations, and multiplicity.
Sadegh Aliakbary Sharif University of Technology Fall 2011.
JAVA Introduction ● One of the main JAVA design goal is reducing complexity for programmer – Development time is half or less comparing to equivalent C++
CSE 332: Design Patterns (Part I) Introduction to Design Patterns Design patterns were mentioned several times so far –And the Singleton Pattern was discussed.
Unified Modeling Language, Version 2.0
1-1 Generic Types in Java Format for a generic (parameterized) type and instantiation of a generic type.
Copyright © 2002, Systems and Computer Engineering, Carleton University Patterns.ppt * Object-Oriented Software Development Part 11.
Creational Patterns CSE301 University of Sunderland Harry R Erwin, PhD.
Object Diagram Notation Lecture Oo11 Object Visibility.
Generic abstraction  Genericity  Generic classes  Generic procedures Programming Languages 3 © 2012 David A Watt, University of Glasgow.
Genericity Ranga Rodrigo Based on Mark Priestley's Lectures.
L11-12: Design Patterns Definition Iterator (L4: Inheritance)‏ Factory (L4: Inheritance)‏ Strategy (L5: Multiple Inheritance)‏ Composite (L6: Implementation.
Software Design Patterns (1) Introduction. patterns do … & do not … Patterns do... provide common vocabulary provide “shorthand” for effectively communicating.
Chapter 8 Object Design Reuse and Patterns. Object Design Object design is the process of adding details to the requirements analysis and making implementation.
Design Patterns CS 124 Reference: Gamma et al (“Gang-of-4”), Design Patterns.
Design Patterns CSIS 3701: Advanced Object Oriented Programming.
Define an interface for creating an object, but let subclasses decide which class to instantiate Factory Method Pattern.
Define an interface for creating an object, but let subclasses decide which class to instantiate.
Types in programming languages1 What are types, and why do we need them?
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
Lecture 4 Generic programming Advanced Java Programming 1 dr hab. Szymon Grabowski dr inż. Wojciech Bieniecki
ICOM 4035 – Data Structures Dr. Manuel Rodríguez Martínez Electrical and Computer Engineering Department.
Sadegh Aliakbary. Copyright ©2014 JAVACUP.IRJAVACUP.IR All rights reserved. Redistribution of JAVACUP contents is not prohibited if JAVACUP.
Overview of C++ Templates
Design Patterns: Elements of Reusable Object- Orientated Software Gamma, Helm, Johnson, Vlissides Presented By: David Williams.
Methodology First and Language Second -A Way to Teach Object-Oriented Programming Haibin Zhu, PhD Department of Computer Science and Mathematics Nipissing.
1 Unified Modeling Language, Version 2.0 Chapter 2.
Chapter 16 UML Class Diagrams 1CS6359 Fall 2012 John Cole.
Chapter 5 Classes and Methods II Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
Use Case Diagrams Lecture Oo14 Use Cases. References n Booch, et al, The Unified modeling Language User’s Guide, AWL, 1999, Chapt 16 & 17 n Fowler & Scott,
1 Copyright © 1998 by Addison Wesley Longman, Inc. Chapter 10 Abstraction - The concept of abstraction is fundamental in programming - Nearly all programming.
Class Relationships Lecture Oo07 Generalization Relationships.
Class Relationships Lecture Oo08 Polymorphism. References n Booch, et al, The Unified Modeling Language User Guide, Chapt 10 p.125 n Fowler & Scott, UML.
Class Diagrams Revisited. Parameterized Classes Parameterized Classes - are used to represent relationships between templates.
Introduction to Unified Modeling Language (UML) By Rick Mercer with help from The Unified Modeling Language User Guide, Grady Booch, James Rumbaugh, Ivar.
ISBN Chapter 12 Support for Object-Oriented Programming.
CSC 243 – Java Programming, Fall, 2008 Tuesday, September 30, end of week 5, Interfaces, Derived Classes, and Abstract Classes.
Command Pattern. Intent encapsulate a request as an object  can parameterize clients with different requests, queue or log requests, support undoable.
Slide 1 Unified Modeling Language, Version 2.0 Object-Oriented SAD.
Design Patterns: MORE Examples
Unified Modeling Language (UML)
Type Checking Generalizes the concept of operands and operators to include subprograms and assignments Type checking is the activity of ensuring that the.
Chapter 10 Design Patterns.
Object-Oriented Modeling with UML
CS 326 Programming Languages, Concepts and Implementation
11.1 The Concept of Abstraction
JAVA Introduction ការណែនាំពី Java
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING (OOP) & CONCEPTS
Advanced Programming Behnam Hatami Fall 2017.
Introduction to Unified Modeling Language (UML)
Abstract Class As per dictionary, abstraction is the quality of dealing with ideas rather than events. For example, when you consider the case of ,
The Object Model Lecture OO02 Classes as Abstract Data Types
Chapter 11 Abstraction - The concept of abstraction is fundamental in
Presentation transcript:

Class Relationships Lecture Oo10 Dependencies

References n Booch, et al, The Unified Modeling Language User Guide, Chapt 5 p.69, Chapt 9 130, Chapt 10 p.137. n Gamma, Helm, Johnson, Vlissides, Design Patterns, AWL, 1995

Teaching Points n Dependency n Parameterized Classes n Abstract Factory

Review n What is the difference between aggregation and composition? n Factory Method

Dependencies n A dependency exists between to classes (or other elements) if changes to the definition of one element may cause changes to the other n Ideally we are considering changes to interface n not as strong as an association relationship

Dependencies n An object of one class creates an object of another class

Dependencies n An object of one class sends a message to another but the sending object is not responsible for keeping track of the receiving object (which would be association)

Dependencies n one class mentions another as a parameter to an operation

Parameterized Class n Classes hide and manipulate data/objects n Often we want to specify the way in which data/objects are stored and manipulated without actually specifying the actual type of the data/objects n Parameterized classes allow types to be a parameters in the class or function definitions

Parameterized Class n Used mainly for containers –sometimes for other novel implementations n Also known as –“Templates” in C++ –“Generics” in Ada

Example n Stacks are a general concept n We might want to have stacks of int, char, complex, or some other user defined objects n We would like to describe stacks in terms of some unknown type (say T), a type parameter, and provide an actual real type when we need a stack.

Example n Here T is a type parameter

Binding Relationship n Sometimes called “instantiation” –Note: this is not the same as object instantiation n A new class created by specifying an actual type is called a “bound element” n “Binding” is a kind of dependency relationship between a class which is a bound element and a parameterized class

Example Here complex is an actual type which is substituted for the type parameter T

Java Example interface List { void add(E x); Iterator iterator(); } class LinkedList implements List { // implementation } class AnotherClass { LinkedList strList = new LinkedList (); someMethod() { strList.add(“Hello, World!”); string returnStr = strList.getHead(); }

Parameterized Classes vs. Generalization n A bound element (instantiated class) is a “kind-of” the parameterized class n But this is not Generalization n Binding merely restricts the type(s) used but the interface remains the same n Instantiation provides no mechanism for adding new functionality (state or interface)

Parameterized Classes and Generalization –Note: Alternate notation for binding

Abstract Factory Pattern n Provide an interface for creating families of related or dependent objects without specifying their concrete classes.

Teaching Points n Dependency n Parameterized Classes n Abstract Factory