UML Modeling in Java
-
Upload
daffodil-international-university -
Category
Engineering
-
view
142 -
download
2
Transcript of UML Modeling in Java
![Page 1: UML Modeling in Java](https://reader035.fdocuments.us/reader035/viewer/2022062503/58ed344a1a28abb2538b46bf/html5/thumbnails/1.jpg)
Title Layout
![Page 2: UML Modeling in Java](https://reader035.fdocuments.us/reader035/viewer/2022062503/58ed344a1a28abb2538b46bf/html5/thumbnails/2.jpg)
2
Course: CSE214 (Object Oriented Programming)Course Teacher: Ms. Rabeya Akhter (RA)Section: P Depertment: CSE(43 Batch)Group Members: 01. Md. Ashaf Uddaula (161-15-7473)02. Alamin Hossain (161-15-7483)03. Md. Khasrur Rahman (161-15-7214)04. Md. Eram Talukder (161-15-7485)05. Ijaz Ahmed Utsa (161-15-7180)
![Page 3: UML Modeling in Java](https://reader035.fdocuments.us/reader035/viewer/2022062503/58ed344a1a28abb2538b46bf/html5/thumbnails/3.jpg)
3
What Is Modeling?
• A model is a simplification with a purpose• Use precisely defined notation to describe and simplify a
complex and interesting structure, phenomenon, or relationship
• Real-world examples• The solar system model• Mathematical models
![Page 4: UML Modeling in Java](https://reader035.fdocuments.us/reader035/viewer/2022062503/58ed344a1a28abb2538b46bf/html5/thumbnails/4.jpg)
4
What Is Modeling? (cont’d)
• Simplification• Less complex, more accessible
• Varying perspectives• Describe the system from different perspectives• Help developers manage complexity
• Common notation• To facilitate communication• Allows developers to combine their efforts and to work in parallel
![Page 5: UML Modeling in Java](https://reader035.fdocuments.us/reader035/viewer/2022062503/58ed344a1a28abb2538b46bf/html5/thumbnails/5.jpg)
5
UML
• Unified Modeling Language• A language for specifying, visualizing, constructing, and documenting the
artifacts of software systems• A set of precise notations• Helps developers create ideas and communicate them
![Page 6: UML Modeling in Java](https://reader035.fdocuments.us/reader035/viewer/2022062503/58ed344a1a28abb2538b46bf/html5/thumbnails/6.jpg)
6
UMLThe Basics
Abstraction • A simplification or model of a complex concept, process, or real-world
object• Help people understand something at an appropriate level• Different people would build different abstractions for the same
concept• Highlight the characteristics and behavior of something that is too
complex to understand in its entirety
![Page 7: UML Modeling in Java](https://reader035.fdocuments.us/reader035/viewer/2022062503/58ed344a1a28abb2538b46bf/html5/thumbnails/7.jpg)
7
UMLThe Basics
Encapsulation • Highlight the important aspects of an object• Hide the cumbersome internal details of the object• Make the system easier to understand and to reuse• Make a system more extendible
![Page 8: UML Modeling in Java](https://reader035.fdocuments.us/reader035/viewer/2022062503/58ed344a1a28abb2538b46bf/html5/thumbnails/8.jpg)
8
UMLThe Basics
Union of all Modeling LanguagesUse case diagramsClass diagramsObject diagramsSequence diagramsCollaboration diagramsStatechart diagramsActivity diagramsComponent diagrams Deployment diagrams….
![Page 9: UML Modeling in Java](https://reader035.fdocuments.us/reader035/viewer/2022062503/58ed344a1a28abb2538b46bf/html5/thumbnails/9.jpg)
9
UMLThe Basics
• Object• A particular and finite element in a large model
• Visible or invisible• Persistent or transient
• State: describes characteristics and current condition• Behavior: defines the actions that other objects may perform on the
object• Method: a service or responsibility that an object exposes to other
objects• Each has a unique identifier• Limited responsibility and cooperation
myCar : ToyotaTercel
![Page 10: UML Modeling in Java](https://reader035.fdocuments.us/reader035/viewer/2022062503/58ed344a1a28abb2538b46bf/html5/thumbnails/10.jpg)
10
UMLThe Basics
Dependency Association
Aggregation Composition
Relationships between objects
![Page 11: UML Modeling in Java](https://reader035.fdocuments.us/reader035/viewer/2022062503/58ed344a1a28abb2538b46bf/html5/thumbnails/11.jpg)
11
Relationships between objectsDependency• Short-term dependency• An object may create another object as part of a method, ask it to
perform some function, and then forget about it
![Page 12: UML Modeling in Java](https://reader035.fdocuments.us/reader035/viewer/2022062503/58ed344a1a28abb2538b46bf/html5/thumbnails/12.jpg)
12
Relationships between objectsAssociation
• An object keeps a reference to another object and can call the object’s, methods as it needs them
• An object may receive an object as a parameter to a configuration method and keep a reference to the object
![Page 13: UML Modeling in Java](https://reader035.fdocuments.us/reader035/viewer/2022062503/58ed344a1a28abb2538b46bf/html5/thumbnails/13.jpg)
13
Relationships between objectsAggregation
• An object is part of a greater whole• The contained object may participate in more than one aggregation
relationship, and exists independently of the whole
![Page 14: UML Modeling in Java](https://reader035.fdocuments.us/reader035/viewer/2022062503/58ed344a1a28abb2538b46bf/html5/thumbnails/14.jpg)
14
Relationships between objectsComposition
• An object is owned by a greater whole• The contained object may not participate in more than one composition
relationship and cannot exist independently of the whole
![Page 15: UML Modeling in Java](https://reader035.fdocuments.us/reader035/viewer/2022062503/58ed344a1a28abb2538b46bf/html5/thumbnails/15.jpg)
15
UMLThe Basics• Class
• A group of objects that have something in common• Captures a particular abstraction• Provides a template for object creation• Each objects created from a class is identical in
• The type of data they can hold• The type and number of objects they know about• The logic for any behavior they provide
+attackKenDoll()
-name : String-rank : String#carryingRifle : Boolean
ToySoldier
![Page 16: UML Modeling in Java](https://reader035.fdocuments.us/reader035/viewer/2022062503/58ed344a1a28abb2538b46bf/html5/thumbnails/16.jpg)
16
UMLThe Basics
• Class Attributes -Represent the named properties of a UML class
-UML class can have many attributes of different names
-Attributes name is generally a short noun or a noun phrase written in lower Case
first text.
-Attribute decleration may include visility , type
and initial value : +attributesName: type = initial-value
![Page 17: UML Modeling in Java](https://reader035.fdocuments.us/reader035/viewer/2022062503/58ed344a1a28abb2538b46bf/html5/thumbnails/17.jpg)
17
UMLThe Basics
Class Operations -Represent named services provided by a UML class
-UML class can have many operations of different names
-Operation name is generally a short verb or a verb phrase written in
lowCase-first text
-Operation may include visibility , parameters and return type:
+opName(param1 : type = initial_value) :return_type
![Page 18: UML Modeling in Java](https://reader035.fdocuments.us/reader035/viewer/2022062503/58ed344a1a28abb2538b46bf/html5/thumbnails/18.jpg)
18
UMLThe Basics
Class Visibility -Three levels of class ,attribute and operation visibility:
private(-), available only to the current classProtected(#) , available to the current and inherited classesPublic(+), available to the current and other classes.
![Page 19: UML Modeling in Java](https://reader035.fdocuments.us/reader035/viewer/2022062503/58ed344a1a28abb2538b46bf/html5/thumbnails/19.jpg)
19
UMLThe Basics
• Class GeneralizationRepresent a relation between a parent (a more abstract class ) and a child ( a
more specific class)Generally referred to as a “ is -a –kind-of” relationshipChild object may be used instead of parent objects since they share
attributes and operations: the opposite is not true
![Page 20: UML Modeling in Java](https://reader035.fdocuments.us/reader035/viewer/2022062503/58ed344a1a28abb2538b46bf/html5/thumbnails/20.jpg)
20
Relationships between Classes
Generalization: an inheritance relationship inheritance between classes interface implementation
Association: a usage relationship Dependency Aggregation Composition
![Page 21: UML Modeling in Java](https://reader035.fdocuments.us/reader035/viewer/2022062503/58ed344a1a28abb2538b46bf/html5/thumbnails/21.jpg)
21
Generalization relationships
• Inheritance : class B is a Class A (or class A is extended by class B)
• Realization : class B realizes Class A (or class A is realized by class B)
![Page 22: UML Modeling in Java](https://reader035.fdocuments.us/reader035/viewer/2022062503/58ed344a1a28abb2538b46bf/html5/thumbnails/22.jpg)
22
Associational Relationship
• associational (usage) relationships
1. multiplicity(how many are used)
* 0, 1, or more⇒ 1 1 exactly⇒ 2..4 between 2 and 4, inclusive⇒ 3..* 3 or more⇒2. name(what relationship the objects have)
3. navigability(direction)
![Page 23: UML Modeling in Java](https://reader035.fdocuments.us/reader035/viewer/2022062503/58ed344a1a28abb2538b46bf/html5/thumbnails/23.jpg)
23
Associational Relationship• Dependency : class A uses class B
• Aggregation : class A has a class B
• Composition : class A owns a class B
![Page 24: UML Modeling in Java](https://reader035.fdocuments.us/reader035/viewer/2022062503/58ed344a1a28abb2538b46bf/html5/thumbnails/24.jpg)
24
Multiplicity of associations
One-to One
*each student must carry exactly one ID card
One-to-many
*one rectangle list van contain many rectangles
![Page 25: UML Modeling in Java](https://reader035.fdocuments.us/reader035/viewer/2022062503/58ed344a1a28abb2538b46bf/html5/thumbnails/25.jpg)
25
Class diagram example:video store
![Page 26: UML Modeling in Java](https://reader035.fdocuments.us/reader035/viewer/2022062503/58ed344a1a28abb2538b46bf/html5/thumbnails/26.jpg)
26
Modeling Software Systems with the UML
• UML enables building a single coherent model that describes a software system from several perspectives• Internal consistency• Distinct views
• Participants can use the same model and speak the same language throughout the development process
![Page 27: UML Modeling in Java](https://reader035.fdocuments.us/reader035/viewer/2022062503/58ed344a1a28abb2538b46bf/html5/thumbnails/27.jpg)
27
Modeling Process
1. The developers and customers use the UML to understand the problem from the customer’s point of view
2. The developers use UML to understand the problem from their own point of view
3. The UML model is used as a resource by the implementers of the system
![Page 28: UML Modeling in Java](https://reader035.fdocuments.us/reader035/viewer/2022062503/58ed344a1a28abb2538b46bf/html5/thumbnails/28.jpg)
28
Modeling Process (cont’d)
• Requirements gathering• Analysis• Technology selection• Architecture• Design and implementation
![Page 29: UML Modeling in Java](https://reader035.fdocuments.us/reader035/viewer/2022062503/58ed344a1a28abb2538b46bf/html5/thumbnails/29.jpg)
29
Design and Implementation
• Design• Use all the results from the previous steps• Create a model of objects that interact to provide the system’s functionality• The last chance to validate the solution
• Implementation• Write the code according to the design
END