Introduction to Computing LAB 4: Flow chart and UML diagrams
LAB # 4
Flow chart and UML Diagrams
Objective
Learn to draw a Flow chart for problem solving
Learn to create UML diagrams for application
Theory
Flow Chart diagrams:
Flowcharts used to be a popular means for describing computer algorithms. Modern
techniques such as UML activity diagrams are considered to be extensions of the
flowchart. One of the uses of flowchart is to describe the sequence of steps and
logic of solving a problem, before writing a computer program.
Simple Flow chart example of adding two numbers:
The start and the end of a problem solving process are indicated using the ellipse. The two
numbers A and B data or information are represented by parallelograms. The next step is to
add these two numbers, which is called processing. The detail of processing of data is
represented in a rectangle.
1
Introduction to Computing LAB 4: Flow chart and UML diagrams
Flowchart symbols Geometric shape Purpose
Ellipse is used to indicate the start and end
of a flowchart. Start written in the ellipse
Ellipse indicates the beginning of a flowchart. End
or Stop or Exit written in the ellipse
indicates the end of the flowchart.
A parallelogram is used to read data (input)
Parallelogram
or to print data (output).
A rectangle is used to show the data
Rectangle
processing in the flowchart
No
A diamond with two branches is used to
show the decision making step in a
flowchart. A question is specified in the
Diamond
diamond. The next step in the sequence is
Yes based on the answer to the question which
is “Yes” or “No”.
Arrows are used to connect the steps in a
Arrows flowchart, to show the flow or sequence of
the problem solving process
Drawing a flowchart
• Identify input and output.
• Apply reasoning skills to solve the problem.
• Draw the flowchart using the appropriate symbols and arrows to show the
sequence of steps in solving the problem
Suppose we have an example of two types of animals; Herbivore and Carnivore.
We have to find if the animal eats plant then it is Herbivore and if does not then it is
Carnivore.
2
Introduction to Computing LAB 4: Flow chart and UML diagrams
First, Start then system will read the
name of animal. If it eats plant then it
will print Herbivore and if it does not eat
plant then it will print Carnivore and then
it will End the program.
UML diagrams:
The Unified Modeling Language (UML) is graphical language that lets you model
or visualizes systems and software. UML is widely used in industry to design,
develop and document complex software. Diagrams are easier to understand than
Text, so they are more appropriate to document systems than comments in millions
of lines of code.
Types of UML Diagrams
There are two main categories with 14 different types of UML diagrams, each of
which is used in a different situation.
1. Structure diagrams: show the static relationships between the components in
the system.
2. Behavior diagrams: show how the components in the system react to each
other, they capture how the system changes, and in some diagrams, how it
changes over time.
3
Introduction to Computing LAB 4: Flow chart and UML diagrams
The results of the UML survey by assuming as,
Following are the most popular UML diagrams:
- Use case diagrams show the interaction between a system and its environment.
- Activity diagrams show the activities involved in a process or in data
processing.
- Sequence diagrams show interactions between actors and the system or
between other system components.
- State diagrams show how the system reacts to internal and external events.
- Class diagrams show the object classes in the system and the associations
between these classes.
4
Introduction to Computing LAB 4: Flow chart and UML diagrams
Use case diagrams:
Use cases are defined from a user/actor’s point of view. An actor is a role that
people (users) or devices play as they interact with the software. In use case
diagrams actors may be users or processes that interact with your system Use cases
are the description of the functionality of the system from a user’s perspective. It is
used to show the functions to be provided by the system, also defines which user
will use which function. These are represented by stick figures.
Actor
• Anything that needs to exchange information with the system.
• Could be people, or other external systems.
• Define roles that users can play while using the system.
Use cases
Use-case is a business requirement and a pattern of behavior which the new system
is required to display. To find use-case, examine each actor and its task. e.g.
• Sales Manager: Approve sales schemes
• Store Keeper: Maintain stock at store
• Sales Officer: Sell goods through store or door-to-door
5
Introduction to Computing LAB 4: Flow chart and UML diagrams
Process of Use case Modeling
Step-1: Identify (Business) Actors
Step-2: Identify (Business Requirements) Use case
Step-3: Construct Use-Case Model
Step-4: Document Use-Case events
Use case diagram: ATM example
6
Introduction to Computing LAB 4: Flow chart and UML diagrams
Lab Task _
Lab Task. 4.1 ) The following empty flowchart gives the steps to be followed while
taking admission to Hamdard University. The phrases to be filled in the boxes are
also given. Complete the flowchart by filling in the number of the correponding
phrase, inside each box.
1. Search for a University
2. Prepare for the admission test and attempt the test.
3. Did you pass the test?
4. Submit necessary documents and get admission.
5. End
6. Are seats available?
7. Start
8. Is there an admission test?
Lab Task. 4.2 ) Create a Use Case diagram for HU LMS, show its users and tasks that
users perform. Users included Students, Faculty, Management, IT officer.
Note: Attach all printout with your lab manual