uml lab manual 08-09ver

55
INDEX S. No Contents Page No 4 Lab Objective 2 4 Introduction About Lab 2 6 Guidelines to Students 3 8 List of Lab Exercises 4.1 Syllabus Programs (JNTU) 4.2 Additional and Advanced Programs 4 9 Description about UML 6 12 Diagrams 9 55 References 49 www.jntuworld.com -1-

Upload: santosh-nayak

Post on 24-Nov-2014

509 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: UML Lab Manual 08-09ver

INDEX

S. No ContentsPage No

4 Lab Objective2

4 Introduction About Lab2

6 Guidelines to Students 3

8

List of Lab Exercises

4.1 Syllabus Programs (JNTU)

4.2 Additional and Advanced Programs

4

9 Description about UML6

12 Diagrams 9

55 References49

www.jntuworld.com-1-

Page 2: UML Lab Manual 08-09ver

LAB OBJECTIVE

Overview of UML

Basic & Advanced Models

Class , Object, Collaboration & Sequence

Use Cases Advanced Modeling

Component Diagram & Deployment Diagrams

INTRODUCTION ABOUT LAB

There are 66 systems (Compaq Presario) installed in this Lab. Their configurations are as follows:

Processor : AMD Athelon ™ 1.67 GHz

RAM : 256 MB

Hard Disk : 40 GB

Mouse : Optical Mouse

Network Interface card : Present

Software

All systems are configured in DUAL BOOT mode i.e., Students can boot from Windows XP or Linux as per their lab requirement.

This is very useful for students because they are familiar with different Operating Systems so that they can execute their programs in different programming environments.

Each student has a separate login for database access

Oracle 9i client version is installed in all systems. On the server, account for each student has been created.

This is very useful because students can save their work ( scenarios’, pl/sql programs, data related projects ,etc) in their own accounts. Each student work is safe and secure from other students.

www.jntuworld.com-2-

Page 3: UML Lab Manual 08-09ver

Latest Technologies like DOT NET and J2EE are installed in some systems. Before submitting their final project, they can start doing mini project from 2nd year onwards.

MASM ( Macro Assembler ) is installed in all the systems

Students can execute their assembly language programs using MASM. MASM is very useful students because when they execute their programs they can see contents of Processor Registers and how each instruction is being executed in the CPU.

Rational Rose Software is installed in some systems

Using this software, students can depict UML diagrams of their projects.

Softwares installed: C, C++, JDK1.5, MASM, OFFICE-XP, J2EE and DOT NET, Rational Rose.

Systems are provided for students in the 1:1 ratio.

Systems are assigned numbers and same system is allotted for students when they do the lab.

www.jntuworld.com-3-

Page 4: UML Lab Manual 08-09ver

Guidelines to Students

1. Learn what the UML is, what it is not and why it is relevant to the process of developing software-intensive systems

2. Master the vocabulary rules and idioms of the UML and in general how to speak the language efficiently

3. Under stand how to apply UML to solve a number of common problems

The user guide provides a reference to the use of specific UML features, However it is not intended to be a comprehensive reference manual for UML. That is focus on other book, The Unified Modeling Language Reference Manual

For the developer approaching the UML for the first time, the user guide is best-read linearly. All chapters are constructed so that each builds upon the contents of previous one, thus lending it as linear progression.

www.jntuworld.com-4-

Page 5: UML Lab Manual 08-09ver

UML Syllabus Programs (JNTU)

S. No Programs1. Class diagram of school without attributes2. Class diagram of school with attributes3. Class diagram of Hospital without attributes4. Class diagram of Hospital with attributes5. Class diagram for ATM.6. Use case diagram for ATM.7. Activity diagram for ATM8. Sequence diagram ATM9. Collaboration diagram for ATM10. Component diagram for ATM11. Deployment diagram for ATM12. State Transition diagram for ATM13. Use case Diagram for Librarian Scenario14. Use case diagram for mechanic15. Use case diagram for Point of sale16. Use case diagram for Point of sale17. Activity diagram for Point of sale18. Sequence diagram for Point of sale 19. Collaboration diagram for Point of sale20. Deployment diagram for Point of sale21. Sequence diagram for Hospital22. Collaboration diagram for Hospital 23. Activity diagram for Patient visiting doctor using Swim lines24. Activity diagram of patient checked by Treatment Provider for Diabetes25. Activity diagram for Cellular Company26. Online Book shop of class diagram without attributes27. On line book shop of Use case diagram28. Online book shop of Activity diagram 29. Sequence diagram using Timing Constraints & Locations30. State transition diagram representing a history state “H”31. Diagram representing Concurrent sub states33. State transition diagram for a Computer being identified with states34. Diagram for the relation between a component & interface35. Diagram for the relation between a component & class36. Deployment diagram for Physical connection system37. Deployment diagram for Client server system38. Development Diagram that shows the Embedded System.

www.jntuworld.com-5-

Page 6: UML Lab Manual 08-09ver

Description about UML

1. Model A model is a simplification of reality.

A model provides the blueprints of a system.

A model may be structural, emphasizing the organization of the system, or it may be behavioral, emphasizing the dynamics of the system.

We build models so that we can better understand the system we are developing.

We build models of complex systems because we cannot comprehend such a system in its entirety.

Through modeling, we achieve four aims.

Models help us to visualize a system as it is or as we want it to be. Models permit us to specify the structure or behavior of a system.

Models give us a template that guides us in constructing as system.

Models document the decisions we have made

2. Principles of Modeling

The choice of what models to create has a profound influence on how a problem is attacked and how a solution is shaped

Every model may be expressed at different levels of precision

The best models are connected to reality

No single model is sufficient. Every nontrivial system is best approached through a small set of nearly independent models

3. Unified Modeling Language (UML)

The UML is a language for

Visualizing Specifying

Constructing

Documenting

www.jntuworld.com-6-

Page 7: UML Lab Manual 08-09ver

The UML is a Language

A modeling language is a language whose vocabulary and rules focus on the conceptual and physical representation of a system

The UML is a Language for Visualizing

Some programmers think of an implementation and then code it. Some programmers think mentally i.e. they even sketch out a few ideas on a paper. That means some things are best modeled textually, others are best modeled graphically. The UML is such a graphical language.

The UML is a Language for Specifying

Specifying means building models. It specifies of all the important analysis, design, and implementation decisions that must be made in developing a software project.

The UML is a Language for constructing

The UML is not a visual programming language, but its models can be directly connected to a variety of a programming language. This means that it is possible to map from a model in the UML to a programming language such as Java, C++.

The UML is a Language for Documenting

A Healthy software organization produces all sorts of artifacts in addition to raw executable code. These artifacts include

1. Requirements

2. Architecture

3. Design

www.jntuworld.com-7-

Page 8: UML Lab Manual 08-09ver

4. Source code

5. Project plans

6. Tests

7. Releases

The UML addresses the documentation of a system’s architecture and all of its detail

4. Architectural views of UML

The user model view

- Use Case Diagram - The functionality of a system

The structural model view

- Class Diagram - The static structure of a system

- Object Diagram - The static structure of a system at a particular time

The behavioral model view

- Sequence Diagram - Interaction among elements of a system in a time sequence

- Collaboration diagram - Interaction among elements and their relations organized in time and space

- State Diagram - The status condition and responses of the elements of a system

- Activity Diagram - The activities of the system

The implementation model view

- Component Diagram - The organization of the elements realizing the system

The Environment model view

- Deployment diagram - Configuration of environment elements and the mapping of elements realizing the system into them

www.jntuworld.com-8-

Page 9: UML Lab Manual 08-09ver

1. School model without Attributes

www.jntuworld.com-9-

Page 10: UML Lab Manual 08-09ver

2. School Model with Attributes

www.jntuworld.com-10-

Page 11: UML Lab Manual 08-09ver

3. Hospital Model without Attributes

www.jntuworld.com-11-

Page 12: UML Lab Manual 08-09ver

4. Hospital Model with Attributes

www.jntuworld.com-12-

Page 13: UML Lab Manual 08-09ver

5. ATM Scenario Class Diagram

www.jntuworld.com-13-

Page 14: UML Lab Manual 08-09ver

6. ATM Scenario Use –Case Diagram

Transfer fund

View balance

Transfer funds

Deposit fundsCustomer

Withdraw money

Bank officer

Change pin

Make payment Client

www.jntuworld.com-14-

Page 15: UML Lab Manual 08-09ver

7. ATM Scenario Activity Diagram

Insert card

Enter PIN

Enter transition

Connect Not connected

Any more transaction

Remove card

No more transaction

www.jntuworld.com-15-

Page 16: UML Lab Manual 08-09ver

8. ATM Scenario Sequence Diagram

A : Atm machine

ac : account

B : Bank client

1: Insert card

Insert PIN

3 : Enter PIN

4 : Verification

5 : PIN ok

6 : Request for transaction

7 : Process transaction

8 : Enter amount

9 : Amount entered

10 : Withdrawal

11 : Withdrawal success

12 : Dispense cash

13 : take cash

14 : Terminate

15 : Print slip

16 : Eject card

www.jntuworld.com-16-

Page 17: UML Lab Manual 08-09ver

9. ATM Scenario Collaboration Diagram

www.jntuworld.com-17-

Page 18: UML Lab Manual 08-09ver

10. ATM Scenario Deployment Diagram

www.jntuworld.com-18-

Page 19: UML Lab Manual 08-09ver

11. ATM Scenario Component Diagram

Card Reader

ATM Screen

Cash Dispenser

Card Reader Card dispenser

ATM Screen

ATM.exe

www.jntuworld.com-19-

Page 20: UML Lab Manual 08-09ver

12. ATM Scenario State Transition Diagram

www.jntuworld.com-20-

Page 21: UML Lab Manual 08-09ver

13. Use case Diagram for Librarian Scenario

www.jntuworld.com-21-

Page 22: UML Lab Manual 08-09ver

14. Use case diagram for mechanic

www.jntuworld.com-22-

Page 23: UML Lab Manual 08-09ver

15. Class diagram for Point of sale

www.jntuworld.com-23-

Page 24: UML Lab Manual 08-09ver

16. Use case diagram for Point of sale

www.jntuworld.com-24-

Page 25: UML Lab Manual 08-09ver

17. Activity diagram for Point of sale

www.jntuworld.com-25-

Page 26: UML Lab Manual 08-09ver

18. Sequence Diagram for Point of Sale

www.jntuworld.com-26-

Page 27: UML Lab Manual 08-09ver

19. Collaboration diagram for point of sale

Customer Clerk Computer

1: 1 : Takes the product5: 5 : Payment is done

4: 4 : Bill is given

2: 2 : Bills the product

3: 3 : Processes the bill

20. Deployment diagram for point of sale

Barcode scanner

PDA Touch screens

Server

www.jntuworld.com-27-

Page 28: UML Lab Manual 08-09ver

21. Hospital Sequence Diagram

P:Patient A:Appointment

D:Docter T:Treatment

1:Confirms

2:Diagnozed

3:Gives Treatment

4:Receive Feedback

www.jntuworld.com-28-

Page 29: UML Lab Manual 08-09ver

22. Hospital Collaboration Diagram

www.jntuworld.com-29-

Page 30: UML Lab Manual 08-09ver

23. Activity Diagram of patient visiting doctor using swim lines

www.jntuworld.com-30-

Page 31: UML Lab Manual 08-09ver

24. Activity diagram of patient checked by Treatment Provider for Diabetes

Check the patient

Prescribed Test

Check next Patient

Kind of Diabetes

AgeHeight & Weight

Provide Treatment

SymptomsNo Symptoms

www.jntuworld.com-31-

Page 32: UML Lab Manual 08-09ver

25. Activity diagram for Cellular Company

Receives product

Pay Bills

Request Product

prepare bills

Close Order

Pull materials

Shift Order

Process Product

Ware houseSalesCustomer

www.jntuworld.com-32-

Page 33: UML Lab Manual 08-09ver

26. Online Book shop of class diagram without attributes

www.jntuworld.com-33-

Page 34: UML Lab Manual 08-09ver

27. Online book shop of Use case diagram

www.jntuworld.com-34-

Page 35: UML Lab Manual 08-09ver

28. Online book shop of Activity diagram

Display Welcome Message

Get Login

Get Password & Validate

Display Item Information

Accept Selection

Create Order

Display Order

Ship to Customer

Rejected

More

Accepted

Rejected

www.jntuworld.com-35-

Page 36: UML Lab Manual 08-09ver

29. Sequence diagram using Timing Constraints & Locations

www.jntuworld.com-36-

Page 37: UML Lab Manual 08-09ver

30. State transition diagram representing a history state “H”

www.jntuworld.com-37-

Page 38: UML Lab Manual 08-09ver

31. Diagram representing Concurrent sub states

www.jntuworld.com-38-

Page 39: UML Lab Manual 08-09ver

32. Diagram representing Sequential substitutes

www.jntuworld.com-39-

Page 40: UML Lab Manual 08-09ver

33. State transition diagram for a Computer being identified with states

State Transition diagram for a computer being identified with states:Idle,running,shut down

Idle Running Shut down

2 sec/selftest()

Interrupt( power failure )Key plus

www.jntuworld.com-40-

Page 41: UML Lab Manual 08-09ver

34. Diagram for the relation between a component & interface

www.jntuworld.com-41-

Page 42: UML Lab Manual 08-09ver

35. Diagram for the relation between a component & class

www.jntuworld.com-42-

Page 43: UML Lab Manual 08-09ver

36. Deployment diagram for Physical connection system

Server

Client1

Client2

<< 10 Tethernet >>

<< RS 232 >>

Draw a Deployment Diagram that shows the physical connection system

www.jntuworld.com-43-

Page 44: UML Lab Manual 08-09ver

37. Deployment diagram for Client server system

Draw a Deployment Diagram that shows the client server system

Client

File server

Server

Kiosk Server print

Server database

www.jntuworld.com-44-

Page 45: UML Lab Manual 08-09ver

38. Development Diagram that shows the Embedded System.

www.jntuworld.com-45-

Page 46: UML Lab Manual 08-09ver

Viva Questions & Answers

1. What is a Class?

Ans. A class is a description of set of objects that share the same attributes, operations, relations and semantics.

2. What is a simple name?

Ans. Every class must have a name that distinguishes it from other classes. A name alone is known as a simple name

3. What is a Path name?

Ans. A path name is the class name prefixed by the name of the package in which that class lives

4. What is Attribute?

Ans. An attribute is a named property of a class that describes a range of values that instances of the property may hold

5. What is an Operation?

Ans. An operation is the implementation of a service that can be requested from any object of the class to affect behavior

6. What is responsibility?

Ans. A responsibility is a contract or an obligation of a class

7. What is a relationship?

Ans. A relationship is a connection among things

8. What is Dependency?

Ans. Change in one thing depends upon the another thing

9. How the dependency is rendered?

Ans. Dependency is rendered as a dashed directed line, directed to the thing being depended on

10. What kind of relationship for Generalization?

www.jntuworld.com-46-

Page 47: UML Lab Manual 08-09ver

Ans. Generalization called an “is-a-kind-of” relationship

11. A class may have how many parents?

Ans. A class may have zero, one, or more parents

12. What is root or base class?

Ans. A class that has no parents and one or more children is called a root class or base class

13. What is a Leaf class?

Ans: A class that has no children is called a leaf class

14. What is the Generalization?

Ans: It means that objects of the child may be used anywhere the parent may appear, but not the reverse

15. How generalization is rendered?

Ans: It is rendered as a solid directed line with a large open arrowhead, pointing to the parent

16. What is Association?

Ans: An Association is a structural relationship that specifies that objects of one thing are connected to objects of another

17. How Association is rendered?

Ans: An association is rendered as a solid line connecting the same or different classes

18. What is binary association?

Ans: An association that connects exactly two classes is called a binary association

19.What is n-ary association?

Ans. An association that connect more than two class

20. What are the four adornments that apply to association?

Ans. Name, Role, Multiplicity, Aggregation

www.jntuworld.com-47-

Page 48: UML Lab Manual 08-09ver

21. How we can describe nature of relationship in association>

Ans. By the name

22. What is a Role?

Ans. When a class participates in an association, it has a specific role that it plays in the relationship

23. How many multiplicities?

Ans. Exactly one(1), Zero or One(0..1), many(0..*), or one or more(1..*) or even state an exact number( for example, 3).

24. What type of Aggregation relationship?

Ans. Whole/Part relationship

25.How aggregation relationship is rendered?

Ans. It has a plain association with an open diamond at the whole end.

26. What are the relationships usually visualized in class diagrams?

Ans. Dependencies, generalization, and association

27. What is a note?

Ans. It is a graphical symbol for rendering constraints or comments attached to an element or a collection of elements.

28. How the note is rendered?

Ans. It is rendered as a rectangle with dog-eared corner, together with textual or graphical comment.

29. What is stereotype?

Ans. It is an extension of the vocabulary of the UML

30. How stereotype is rendered?

Ans. It is rendered as a name enclosed by guillements and placed above the name of another element.

www.jntuworld.com-48-

Page 49: UML Lab Manual 08-09ver

www.jntuworld.com-49-

Page 50: UML Lab Manual 08-09ver

References

Books / Material

Text Books

1.Grady Booch, James Rumbaugh, Ivar Jacobson : The Unified Modeling Language User Guide,Pearson Education.

2.Hans-Erik Eriksson, Magnus Penker, Brian Lyons, David Fado: UML 2 Toolkit,WILEY-dreamtech India Pvt. Ltd.

Suggested / Reference Books

1) Meilir Page-Jones : Fundamentals of Object Oriented Design in UML, Pearson Education

2) Atul Kahate: Object Oriented Analysis & Design, The McGraw-Hill Companies

3) Mark Priestley: Practical Object-Oriented Design with UML,TATA McGrawHill

4) Ivar Jacobson, Grady Booch, James Rumbaugh: The Unified Software Development Process, Pearson Education

Web sites

1) http://en.wikipedia.org/wiki/Unified_Modeling_Language

2) http://atlas.kennesaw.edu/~dbraun/csis4650/A&D/index.htm

www.jntuworld.com-50-