Presentation is loading. Please wait.

Presentation is loading. Please wait.

Things and Relations - Examples Things Relationships Structural Behavioral Grouping Annotational Dependency Association Generalization Realization Class,

Similar presentations


Presentation on theme: "Things and Relations - Examples Things Relationships Structural Behavioral Grouping Annotational Dependency Association Generalization Realization Class,"— Presentation transcript:

1 Things and Relations - Examples Things Relationships Structural Behavioral Grouping Annotational Dependency Association Generalization Realization Class, Object, Interface, Collaboration, Use Case, Active class, Component, Node. Interaction, State Machine Packages

2 Class class Window{ private Point origin; private Dimension size; public void open(){... } public void close(){... } public void move(int x, int y){... } public void display(){... } Window -origin -size +open() +close() +move() +display() Responsibilities Maintain window parameters Update display + : Public - : Private # : Protected

3 Class Window -origin -size +open() +close() +move() +display() Window +open() +close() +move() +display() Window -origin -size Some of the fields may be omitted if the contents are irrelevant in that context.

4 Objects win : Window Window win = new Window(); Objects are underlined, and a few representations are shown below. win: Window

5 Interface interface Actions{ public void clicked(); public void mouseOver(); } class MyProg implements Actions{... public void clicked(){... }... public void mouseOver(){... }... } MyProg Actions An interface is usually drawn with a class that implements the behavior.

6 Collaboration A collaboration is a society of classes, interfaces, and other elements that work together to provide some cooperative behavior that’s bigger than the sum of all elements. Party Submit Offer Process Offer House Buyer Seller Sale

7 Use Case A use case is a description of a set of sequences of actions that a system performs to yield an observable result to an actor.A use case is a description of a set of sequences of actions that a system performs to yield an observable result to an actor. A use case represents a functional requirement of a system.A use case represents a functional requirement of a system. A use case captures the intended behavior of a system without having to specify how the behavior is implemented. (A use case is normally implemented as a collaboration)A use case captures the intended behavior of a system without having to specify how the behavior is implemented. (A use case is normally implemented as a collaboration)

8 Use Cases (Library Example) Book Checkout Browse Database Book Return Process Payment

9 Active Class An active class has methods to initiate concurrent processes or threads. Screen playSound() loadImage() waitforInput()

10 Components and Nodes Animator juggler controller

11 Interaction Messages exchanged between a set of objects to accomplish a purpose. class TicketAgent{ void reserveFlight(){... } TicketAgent t = new TicketAgent(); t.reserveFlight(); : Customer t : TicketAgent reserveFlight()

12 State class Test{ boolean flag = true; void putOff(){ flag = false; }... } True False putOff()

13 Packages and Annotations java util awt lang Abstract Windowing Toolkit

14 Dependency class Geometry{ void compute(Rectangle r){... } Geometry compute() Rectangle One class uses another class as an argument in a method.

15 Association Objects of one class are connected (pass messages) to objects of another Customer TicketAgent

16 Aggregation A special type of association where the classes have “whole/part” relationship. The classes satisfy “has-a” rule. (Composition). class Car{ Tyre t1 = new Tyre(); Tyre t2 = new Tyre(); Tyre t3 = new Tyre(); Tyre t4 = new Tyre();... } Car Tyre 1 4

17 Generalization A relationship where one class is a super class of another. The classes satisfy “is-a” rule. (Inheritance). class Rectangle{... } Rectangle Square class Square extends Rectangle {... }

18 Realization One class implements the behavior specified by another. interface Actions{... } Actions MyProg class Myprog implements Actions {... } Note: Another notation for the above is on Slide 5.


Download ppt "Things and Relations - Examples Things Relationships Structural Behavioral Grouping Annotational Dependency Association Generalization Realization Class,"

Similar presentations


Ads by Google