Object Oriented Programming

Slides:



Advertisements
Similar presentations
Chapter 4: Writing Classes
Advertisements

Problem Solving #1 ICS Outline Review of Key Topics Review of Key Topics Example Program Example Program –Problem 7.1 Problem Solving Tips Problem.
Writing Classes in Java
Aalborg Media Lab 27-Jun-15 Workshop / Exercises Lecture 9 Summary, Exercises.
Aalborg Media Lab 28-Jun-15 Software Design Lecture 7 “Object Oriented Design”
Programming With Java ICS201 University Of Hail1 Chapter 12 UML and Patterns.
1 CSE 403 Design and UML Class Diagrams Reading: UML Distilled Ch. 3, by M. Fowler These lecture slides are copyright (C) Marty Stepp, They may not.
1 TCSS 360, Spring 2005 Lecture Notes Design Phase and UML Class Diagrams Relevant Reading: UML Distilled, Third Edition M. Fowler.
UML January 24, 2011 CSE 403, Winter 2011, Brun Design and UML Class Diagrams.
 2008 Pearson Education, Inc. All rights reserved (Optional) Software Engineering Case Study: Identifying the Classes in the ATM Requirements.
1 (c) elsaddik CSI 1102 Introduction to Software Design Prof. Dr.-Ing. Abdulmotaleb El Saddik University of Ottawa (SITE.
Introduction to UML Lian Yu Department of Computer Science and Engineering Arizona State University Tempe, AZ
Object Oriented Design and UML
The this Reference The this reference, used inside a method, refers to the object through which the method is being executed Suppose the this reference.
CSE 1301 Lecture 11 Object Oriented Programming Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.
CSE 1302 Lecture 7 Object Oriented Programming Review Richard Gesick.
UML DIAGRAMS Unified Modeling Language for Object Oriented Programming Unified Modeling Language for Object Oriented Programming.
Chapter 6 Object-Oriented Design Part 1. © 2004 Pearson Addison-Wesley. All rights reserved2/42 Object-Oriented Design Now we can extend our discussion.
1 Object Oriented Design and UML Class Relationships –Dependency –Aggregation –Inheritance Reading for this Lecture: L&L 6.4 – 6.5.
CH06: Considering Objects TECH Computer Science  Set, Class, Type  …of…  Objects, Actors, Agents  Data and Actions Object-Oriented Design and Development.
6. Object-Oriented Design Based on Java Software Development, 5 th Ed. By Lewis &Loftus.
6. Object-Oriented Design Based on Java Software Development, 5 th Ed. By Lewis &Loftus.
UML Class Diagrams 1 These lecture slides are copyright (C) Marty Stepp, They may not be rehosted, sold, or modified without expressed permission.
1 Object Oriented Design and UML Class Relationships –Dependency –Aggregation –Interfaces –Inheritance Interfaces Reading for this Lecture: L&L 6.4 – 6.5.
Chapter 6 Object-Oriented Design. © 2004 Pearson Addison-Wesley. All rights reserved6-2 Object-Oriented Design Now we can extend our discussion of the.
Static class members.
Object Oriented Analysis: Associations. 2 Object Oriented Modeling BUAD/American University Class Relationships u Classes have relationships between each.
1 Object-Oriented Design Now we can extend our discussion of the design of classes and objects Chapter 6 focuses on: software development activities determining.
Outline Software Development Activities Identifying Classes and Objects Static Variables and Methods Class Relationships Interfaces Enumerated Types Revisited.
25/2/16. Software Design (UML) ClassName attributes operations A class is a description of a set of objects that share the same attributes, Operations.
1 Chapter 4: Writing Classes  Chapter 4 focuses on: class definitions encapsulation and Java modifiers method declaration, invocation, and parameter passing.
© 2006 Pearson Education C4 D7 Obj: to describe relationships between objects HW: p.250 #4.19 Do Now: p.248 True/False #4.6 – 4.10.
Inf 43: Introduction to Software Engineering May 7, 2016.
© 2004 Pearson Addison-Wesley. All rights reserved November 2, 2007 Class Relationships ComS 207: Programming I (in Java) Iowa State University, FALL 2007.
Java Programming: Guided Learning with Early Objects Chapter 9 Inheritance and Polymorphism.
University of Turkish Aeronautical Association Computer Engineering Department CENG 112 COMPUTER PROGRAMMING 2 Tansel Dökeroglu, Ph.D.
Chapter 9 A Second Look at Classes and Objects - 3 Aggregation.
UML Class & Object Diagram I
Design and UML Class Diagrams
Chapter 12 – Object-Oriented Design
TCSS 305 (Stepp) OO Design with UML Class Diagrams
Chapter 9 Domain Models.
Enhanced Entity-Relationship and Object Modeling Objectives
Unified Modeling Language
OBJECT ORIENTED CONCEPT
Class Diagrams.
Interface, Subclass, and Abstract Class Review
Lecture on Design Phase and UML Class Diagrams
Software Engineering System Modeling Chapter 5 (Part 2) Dr.Doaa Sami
Passing Objects to Methods
Creating and Using Classes
Lab 02 - SNAP.
Showing Relationships in UML
Object Oriented Programming
Lecture 13 Writing Classes Richard Gesick.
Object Oriented Analysis and Design
Software Engineering Lecture 10.
CIS 375 Bruce R. Maxim UM-Dearborn
Today’s topics UML Diagramming review of terms
Constant Member Functions
Basics of OOP A class is the blueprint of an object.
LECTURE 2: The Object Model
Chapter 12 – Object-Oriented Design
Object Oriented Programming Review
Class Diagram.
Introduction to UML Sources:
CIS 375 Bruce R. Maxim UM-Dearborn
Chapter 4: Writing Classes
Presentation transcript:

Object Oriented Programming Lecture 12 Object Oriented Programming Richard Gesick

Topics Identifying Classes & Objects Class Relationships “this” Parameters Overloading Methods Operators

Identifying Classes & Objects Identify potential classes within the specification Nouns

What Goes in the Class How do you decide what should be in the class Data Methods

Class Relationships Classes can have various relationships to one another. Most common are: Dependency (“uses”) Aggregation (“has a”) Inheritance (“is a”)

Object Relationships Objects can have various types of relationships to each other A general association is sometimes referred to as a use relationship A general association indicates that one object (or class) uses or refers to another object (or class) in some way We could even annotate an association line in a UML diagram to indicate the nature of the relationship Author Book writes

Dependency One class dependent (uses) another class Game uses ball, paddle Ship uses bullet Sometimes, a class depends on another instance of itself Is one date equal to another date? Is one picture equal to another picture?

Aggregation One class is “made up” of other classes “has a” relationship Gameboard has a marble Deck has a card

Aggregation An aggregate object is an object that contains references to other objects For example, an Account object contains a reference to a String object (the owner's name) An aggregate object represents a has-a relationship A bank account has a name Likewise, a student may have one or more addresses

Aggregation in UML An aggregation association is shown in a UML class diagram using an open diamond at the aggregate end StudentBody + Main (args : String[]) : void + ToString() : String 1 2 Student - firstName : String - lastName : String - homeAddress : Address - schoolAddress : Address - streetAddress : String - city : String - state : String - zipCode : long Address

UML Diagrams classes are represented with boxes that contain three compartments: The top compartment contains the name of the class. The middle compartment contains the attributes of the class. The bottom compartment contains the methods and properties

UML Diagrams Player - name:string -money:float -health: int +Player(): +Buy(float):void +GetName():string +Name:string {property} +Money:float {property} +ToString():string