Chapter 5_Object Modeling_UML
Chapter 5_Object Modeling_UML
2
Object-oriented Analysis
▪ The Unified Modeling Language (UML) is a widely used method of
visualizing and documenting an information system. In this chapter, the
UML is used to develop object models.
▪ The first step is to understand basic O-O terms, including objects,
attributes, methods, messages, and classes.
▪ This chapter shows how systems analysts use those terms to describe an
information system.
3
Objects
4
Objects
5
Attributes
▪ An object has certain attributes, which are characteristics that describe the
object. If objects are similar to nouns, attributes are similar to adjectives
that describe the characteristics of an object. For example, a car has
attributes such as make, model, and color.
▪ Objects can have a specific attribute called a state. The state of an object is
an adjective that describes the object’s current status. For example,
depending on the state, a student can be a future student, a current
student, or a past student.
6
Methods
▪ An object also has methods, which are tasks or functions that the object
performs when it receives a message, or command, to do so. For example,
a car performs a method called OPERATE WIPERS when it is sent a
message with the wiper control, and it can APPLY BRAKES when it is sent a
message by pressing the brake pedal.
▪ Just as objects are similar to nouns and attributes are similar to adjectives,
methods resemble verbs that describe what and how an object
does something.
7
Messages
▪ For example, the message PICK UP TOYS directs the CHILD class to
perform all the necessary steps to pick up the toys. The CHILD class
understands the message and executes the method
8
Messages
▪ The same message to two different objects can produce different results.
The concept that a message gives different meanings to different objects
is called polymorphism.
▪ For example, in Figure 6-4, the message GOOD NIGHT signals the PARENT
object to read a bedtime story, but the same message to the CHILD object
signals it to get ready for bed. If the family also had a DOG object, the
same message would tell the dog to sleep.
9
Messages
10
Messages
▪ An object can be viewed as a black box, because a message to the object
triggers changes within the object without specifying how the changes
must be carried out.
11
Messages
12
Classes
▪ An object belongs to a group or category called a class. For example, Ford
Fiestas belong to a class called CAR. An instance is a specific member of a
class. A Toyota Camry, for example, is an instance of the CAR class.
▪ All objects within a class share common attributes and methods, so a class
is like a blueprint or template for all the objects within the class. Objects
within a class can be grouped into subclasses, which are more specific
categories within a class.
13
Classes
14
Classes
15
Relationships among Objects and Classes
▪ Relationships enable objects to communicate and interact as they
perform business functions and transactions required by the system.
▪ Relationships describe what objects need to know about each other, how
objects respond to changes in other objects, and the effects of
membership in classes, superclasses, and subclasses. Some
relationships are stronger than others (just as a relationship between
family members is stronger than one between casual acquaintances).
16
Relationships
among Objects
and Classes
17
Relationships
among Objects
and Classes
18
Example 1
Tình huống:
▪ Xây dựng 1 hệ thống quản lý kho để theo dõi hàng hóa,
nhà cung cấp và đơn hàng. Hệ thống này sẽ giúp quản lý
thông tin về sản phẩm, đảm bảo rằng hàng hóa luôn sẵn có
và dễ dàng theo dõi các đơn hàng.
a. Xác định các Class cần thiết trong hệ thống.
b. Xác định Attributes và Methods trong từng class.
c. Mô tả 1 kịch bản cụ thể vận hành hệ thống kho này thể
hiện sự tương tác giữa các đối tượng thuộc các class đã
xác định.
19
Example 1
• Product
• Attributes: product_id, product_name, description,
quantity, price
• Methods: update_quantity(), get_product_detail()
• Supplier
• Attributes: supplier_id, supplier_name, contact_info
• Methods: get_supplier_info()
20
Example 1
• Order
• Attributes: order_id, product, supplier, order_date, quantity
• Methods: create_order(), get_order_summary()
• Inventory
• Attributes: products
• Methods: add_product(), remove_product(), check_inventory()
21
Example 1
• Tạo đơn hàng để đặt mua sản phẩm từ 1 nhà cung cấp
• Cập nhật số lượng sản phẩm trong kho sau khi nhập
hàng.
22
Example 2
Tình huống:
▪ Xây dựng một hệ thống quản lý điểm cho sinh viên
tại một trường đại học. Hệ thống này sẽ giúp theo
dõi thông tin về sinh viên, môn học, điểm số và quản
lý lớp học.
a. Xác định các Class cần thiết trong hệ thống.
b. Xác định Attributes và Methods trong từng class.
23
Examples
24
Class Diagram
1. https://coderkiemcom.com/blog/guide/class-diagram-va-uml-cho-phan-mem-
ban-hang-pos
2. https://drive.google.com/file/d/1YOQVrf-dxVTLI3SdIb2QGXi49AjWZIku/view
25
Use case diagram
1. https://coderkiemcom.com/blog/guide/use-case-diagram-cho-phan-mem-ban-
hang-pos
2. https://drive.google.com/file/d/1HEu8BjF6kKGoJaM4E0TSwTz7-jzN65IZ/view
26
Activity Diagram
1. https://coderkiemcom.com/blog/guide/activity-diagram-cho-phan-mem-ban-
hang-pos
27
Data Flow Diagram (DFD)
1. https://coderkiemcom.com/blog/guide/system-dfd-cho-phan-men-ban-hang-pos
28
Database Design
1. https://coderkiemcom.com/blog/guide/thiet-ke-co-so-du-lieu-he-thong-ban-
hang-va-quan-ly-kho
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Use case Diagram & Relationships
▪ https://thinhnotes.com/chuyen-nghe-ba/use-case-diagram-va-5-sai-lam-thuong-
gap/
43
THANK YOU
44