participation creation and destruction message.€¦  · web viewa class diagram models the static...

13

Click here to load reader

Upload: leliem

Post on 25-Apr-2018

214 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Participation Creation and Destruction message.€¦  · Web viewA class diagram models the static structure of a system. ... Here are some examples of UML class diagrams and explanations

Lab-1

Module: Introduction to OOSD Level: UG2Programme: Software Engineering Time: 1.15 hourStudent Name _________________ ID_______________

Date: 18 February 2018 Topic: Sequence and Class Diagram

Theoretical background

Definition of Sequence Diagram

Sequence diagrams, commonly used by developers, model the interactions between objects in a single use case. They illustrate how the different parts of a system interact with each other to carry out a function, and the order in which the interactions occur when a particular use case is executed.

Sequence Diagram Notations:

Lifeline Notation

Page 1 of 11

Page 2: Participation Creation and Destruction message.€¦  · Web viewA class diagram models the static structure of a system. ... Here are some examples of UML class diagrams and explanations

A lifeline notation with an actor element symbol is used when the particular sequence diagram is owned by a use case.

A lifeline with an entity element represents system data. For an example, in a customer service application, the Customer entity would manage all data related to a customer.

Page 2 of 11

Page 3: Participation Creation and Destruction message.€¦  · Web viewA class diagram models the static structure of a system. ... Here are some examples of UML class diagrams and explanations

A lifeline with a boundary element indicates a system boundary/ software element in a system; for example user interface screens, database gateways or menus that users interact with, are boundaries.

Activation Bars

Activation bar is the box placed on the lifeline.  It is used to indicate that an object is active (or instantiated) during an interaction between two objects. The length of the rectangle indicates the duration of the objects staying active.

Page 3 of 11

Page 4: Participation Creation and Destruction message.€¦  · Web viewA class diagram models the static structure of a system. ... Here are some examples of UML class diagrams and explanations

Synchronous message

Asynchronous message

Return message

Page 4 of 11

Page 5: Participation Creation and Destruction message.€¦  · Web viewA class diagram models the static structure of a system. ... Here are some examples of UML class diagrams and explanations

Participation Creation and Destruction message.

Reflexive message.

Sequence Diagram of an Online Exam System

Diagram source: creately.com/blog/diagrams/sequence-diagram tutorial/#Notations

Exercise

Draw a Sequence diagram to show interaction between objects of library management System

Page 5 of 11

Page 6: Participation Creation and Destruction message.€¦  · Web viewA class diagram models the static structure of a system. ... Here are some examples of UML class diagrams and explanations

:Class Diagram

A class diagram models the static structure of a system. It shows relationships between classes, objects, attributes, and operations.

UML Class Diagrams and Examples:

Example #1: Relationships – Students and CoursesThis example demonstrates relationships between classes. It’s from an imaginary application that models university courses.

Notes Each Course object maintains a list of the students on that course and the lecturer

who has been assigned to teach that course

Page 6 of 11

Page 7: Participation Creation and Destruction message.€¦  · Web viewA class diagram models the static structure of a system. ... Here are some examples of UML class diagrams and explanations

The Course object has behavior that allow the adding and removing of students from the course, assigning a teacher, getting a list of the currently assigned students, and the currently assigned teacher.

Teachers are modelled as Lecturer objects. As a lecturer may teach more than one course there is an association between Course and Lecturer. The “taught By” relationship shows that a Course only has a single teacher, but that a lecturer may teach several Courses.

Each Lecturer object also maintains a list of the Courses that it teaches. There is a similar relationship between Course and Student. A course is attended by

zero or more Students, and a Student may attend multiple courses.

This example also demonstrates the use of interfaces. The diagram shows a Person interface that stipulates that objects conforming to this interface will have a getName and getEmailAddress methods. Both Lecturer and Student are shown to be types of Person.

Here are some examples of UML class diagrams and explanations of their contents. See if you can interpret the last diagram yourself. Refer to Handout #2 for help with the UML syntax.

Example #2: Inheritance – VehiclesThis diagram shows an inheritance hierarchy – a series of classes and their subclasses. Its for an imaginary application that must model different kinds of vehicles such as bicycles, motor bike and cars.

Page 7 of 11

Page 8: Participation Creation and Destruction message.€¦  · Web viewA class diagram models the static structure of a system. ... Here are some examples of UML class diagrams and explanations

Notes All Vehicles have some common attributes (speed and color) and common behavior

(turnLeft, turnRight) Bicycle and MotorVehicle are both kinds of Vehicle and are therefore shown to

inherit from Vehicle. To put this another way, Vehicle is the superclass of both Bicycle and MotorVehicle

In our model MotorVehicles have engines and license plates. Attributes have been added accordingly, along with some behavior that allows us to examine those attributes

MotorVehicles is the base class of both MotorBike and Car, therefore these classes not only inherit the speed and color properties from Vehicle, but also the additional attributes and behavior from MotorVehicle

Both MotorBike and Car have additional attributes and behavior which are specific to those kinds of object.

Example #3: Mixed Example – Company, Employee, ManagerThis example is from a system that models companies, e.g. for a payroll or reporting system. See if you can interpret it yourself!

Page 8 of 11

Page 9: Participation Creation and Destruction message.€¦  · Web viewA class diagram models the static structure of a system. ... Here are some examples of UML class diagrams and explanations

Page 9 of 11

Page 10: Participation Creation and Destruction message.€¦  · Web viewA class diagram models the static structure of a system. ... Here are some examples of UML class diagrams and explanations

Class diagram for Hotel Management System:

Exercise:

Draw a sequence and class diagram for login.

Page 10 of 11

Page 11: Participation Creation and Destruction message.€¦  · Web viewA class diagram models the static structure of a system. ... Here are some examples of UML class diagrams and explanations

References:

http://sce2.umkc.edu/BIT/burrise/pl/case-studies/old-library/

https://creately.com/blog/diagrams/sequence-diagram-tutorial/#Notations

https://www.lucidchart.com/documents/edit/4c2edb84-6795-4f01-bc86-53a3899d9b93/0?demo=on#?

Page 11 of 11