Professional Documents
Culture Documents
SDA Lab 2
SDA Lab 2
Lab: 02
Introduction to UML
(Unified Modeling Language)
and OO(Object Oriented)
analysis:
1. Objectives:
After completing this lab, students will be able to.
• Study the benefits of visual modeling.
• Introduction to UML notations and diagrams.
• Why the UML is necessary.
• Involving Object Oriented analysis and design with UML diagrams.
• How to understand the object-oriented mindset
• How objects communicate
• How objects associate with one another
• How objects combine
3. Theory:
Visual Modeling is a way of thinking about problems using models organized
around real-world ideas. Models are useful for understanding problems,
communicating with everyone involved with the project (customers, domain experts,
analysts, designers, etc.), modeling enterprises, preparing documentation, and
designing programs and databases
Visual Modeling:
Capture the structure and behavior of architectures and components.
Show how the elements of the system fit together.
Hide or expose details appropriate for the task.
Maintain consistency between a design and its implementation.
Promote unambiguous communication.
2
BALOCHISTAN UNIVERSITY OF IT, ENGINEERING & MANAGEMENT
SCIENCES, QUETTA.
LAB MANUAL SOFTWAR DESIGN AND ARCHITECTURE
The purpose of the diagrams is to present multiple views of a system; this set of
multiple
views is called a model.
A UML model tells what a system is supposed to do.
UML Diagrams
Class Diagram
Object Diagram
Use Case Diagram
State Diagram
Sequence Diagram
Activity Diagram
Communication Diagram
Component Diagram
Deployment Diagram
Composite Structure Diagram
Interaction Overview Diagram
Timing Diagram
Package Diagram
There are two broad categories of diagrams and they are again divided into
subcategories −
Structural Diagrams
Behavioral Diagrams
Structural Diagrams
The structural diagrams represent the static aspect of the system. These static aspects
represent those parts of a diagram, which forms the main structure and are therefore
stable.Structure diagrams show the static structure of the system and its parts on
different abstraction and implementation levels and how they are related to each
other. The elements in a structure diagram represent the meaningful concepts of a
system, and may include abstract, real world and implementation concepts, there are
seven types of structure diagram as follows:
Class Diagram
Component Diagram
Deployment Diagram
Object Diagram
Package Diagram
Composite Structure Diagram
Profile Diagram
Behavioral Diagrams
Any system can have two aspects, static and dynamic. So, a model is considered as
complete when both the aspects are fully covered.
Behavioral diagrams basically capture the dynamic aspect of a system. Dynamic
aspect can be further described as the changing/moving parts of a system.
Behavior diagrams show the dynamic behavior of the objects in a system, which can
be described as a series of changes to the system over time, there are seven types of
behavior diagrams as follows:
3
BALOCHISTAN UNIVERSITY OF IT, ENGINEERING & MANAGEMENT
SCIENCES, QUETTA.
LAB MANUAL SOFTWAR DESIGN AND ARCHITECTURE
4. Procedure:
A big part of building a software system is determining what the customer wants.
We call these requirements, and there are many techniques for eliciting or
discovering requirements from a customer or user.
User Stories
Put the user role into the first blank. This may be quite simple for software in which
there is generally only one type of user, or a bit more complex in cases where the
software may do different things for different people. Either way, this clarifies who
wants to use this feature.
In the second blank, put the goal that the user role wants to achieve. This will lead
to some feature that you want to implement.
4
BALOCHISTAN UNIVERSITY OF IT, ENGINEERING & MANAGEMENT
SCIENCES, QUETTA.
LAB MANUAL SOFTWAR DESIGN AND ARCHITECTURE
After so that, put the reason why the user role wants this goal. Sometimes this
clause is omitted if the benefits are clear and generally known.
After you fill in a user story, you can apply object-oriented thinking to it to discover
objects and possibly further requirements!
Example
Imagine that you introduce the user story technique to your customer, and they
give you the following sentence:
Usually, the nouns correspond to objects in your software. So in this example, you
have identified three objects: first, the user role is associated with an object in the
software (the online shopper). An item could be any product at the store, while a
shopping cart is an object for tracking items for purchase.
Verbs can help you identify the requirements that your objects might have. In this
example, add and purchase might be responsibilities of the shopping cart. Verbs
may also help you identify connections between objects.
The last point is a bit more subtle: a user story can also help you discover
connections between objects. In this example, it is probably fairly obvious. One
online shopper is typically associated with one shopping cart. The shopping cart
should be capable of holding multiple items.
Conclusion
User stories are just one of many techniques that can be used to express
requirements for a software system. They are simple to use and can allow you to
apply object-oriented thinking and discover objects and further requirements.
Start using them today, even if the ideas are your own! By identifying objects
before starting implementation, your software will become better structured and
more clear.
Object orientation
5
BALOCHISTAN UNIVERSITY OF IT, ENGINEERING & MANAGEMENT
SCIENCES, QUETTA.
LAB MANUAL SOFTWAR DESIGN AND ARCHITECTURE
Object:
An object has structure. It has attributes (properties) and behavior. An object's
behavior consists of the operations it carries out. Attributes and operations taken
together are called features.
Person class,
Attributes: height, weight, and age. (You can imagine a number of others.)
Each of us is unique because of the specific values that each of us has for those
attributes.
Fig:1
Object-orientation goes beyond just modeling attributes and behavior. It considers other
7
BALOCHISTAN UNIVERSITY OF IT, ENGINEERING & MANAGEMENT
SCIENCES, QUETTA.
LAB MANUAL SOFTWAR DESIGN AND ARCHITECTURE
Abstraction
Inheritance
Polymorphism
Encapsulation
Message sending
Associations
Aggregation
Abstraction
Abstraction means, simply, to filter out an object's properties and operations until
just the ones you need are left. What does "just the ones you need" mean?
In this program all the detailed attributes and operations are not required. Only
the serialNumber of each washing machine object is required.
In any case, what you're left with, after you've made your decisions about what
to include and what to exclude, is an abstraction of a washing machine.
Inheritance
Appliance is a class that has the attributes onOffSwitch and electricWire, and the
operations turnOn() and turnOff(). Thus, if you know something is an appliance,
you know immediately that it has the Appliance class's attributes and operations.
features of Appliance. It's important to note that each subclass adds its own
attributes and operations. Fig:2 shows the superclass-subclass relationship.
Fig 2: Superclass-Subclass
Polymorphism
Sometimes an operation has the same name in different classes. For example,
you can open a door, you can open a window, and you can open a newspaper, a
present, a bank account, or a conversation. In each case you're performing a
different operation. In object-orientation each class "knows" how that operation
is supposed to take place. This is called polymorphism see Fig 4.
9
BALOCHISTAN UNIVERSITY OF IT, ENGINEERING & MANAGEMENT
SCIENCES, QUETTA.
LAB MANUAL SOFTWAR DESIGN AND ARCHITECTURE
Encapsulation
When an object carries out its operations, those operations are hidden Fig
5.When most people watch a television show, they usually don't know or care
about the complex electronics components that sit in back of the TV screen and
all the many operations that have to occur in order to paint the image on the
screen. The TV does what it does and hides the process from us. Most other
appliances work
Why is this important? In the software world, encapsulation helps cut down on
the potential for bad things to happen. In a system that consists of objects, the
objects depend on each other in various ways. If one of them happens to
malfunction and software engineers have to change it in some way, hiding its
operations from other objects means that it probably won't be necessary to
change those other objects.
Message Sending
In a system, objects work together. They do this by sending messages to one
10
BALOCHISTAN UNIVERSITY OF IT, ENGINEERING & MANAGEMENT
SCIENCES, QUETTA.
LAB MANUAL SOFTWAR DESIGN AND ARCHITECTURE
Example: A TV and a remote present a nice intuitive example. When you want to
watch a TV show, you hunt around for the remote, settle into your favorite chair,
and push the on button. What happens?
Fig 6: An example of message sending from one object to another. The remote-object sends a
message to the TV-object to turn itself on. The TV-object receives the message through its
Associations
Another common occurrence is that objects are typically related to one another in
some fashion. For example, when you turn on your TV, in object-oriented terms,
you're in an association with your TV.
The "turn-on" association is unidirectional (one-way), as in Fig 7.That is, you
turn your TV on. Unless you watch way too much television, however, it doesn't
return the favor. Other associations, like "is married to," are bidirectional; Fig 8.
11
BALOCHISTAN UNIVERSITY OF IT, ENGINEERING & MANAGEMENT
SCIENCES, QUETTA.
LAB MANUAL SOFTWAR DESIGN AND ARCHITECTURE
Fig 7: Objects are often associated with each other in some way. When you turn on your TV,
you're in a unidirectional association with it.
Fig 8: Objects are sometimes associated with each other in more than one way.
Aggregation
12
BALOCHISTAN UNIVERSITY OF IT, ENGINEERING & MANAGEMENT
SCIENCES, QUETTA.
LAB MANUAL SOFTWAR DESIGN AND ARCHITECTURE
Fig 10: A typical computer system is an example of an aggregation—an object that's made up
of a combination of a number of different types of objects.
Fig 11: In a composition, a component can sometimes die out before the
composite does. If you destroy the composite, you
13
BALOCHISTAN UNIVERSITY OF IT, ENGINEERING & MANAGEMENT
SCIENCES, QUETTA.
LAB MANUAL SOFTWAR DESIGN AND ARCHITECTURE
5. Equipment’s:
Star UML
Edraw Max
GUI design
Studio
6. Observations:
In this lab we learn about common UML diagrams, Object Oriented Analysis and
Design in UML.
7. Lab Tasks/Assignment
Lab Task 1:
Use user stories to captures a specific requirement of your software system from
the perspective of a user or stakeholder, and provides a clear statement of the
desired functionality and its benefits.
"As a Hostel Manager, I want online room booking, so that the user does not
have to visit us physically."
“As a hostel administrator, I want to be able to easily manage and assign rooms
to incoming students, so that the process is efficient and streamlined.”
“As a Hostel Manager, I want to be able to view and pay fee online, so that I can
easily manage payments and avoid the hassle of manual transaction.”
14
BALOCHISTAN UNIVERSITY OF IT, ENGINEERING & MANAGEMENT
SCIENCES, QUETTA.
LAB MANUAL SOFTWAR DESIGN AND ARCHITECTURE
4. Use Cases: Use cases are a way of describing the different ways in which users
interact with a software system. OOAD uses use cases to help developers understand
the requirements of a system and to design software systems that meet those
requirements.
Class Diagram
Component Diagram
Object Diagram
Package Diagram
Use case Diagram
Sequential Diagram
15
BALOCHISTAN UNIVERSITY OF IT, ENGINEERING & MANAGEMENT
SCIENCES, QUETTA.
LAB MANUAL SOFTWAR DESIGN AND ARCHITECTURE
8. Rubrics:
Absent Student is Student can Student has Student has Student
unable to understand followed constructed perfectly
follow the the instructions the implemente
provided provided to construct functional/ d a working
instruction laboratory the working model/
s properly. instructions fundamenta schematic/ logic/
The and l schematic/ model/ circuit/
student familiar block block block
can name with the lab diagram/ diagram/ diagram/
the environmen code/ code, and code and
Demonstratio hardware t (Trainer/ model on have successfully
n or software/ the successfull executed
simulation IDE), but protoboard/ y executed the lab
platform, cannot trainer/ the objective in
but unable implement simulation program/ Realtime or
to on the software. run circuit in a
implement platform on software simulation
anything practically platform environmen
practically or on the t and
or on the software produced
software the desired
results
Category Ungrade Very Poor Poor Fair Good Excellent
d
Percentage [0] [1-20] [21-40] [41-60] [61-80] [81-100]
Marks 0.0 0.1 0.2 0.3 0.4 0.5
Date Total Instructor’s Signature
Marks
16
BALOCHISTAN UNIVERSITY OF IT, ENGINEERING & MANAGEMENT
SCIENCES, QUETTA.
LAB MANUAL SOFTWAR DESIGN AND ARCHITECTURE
17
BALOCHISTAN UNIVERSITY OF IT, ENGINEERING & MANAGEMENT
SCIENCES, QUETTA.