



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An overview of uml (unified modeling language), a modeling language used for specifying, visualizing, constructing, and documenting object-oriented software. Uml helps in creating a software 'blueprint' with a simple yet clear abstraction for software design. The history of uml, uml diagrams, and the relationship between uml class diagrams and java code. It includes examples of class diagrams and their mapping to java code.
Typology: Study notes
1 / 7
This page cannot be seen from the preview
Don't miss anything!




Specifying Visualizing Constructing Documenting
Difficult to describe and analyze
Visualize design of software Provide abstract model of software
Simple yet clear abstraction for software
Clearly Concisely Correctly
OMT (James Rumbaugh) OOSE (Ivar Jacobson) Booch (Grady Booch)
Describe a model of all or part of system From a particular point of view With varying level of abstraction Using certain set of notations
System Model 1
Model 2
View 1 View 3
View 2
Class Diagram
Information for class Relationships between classes
Class Diagram
Batteryload()
1 2 PushButtonstate Timenow() push()release()
1 1
1 1
1 2 blinkIdxblinkSeconds() blinkMinutes()blinkHours() stopBlinking()referesh()
LCDDisplay
SimpleWatch
Class
Multiplicity Association
Attributes Operations
Class diagrams represent structure of system
Class Diagrams
Name State Behavior
Class Diagram
State, behavior Types, visibility…
UML Class Diagrams ↔ Java Code
Name, state, behavior of class Relationships between classes
UML ⇒ Java Implement code based on design written in UML Java ⇒ UML Create UML to document design of existing code
Java → UML : Clock Example
class Clock { // name // state int seconds; int minutes; int hours; // behavior void start(); void adjustTime(); void reset(); }
Association w/ Navigation
Relationship between classes may be directional Only class A can send messages to class B Arrowhead indicates direction of relationship
class Course { class Lecturer { Lecturer TheBoss; … } }
Association w/o Navigation
Relationship between classes may be bi-directional Direction of relationship may be unknown
class Course { class Lecturer { Lecturer TheBoss; Course [ ] class; } }
class Foo class Bar
Permanent Association
Class A contains reference to class B in data field Can view as “has a” relationship Also referred to as composition
class A { class B { B x; … } }
A has a B
Temporary Association (Dependency)
Always directed (class A depends on B) Indicates change in class B may affect class A Can view as “uses a” relationship Represented by dotted line with arrowhead
A depends on B
Dependency
Local variable Parameter Return value
class A { class B { B foo(B x) { … B y = new( ); … … … } } }
UML Examples
Try to understand relationships Practice converting to / from Java code
Computer disk organization Banking system Home heating system Printing system
UML Example – Computer System
UML Example – Banking System
UML Example – Home Heating System
UML Example – Library System
UML → Java : Computer System
class Controller { } class SCSIController extends Controller { }
UML → Java : Computer System
Design code using all available information in UML…
Amateras UML Editor – Eclipse Plugin Violet UML Editor
Auto creates class w/ attributes & methods
No undirected associations Use directed association in both directions instead
Violet UML Editor – Eclipse Plugin UML Summary
Contents of a class Relationship between classes
Draw UML class diagram given Java code Write Java code given UML class diagram