• No results found

Uml Lab Manual

N/A
N/A
Protected

Academic year: 2021

Share "Uml Lab Manual"

Copied!
137
0
0

Loading.... (view fulltext now)

Full text

(1)

SNO NAME OF THE EXPERIMENT PAGE NO REMARKS 1 UML INTRODUCTION 2 A POINT-OF-SALES SYSTEM ONLINE BOOKSHOP AN AUCTION APPLICATION

5 A MULTI THREADED AIRPORT SIMULATION

6 A SIMULATED

COMPANY

3

4

(2)

UML INTRODUCTION

UML INTRODUCTION

(3)

STUDY OF UML

AIM:

General study of UML DESCRIPTION:

The heart of object-oriented problem solving is the construction of a model. The model abstracts the essential details of the underlying problem from its usually complicated real world. Several modeling tools are wrapped under the heading of the UML, which stands for Unified Modeling Language. The purpose of this course is to present important highlights of the UML.

CLASS

A class is a blueprint or prototype from which objects are created. This section defines a class that models the state and behavior of a real-world object. It intentionally focuses on the basics, showing how even simple classes can cleanly model state and behavior. For example, the class Dog would consist of traits shared by all dogs, such as breed and fur color (characteristics), and the ability to bark and sit (behaviors).

(4)

are represented within an object, introduces the concept of data encapsulation, and explains the benefits of designing your software in this manner. A pattern(exemplar) of a class. The class Dog defines all

possible dogs by listing the characteristics and behaviors they can have; the object Lassie is one particular dog, with particular versions of the characteristics. A Dog has fur; Lassie has brown-and-white fur. OBJECT ORIENTATION CONCEPTS:

Object-Orientation goes beyond just modeling attributes and behavior. It considers the other aspects of objects as well. Object-oriented programming (OOP) is a programming paradigm that uses "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction, encapsulation, modularity, polymorphism, and inheritance. These aspects are called abstraction, Inheritance, polymorphism and encapsulation.

ABSTRACTION

(5)

Composition. For example, a class

ENCAPSULATION :

Encapsulation conceals the functional details of a class from objects that send messages to it.

For example, the Dog class has a bark () method. The code for the bark() method defines exactly how a bark happens (e.g., by inhale() and then exhale(), at a particular pitch and volume). Timmy, Lassie's friend, however, does not need to know exactly how she barks. Encapsulation is achieved by specifying which classes may use the members of an object. The result is that each object exposes to any class a certain interface — those members accessible to that class. The reason for encapsulation is to prevent clients of an interface from depending on those parts of the implementation that are likely to change in the future, thereby allowing those changes to be made more easily, that is, without changes to clients. For example, an interface can ensure that puppies can only be added to an object of the class Dog by code in that class. Members are often specified as public,

(6)

(C#) or Friend (VB.NET), and Eiffel and C++ allow one to specify which classes may access any member.

POLYMORPHISM :

Polymorphism allows the programmer to treat derived class members just like their parent class's members. More precisely, Polymorphism in object-oriented programming is the ability of objects belonging to different data types to respond to calls of methods of the same name, each one according to an appropriate type-specific behavior. One method, or an operator such as +, -, or *, can be abstractly applied in many different situations. If a Dog is commanded to speak(), this may elicit a bark(). However, if a Pig is commanded to speak(), this may elicit an oink(). Each subclass overrides the speak() method inherited from the parent class Animal.

INHERITANCE :

Subclasses are more specialized versions of a class, which inherit attributes and behaviors from their parent classes, and can introduce their own.

(7)

Each subclass can alter its inherited traits. For example, the Collie subclass might specify that the default four-Color for a collie is brown-and-white. The Chihuahua subclass might specify that the

bark () method produces a high pitch by default. Subclasses can also add new members. The Chihuahua subclass could add a method called tremble (). So an individual Chihuahua instance would use a high-pitched bark () from the Chihuahua subclass, which in turn inherited the usual bark () from Dog. The Chihuahua object would also have the tremble () method, but Lassie would not, because she is a Collie, not a Chihuahua. In fact, inheritance is an "a... is a" relationship between classes, while instantiation is an "is a" relationship between an object and a class: a Collie is a Dog ("a... is a"), but Lassie is a Collie ("is a"). Thus, the object named Lassie has the methods from both classes Collie and Dog.

Multiple inheritances are inheritance from more than one ancestor class, neither of these ancestors being an ancestor of the other. For example, independent classes could define Dogs and Cats, and a Chimera object could be created from these two which inherits all the (multiple) behavior of cats and dogs. This is not always

(8)

Class diagrams Object diagrams Sequence diagrams Collaboration diagrams State chart diagrams Activity diagrams Component diagrams Deployment diagrams

Why is UML important?

Let's look at this question from the point of view of the construction trade. Architects design buildings. Builders use the designs to create buildings. The more complicated the building, the more critical the communication between architect and builder. Blueprints are the standard graphical language that both architects and builders must learn as part of their trade.

Writing software is not unlike constructing a building. The more complicated the underlying system, the more critical the communication among everyone involved in creating and deploying

(9)

underlying tenet of object-oriented problem solving -- it all begins with the construction of a model. A model is an abstraction of the underlying problem. The domain is the actual world from which the problem comes. Models consist of objects that interact by sending each other messages. Think of an object as "alive." Objects have things they know (attributes) and things they can do (behaviors or operations). The values of an object's attributes determine its state.

Classes are the "blueprints" for objects. A class wraps attributes (data) and behaviors (methods or functions) into a single distinct entity. Objects are instances of classes.

Use case diagrams

:

Use case diagrams describe what a system does from the standpoint of an external observer. The emphasis is on what a system does rather than how.

Use case diagrams are closely connected to scenarios. A scenario is an example of what happens when someone interacts with the system. Here is a scenario for a medical clinic.

(10)

time slot. "

A use case is a summary of scenarios for a single task or goal. An actor is who or what initiates the events involved in that task. Actors are simply roles that people or objects play. The picture below is a Make Appointment use case for the medical clinic. The actor is a Patient. The connection between actor and use case is a communication association (or communication for short).

Actors are stick figures. Use cases are ovals. Communications are lines that link actors to use cases.

(11)

Use case diagrams are helpful in three areas.

Determining features (requirements). New use cases often generate new requirements as the system is analyzed and the design takes shape.

Communicating with clients. Their notational simplicity makes use case diagrams a good way for developers to communicate with clients.

Generating test cases. The collection of scenarios for a use case may suggest a suite of test cases for those scenarios.

Class diagrams

:

(12)

The class diagrams below models a customer order from a retail catalog. The central class is the Order. Associated with it is the Customer making the purchase and the Payment? A Payment is one of three kinds: Cash, Check, or Credit. The order contains Order Details (line items), each with its associated Item.

UML class notation is a rectangle divided into three parts: class name, attributes, and operations. Names of abstract classes, such as

Payment, are in italics. Relationships between classes are the

(13)

• Perform its work. In a diagram, an association is a link connecting two classes.

Aggregation -- an association in which one class belongs to a collection. An aggregation has a diamond end pointing to the part containing the whole. In our diagram, Order has a collection of Order Details.

Generalization -- an inheritance link indicating one class is a super class of the other. A generalization has a triangle pointing to the super class. Payment is a super class of Cash, Check, and Credit.

An association has two ends. An end may have a role name to clarify the nature of the association. For example, an Order Detail is a line item of each Order.

A navigability arrow on an association shows which direction the association can be traversed or queried. An Order Detail can be queried about its Item, but not the other way around. The arrow also lets you know who "owns" the association's implementation; in this case, Order Detail has an Item. Associations with no navigability arrows are bi-directional. The multiplicity of an association end is the

(14)

table gives the most common multiplicities. Multiplicities Meaning

0..1 zero or one instance. The notation n . . m indicates n to m instances.

0..* or * no limit on the number of instances (including none).

1 exactly one instance

1..* at least one instance

Every class diagram has classes, associations, and multiplicities. Navigability and roles are optional items placed in a diagram to provide clarity.

Packages and object diagrams

To simplify complex class diagrams, you can group classes into packages. A package is a collection of logically related UML elements. The diagram below is a business model in which the classes are grouped into packages.

(15)

Packages appear as rectangles with small tabs at the top. The package name is on the tab or inside the rectangle. The dotted arrows are dependencies. One package depends on another if changes in the other could possibly force changes in the first.

Object diagrams show instances instead of classes. They are useful for explaining small pieces with complicated relationships, especially recursive relationships.

This small class diagram shows that a university Department can contain lots of other Departments.

(16)

The object diagram below instantiates the class diagram, replacing it by a concrete example.

Each rectangle in the object diagram corresponds to a single instance. Instance names are underlined in UML diagrams. Class or instance names may be omitted from object diagrams as long as the diagram meaning is still clear.

(17)

operation are listed from left to right according to when they take part in the message sequence.

Below is a sequence diagram for making a hotel reservation. The object initiating the sequence of messages is a Reservation window.

The Reservation window sends a make Reservation () message to a Hotel Chain. The Hotel Chain then sends a make Reservation () message to a Hotel. If the Hotel has available rooms,

(18)

receiver's lifeline. The activation bar represents the duration of execution of the message.

In our diagram, the Hotel issues a self call to determine if a room is available. If so, then the Hotel creates a Reservation and a Confirmation. The asterisk on the self call means iteration (to make sure there is available room for each day of the stay in the hotel). The expression in square brackets, [ ], is a condition.

Collaboration diagrams

:

Collaboration diagrams are also interaction diagrams. They Convey the same information as sequence diagrams, but they focus on object roles instead of the times that messages are sent. In a sequence diagram, object roles are the vertices and messages are the connecting links.

(19)

The object-role rectangles are labeled with either class or object names (or both). Class names are preceded by colons (: ).

Each message in a collaboration diagram has a sequence number. The top-level message is numbered 1. Messages at the same level (sent during the same call) have the same decimal prefix but suffixes of 1, 2, etc. according to when they occur.

State chart

diagrams

:

Objects have behaviors and state. The state of an object depends on its current activity or condition. A state chart diagram shows the possible states of the object and the transitions that cause a change in state.

(20)

validation.

Logging in can be factored into four non-overlapping states: Getting SSN, Getting PIN, Validating, and Rejecting. From each state comes a complete set of transitions that determine the subsequent state.

(21)

does not wait for an outside event to trigger a transition. Instead, it performs an activity. The result of that activity determines its subsequent state.

Activity diagrams

:

An activity diagram is essentially a fancy flowchart. Activity diagrams and state chart diagrams are related. While a state chart diagram focuses attention on an object undergoing a process (or on a process as an object), an activity diagram focuses on the flow of activities involved in a single process. The activity diagram shows the how those activities depend on one another.

For our example, we used the following process.

"Withdraw money from a bank account through an ATM."

The three involved classes (people, etc.) of the activity are Customer, ATM, and Bank. The process begins at the black start

Circle at the top and ends at the concentric white/black stop circles at the bottom. The activities are rounded rectangles.

(22)

Activity diagrams can be divided into object swimlanes that determine which object is responsible for which activity. A single transition comes out of each activity, connecting it to the next

(23)

A transition may fork into two or more parallel activities. The fork and the subsequent join of the threads coming out of the fork appear in the diagram as solid bars.

Component and deployment diagrams

:

A component is a code module. Component diagrams are physical analogs of class diagram. Deployment diagrams show the physical configurations of software and hardware.

The following deployment diagram shows the relationships among software and hardware components involved in real estate transactions.

(24)

The physical hardware is made up of nodes. Each component belongs on a node. Components are shown as rectangles with two tabs at the upper left.

STEPS FOR MODELING UML DIAGRAMS

Modeling steps for Use case Diagram

1. Draw the lines around the system and actors lie outside the system.

(25)

5. Functionality or behavior of actors is considered as use cases.

6. Specify the generalized and specialized use cases.

7. Se the relationship among the use cases and in between actor and use cases.

8. Adorn with constraints and notes.

9. If necessary, use collaborations to realize use cases.

Modeling steps for Sequence Diagrams

1. Set the context for the interactions, system, subsystem, classes, object or use cases.

2. Set the stages for the interactions by identifying objects which are placed as actions in interaction diagrams.

3. Lay them out along the X-axis by placing the important object at the left side and others in the next subsequent.

(26)

6. Specify the time and space constraints. 7. Set the pre and post conditioned.

Modeling steps for Collaboration Diagrams

1. Set the context for interaction, whether it is system, subsystem, operation or class or one scenario of use case or collaboration.

2. Identify the objects that play a role in the interaction. Lay them as vertices in graph, placing important objects in centre and neighboring objects to outside.

3. Set the initial properties of each of these objects. If the attributes or tagged values of an object changes in significant ways over the interaction, place a duplicate object, update with these new values and connect them by a message stereotyped as become or copy.

4. Specify the links among these objects. Lay the association links first represent structural connection. Lay out other links and adorn with

(27)

7. Attach pre & post conditions to specify flow of control formally.

Modeling steps for Activity Diagrams

1. Select the object that has high level responsibilities.

2. These objects may be real or abstract. In either case, create a swim-lane for each important object.

3. Identify the precondition of initial state and post conditions of final state.

4. Beginning at initial state, specify the activities and actions and render them as activity states or action states.

5. For complicated actions, or for a set of actions that appear multiple times, collapse these states and provide separate activity diagram.

6. Render the transitions that connect these activities and action states.

(28)

1. Choose the context for state machine, whether it is a class, a use case, or the system as a whole.

2. Choose the initial & final states of the objects.

3. Decide on the stable states of the object by considering the conditions in which the object may exist for some identifiable period of time.

4. The high-level states of the objects & only then consider its possible sub-states.

5. Decide on the meaningful partial ordering of stable states over the lifetime of the object.

6. Decide on the events that may trigger a transition from state to state. Model these events as triggers to transitions that move from one legal ordering of states to another.

7. Attach actions to these transitions and/or to these states.

8. Consider ways to simplify your machine by using substates, branches, forks, joins and history states. 9. Check that all states are reachable under some

combination of events.

(29)

1. Identity the things that are interacting with class diagram.

2. Set the attributes and operations. 3. Set the responsibilities.

4. Identify the generalization and specification classes.

5. Set the relationship among all the things.

6. Adorn with tagged values, constraints and notes.

Modeling steps for Object Diagrams

1. Identify the mechanisms which you would like to model.

2. Identify the classes, use cases, interface, subsystem which are collaborated with mechanisms.

3. Identify the relationship among all objects.

4. Walk through the scenario until to reach the certain point and identify the objects at that point.

(30)

Modeling

steps for Component Diagrams

1. Identify the component libraries and executable files which are interacting with the system.

2. Represent this executables and libraries as components.

3. Show the relationships among all the components. 4. Identify the files, tables, documents which are

interacting with the system.

5. Represent files, tables, documents as components. 6. Show the existing relationships among them

generally dependency.

7. Identify the seams in the model.

8. Identify the interfaces which are interacting with the system.

9. Set attributes and operation signatures for interfaces.

10.Use either import or export relationship in b/w interfaces & components.

11.Identify the source code which is interacting with the system.

(31)

1. Identify the processors which represent client & server.

2. Provide the visual cue via stereotype classes.

3. Group all the similar clients into one package.

4. Provide the links among clients & servers.

5. Provide the attributes & operations.

6. Specify the components which are living on nodes.

7. Adorn with nodes & constraints & draw the deployment diagram.

APPLICATION OF RATION ROSE TO UML

Rational Rose was developed by IBM Corporation in order to develop a software system based on the concepts of Object Oriented Analysis and Design approach as developed from the models of Grady Booch, Jacobson and Ram Baugh methodologies, resulting into a Unified approach.

(32)

for an application by blocking out classes with actors (stick figures),

use case elements (ovals), objects (rectangles) and

messages/relationships (arrows) in a sequence diagram using drag-and-drop symbols. Rational Rose documents the diagram as it is being constructed and then generates code in the designer's choice of C++,

Visual Basic, Java, Oracle8, CORBA or Data Definition Language.

Two popular features of Rational Rose are its ability to provide iterative development and round-trip engineering. Rational Rose allows designers to take advantage of iterative development (sometimes called evolutionary development) because the new application can be created in stages with the output of one iteration becoming the input to the next. (This is in contrast to waterfall development where the whole project is completed from start to finish before a user gets to try it out.) Then, as the developer begins to understand how the components interact and makes modifications in the design, Rational Rose can perform what is called "round-trip engineering" by going back and updating the rest of the model to ensure the code remains consistent.

(33)

elements and their model properties. Since diagram is used to illustrate multiple views of a model, icons representing a model element can appear in none, or several of a model’s diagrams.

The application therefore enables you to control, which element, relationship and property icons appear on each diagram, using facilities provided by its application window. Within its application window, it displays each diagram in a diagram window and each specification in a specification window.

It provides a separate tool , called Model Integrator to compare and merge models and their controlled units. It also enables teams to reuse large- scale design assets developed in earlier modeling efforts by providing the possibility to add frame works in Rational Rose.

HISTORY

ROSE = Rational Object Oriented Software Engineering

Rational Rose is a set of visual modeling tools for development of object-oriented software. Roses uses the UML to provide graphical method for non-programmers wanting to model business process as well as programmers modeling application logic.

(34)
(35)

Point of Sale System

AIM: To create a Point of Sale System ACTORS:

1. customer 2. cashier USECASES:

1. Bar code scanning 2. Process sale 3. Close sale 4. Pay Bill. 5. Tax calculation 6. Buy product 7. Update Inventory ALGORITHMIC PROCEDURE: STEP 1: Start the application

STEP 2: Create the require actors and use cases in the browser window

STEP 3: Goto new use case view and then click the use case view and open a new package

STEP 4: Rename the new package with the package with required names

(36)
(37)
(38)

Use Case Diagram : Pay bill Process sale Close sale Update Inventory Barcode scanning Tax calculation Cashier Customer Buy product

(39)
(40)

1: process sale 2: enter item

3: scan item 4: total cost 5: close sale 6: total cost with tax

7: bill generation 8: generate reoprt

(41)

r 1: Enter no of items

2: get item id 3: show item details 4: calculate bill

5: bill payment

6: get credit card number

7: verify validation 8: valid 9: validation ok

(42)

Process sale collaboration diagram

C a s h i e r

P O S

S y s t e m

C o d e s c a n

n e r

C a r d

r e a d e r

B a n k

1 : E n t e r n o o f i t e m s

2 : g e t i t e m i d

3 : s h o w i t e m d e t a i ls

4 : c a lc u la t e b i ll

5 : b i ll p a y m e n t

6 : g e t c r e d i t c a r d n u m b e r

7 : v e r i f y v a li d a t i o n

8 : v a li d

9 : v a li d a t i o n o k

1 0 : g e n e r a t e r e p o r t

(43)
(44)

e n t e r s t h e

s h o p

s e le c t

p r o d u c t

p a y th e b i ll

p r e p a r e i t e m

li s t

p r o c e s s b i ll

s c a n i t e m s

b i ll

g e n e r a t i o n

(45)

Point of scale

RESULT:

Thus various UML Diagrams were generated for POINT OF SALE

(46)
(47)

ONLINE BOOK SHOP SYSTEM

ONLINE BOOKSHOP SYSTEM SPECIFICATIONS: Objectives:

The purpose of this document is to define requirements of the online bookshop system. This specification lists the requirements that are not readily captured in the use cases of the Use case model. The supplementary specifications and the use case model together capture a complete set of requirement on the system.

Scope:

The specification defines the non-functional requirements of the system, such as reliability, usability, performance and supportability. The functional requirements are defined in the use case specifications. References:

(48)

Usability:

The desktop user-interface shall be Windows 95, 98 compliant.

Reliability:

The system shall be available 24 hrs a day and 7 days a week.

Performance:

• The system shall support large number of simultaneous users against the central database at any time.

• The system shall provide access to catalog database with no more then ten seconds latency.

• The system must be able to complete 80% of all transactions within 2 minutes.

Supportability:

None

Brief Description of the Project:

The current project emphasizes on analysis and design of an online bookshop system. That serves the customers needs. The customer’s available activities in the proposed system from logging on the browsing the book store, selecting items and making purchases are described.

PROBLEM STATEMENT FOR ONLINE BOOKSHOP SYSTEM

(49)

registered customer can browse through the book catalogue and can make selections. The new system should even assist the customer in locating a book in that, the customer can browse the current book catalogue online and this should detail the book details and stock details for the books.

The user should be able to filter by book title, author and book category. If the user cannot find a book in current category, they should place an order and request the book. This includes details like Author, Publishers, Title, Book Name and Category. The payment is done through credit card and also through gift cheques etc., the customer is informed about the transaction details through e-mails. The shipment details are entered by the customer and through those details the delivery is processed.

USE CASE

The use case model describes the proposed functionality of the system. A use case represents a discrete unit of interaction between a user and the system. A use case is a single unit of

meaningful work. Each use case has a description which describes the functionality that will be built in a proposed system. A use case may ‘include’ another use case functionality or ‘extend’ another use case with its own behavior.

(50)

• Create order • Book catalog

• Manage cart and payments • Order status • Inventory RELATIONSHIPS USED:AssociationDependencyComposition

Modeling steps for Use case Diagram

1. Draw the lines around the system and actors lie outside the system.

Identify the actors which are interacting with the system.

2. Separate the generalized and specialized actors.

3. Identify the functionality the way of interacting actors with system and specify the behavior of actor.

4. Functionality or behavior of actors is considered as use cases.

5. Specify the generalized and specialized use cases.

6. Se the relatonship among the use cases and in between actor and use cases.

Adorn with constraints and notes.

(51)

5. Start the message which is initiating interactions and place all other messages in the increasing order of items.

6. Specify the time and space constraints. 7. Set the pre and post conditioned.

Modeling steps for Collaboration Diagrams

1. Set the context for interaction, whether it is system, subsystem, operation or class or one scenario of use case or collaboration.

2. Identify the objects that play a role in the interaction. Lay them as vertices in graph, placing important objects in centre and neighboring objects to outside.

3. Set the initial properties of each of these objects. If the attributes or tagged values of an object changes in significant ways over the interaction, place a duplicate object, update with these new values and connect them by a message stereotyped as become or copy.

4. Specify the links among these objects. Lay the association links first represent structural connection. Lay out other links and adorn with stereotypes.

5. Starting with the message that initiates this interaction, attach each subsequent message to appropriate link, setting sequence number as appropriate.

6. Adorn each message with time and space constraints if needed

7. Attach pre & post conditions to specify flow of control formally.

(52)

1. Select the object that has high level responsibilities.

2. These objects may be real or abstract. In either case, create a swim lane for each important object.

3. Identify the precondition of initial state and post conditions of final state.

4. Beginning at initial state, specify the activities and actions and render them as activity states or action states.

5. For complicated actions, or for a set of actions that appear multiple times, collapse these states and provide separate activity diagram.

6. Render the transitions that connect these activities and action states.

7. Start with sequential flows; consider branching, fork and joining.

8. Adorn with notes tagged values and so on. Modeling steps for State chart Diagram

1. Choose the context for state machine,whether it is a class, a use case, or the system as a whole.

2. Choose the initial & final states of the objects.

3. Decide on the stable states of the object by considering the conditions in which the object may exist for some identifiable period of time. Start with the high-level states of the objects & only then consider its possible substrates. 4. Decide on the meaningful partial ordering of stable states

over the lifetime of the object.

5. Decide on the events that may trigger a transition from state to state. Model these events as triggers to transitions that move from one legal ordering of states to another.

(53)

their responses.

Modeling steps for Class Diagrams

1. Identity the things that are interacting with class diagram. 2. Set the attributes and operations.

3. Set the responsibilities.

4. Identify the generalization and specification classes. 5. Set the relationship among all the things.

6. Adorn with tagged values, constraints and notes. Modeling steps for Object Diagrams

1. Identify the mechanisms which you would like to model. 2. Identify the classes, use cases, interface, subsystem which

are collaborated with mechanisms.

3. Identify the relationship among all objects.

4. Walk through the scenario until to reach the certain point and identify the objects at that point.

5. Render all these classes as objects in diagram. 6. Specify the links among all these objects.

7. Set the values of attributes and states of objects. Modeling steps for Component Diagrams

1. Identify the component libraries and executable files which are interacting with the system.

2. Represent this executables and libraries as components. 3. Show the relationships among all the components.

(54)

8. Identify the interfaces which are interacting with the system.

9. Set attributes and operation signatures for interfaces.

10.Use either import or export relationship in b/w interfaces & components.

11.Identify the source code which is interacting with the system.

12.Set the version of the source code as a constraint to each source code.

13.Represent source code as components. 14.Show the relationships among components. 15.Adorn with nodes, constraints and tag values. Modeling steps for Deployment Diagram

1. Identify the processors which represent client & server. 2. Provide the visual cue via stereotype classes.

3. Group all the similar clients into one package. 4. Provide the links among clients & servers. 5. Provide the attributes & operations.

6. Specify the components which are living on nodes. 7. Adorn with nodes & constraints & draw the deployment

diagram. CLASS DIAGRAM:

A Class is a standard UML construct used to detail the pattern from which objects will be produced at run time. A class is a specification- an object is an instance of a class. Classes may be inherited from other classes, have other classes as attributes, delegate responsibilities to other classes and implement abstract interfaces.

(55)

• Shopping cart • Order

• Item order

• Shipping address and billing address.

PACKAGES:

The class diagram of the online book shop system is shown to be grouped into three packages. The contents of the packages are as follows:

PACKAGE-1: BOOKSHOP

This package consists of following classes: 1. Bookshop staff

2. Book 3. Bookshop 4. Item

PACKAGE-2: CUSTOMER

(56)

PACKAGE -3:ONLINE ORDERING

This package consists of following classes: 1. Order

2. Item Order 3. Shopping Cart

(57)
(58)
(59)
(60)

2 : m a n a g e s 3 : u p d a te s 1 : lo g i n re q u e s t 4 : u p d a te 5 : v e r i fy 6 : r e g i s te r fi r s t 7 : r e g is te r e d lo g o n r e q u e s t 8 : v e ri fy 9 : lo g o n s u c c e s s fu l 1 0 : c re a te o r d e r 1 1 : s e le c t b o o k s 1 2 : v e r ify 1 3 : s to c k o k 1 4 : c o n fi rm s e le c ti o n 1 5 : a d d to c a rt 1 6 : s h i p p m e n t d e ta i ls 1 7 : p a y m e n t 1 8 : d e liv e r e d s u c c e s s fu lly

(61)

1: login request login create order book catalog cart consorti num databa se custom er invent bookshop staff shippment details payme nt 11: select books 15: add to cart 17: payment 9: logon successful 4: update 12: verify 14: confirm selection 2: manages 3: updates 13: stock ok 18: delivered successfully registrat ion 6: register first

7: registered logon request 10: create order

16: shippment details

5: verify

(62)

STATE CHART DIAGRAM:

Objects have behaviors and state. The state of an object depends on its current activity or condition. A state chart diagram shows the possible states of the object and the transitions that cause a change in state. The initial state (black circle) is a dummy to start the action. Final states are also dummy states that terminate the action.

(63)

b r o w s e

s c r e e n

m a in s c r e e n

c re a te

o rd e r

li s te d b o o k s

i n c a ta lo g

w a it fo r

r e s u lt

s e a rc h b y a u th o r,ti tle ,i s b n

c a n c e l

c a n 't fi n d

c a n c e ls

r e tu rn to

w a it fo r

v ie w d e ta i ls

w a it fo r

tra n s a c tio n d e ta ils

n o t s a tis fie d

c a r t

a d d to

v ie w s h i p p i n g d e ta i ls

i n v a lid tra n s a c tio n

tra n s a c ti o n s u c c e s s d i s p la y th a n k u s c r e e n

(64)

divided into object swim lanes that determine which object is responsible for which activity. A single transaction comes out of each activity, connecting it to the next activity.

display welcome msg get login get pwd and validate display item info accept selection create order for cart display order acceptance ship to customer accepted rejected more selections completed rejected

(65)

address.ja va order.java book.java bokshop.java bookstaff.java item.java order.class book.class bookshop. class bookstaff.c lass books.db items.db central server.java central server.class/.dll central database address.cl ass item.class address.db order.db

(66)
(67)

RESULT :

Thus various UML Diagrams were generated for ONLINE BOOK SHOP and the corresponding code was generated using Visual Basic.

(68)
(69)

AN ONLINE AUCTION SALE

Aim: To create a case study on ONLINE AUCTION Overview:

The online auction system is a design about a website where sellers collect and prepare a list of items they want to sell and place it on the website for visualizing. To accomplish this purpose the user has to access the site. Incase it’s a new user he has to register. Purchaser logs in and selects items they want to buy and keep bidding for it. Interacting with the purchasers and sellers in the chat room does this. The purchaser making the highest bid for the item before the close of the auction is declared as the owner of the item. If the auctioneer or the purchaser does not want to bid for the product then there is fixed cutoff price mentioned for every product. He can pay the amount directly and own the product. The purchaser gets a confirmation of his purchase as an acknowledgement from the website. After the transaction by going back to the main menu where he can view other

(70)

3. Activity diagram to show flow of each use case. 4. Sequence and collaboration diagrams.

5. State chart diagram shows states before and after each action. Conceptualization:

Assumptions:

• The users are allowed to register and give user id’s to have identification.

• The users are allowed to bid for any price according to their wish provided it’s more than the minimum price of auction. • The fixed cut-off price is decided and confirmed for every

product.

• The auctioneer requesting the product for the cut-off price is given priority.

• The auctioneer bidding the maximum price is given the product.

Inputs:

• The login details of the auctioneer. • List of available products on the site.

• Details such as specifications and the price of each product. • Bidding price of the auctioneer.

Outputs:

• The cut-off price for each product. • Updated status of bid price.

(71)

• Bid for the product. • Log on to the site. • Fix or bid for the price. • Function points

➢ Bidder request product details. ➢ Pay final price and bid the product.

➢ Loop

 Check any product details.  Check for cutoff price. Actors:

1. Purchaser 2. Seller

Use Cases in Auction System 1. Login

2. Seller 3. Purchaser 4. Chatting

(72)

1. Validate User 2. Record chatting.

ALGORITHMIC PROCEDURE: STEP 1: Start the application

STEP 2: Create the require actors and use cases in the browser window

STEP 3: Got new use case view and then click the use case view and

Open a new package

STEP 4: Rename the new package with the package with required

Names

(73)

system and specify the behavior of actor.

5. Functionality or behavior of actors is considered as use cases.

6. Specify the generalized and specialized use cases.

7. Se the relationship among the use cases and in between actor and use cases.

8. Adorn with constraints and notes.

9. If necessary, use collaborations to realize use cases.

Modeling steps for Sequence Diagrams

1. Set the context for the interactions, system, subsystem, classes, object or use cases.

2. Set the stages for the interactions by identifying objects which are placed as actions in interaction diagrams.

3. Lay them out along the X-axis by placing the important object at the left side and others in the next subsequent. 4. Set the lifelines for each and every object by sending

create and destroy messages.

5. Start the message which is initiating interactions and place all other messages in the increasing order of items.

6. Specify the time and space constraints. 7. Set the pre and post conditioned.

(74)

1. Set the context for interaction, whether it is system, subsystem, operation or class or one scenario of use case or collaboration.

2. Identify the objects that play a role in the interaction. Lay them as vertices in graph, placing important objects in centre and neighboring objects to outside.

3. Set the initial properties of each of these objects. If the attributes or tagged values of an object changes in significant ways over the interaction, place a duplicate object, update with these new values and connect them by a message stereotyped as become or copy.

4. Specify the links among these objects. Lay the association links first represent structural connection. Lay out other links and adorn with stereotypes.

5. Starting with the message that initiates this interaction, attach each subsequent message to appropriate link, setting sequence number as appropriate.

6. Adorn each message with time and space constraints if needed

7. Attach pre & post conditions to specify flow of control formally.

Modeling steps for Activity Diagrams

1. Select the object that has high level responsibilities.

2. These objects may be real or abstract. In either case, create a swim lane for each important object.

3. Identify the precondition of initial state and post conditions of final state.

(75)

Modeling steps for State chart Diagram

1. Choose the context for state machine, whether it is a class, a use case, or the system as a whole.

2. Choose the initial & final states of the objects.

3. Decide on the stable states of the object by considering the conditions in which the object may exist for some identifiable period of time. Start with the high-level states of the objects & only then consider its possible substrates. 4. Decide on the meaningful partial ordering of stable states

over the lifetime of the object.

5. Decide on the events that may trigger a transition from state to state. Model these events as triggers to transitions that move from one legal ordering of states to another. 6. Attach actions to these transitions and/or to these states. 7. Consider ways to simplify your machine by using

substates, branches, forks, joins and history states.

8. Check that all states are reachable under some combination of events.

9. Check that no state is a dead from which no combination of events will transition the object out of that state.

10.Trace through the state machine, either manually or by using tools, to check it against expected sequence of events & their responses.

Modeling steps for Class Diagrams

(76)

6. Adorn with tagged values, constraints and notes.

Modeling steps for Object Diagrams

1. Identify the mechanisms which you would like to model.

2. Identify the classes, use cases, interface, subsystem which are collaborated with mechanisms.

3. Identify the relationship among all objects. 4. Walk through the scenario until to reach the

certain point and identify the objects at that point.

5. Render all these classes as objects in diagram. 6. Specify the links among all these objects.

7. Set the values of attributes and states of objects.

Modeling steps for Component Diagrams

1. Identify the component libraries and executable files which are interacting with the system.

2. Represent this executables and libraries as components.

(77)

interfaces.

10.Use either import or export relationship in b/w interfaces & components.

11.Identify the source code which is interacting with the system.

12.Set the version of the source code as a constraint to each source code.

13.Represent source code as components. 14.Show the relationships among components. 15.Adorn with nodes, constraints and tag values.

Modeling steps for Deployment Diagram

1. Identify the processors which represent client & server. 2. Provide the visual cue via stereotype classes.

3. Group all the similar clients into one package. 4. Provide the links among clients & servers. 5. Provide the attributes & operations.

6. Specify the components which are living on nodes. 7. Adorn with nodes & constraints & draw the deployment

(78)
(79)

p r o d u c t

id

n a m e

t y p e

c u r r e n t B i d d i n g P r i c e

fi n a lC u t O ffP r i c e ( )

p r o d u c t ( )

a u c t i o n e r

i d

s e n d T h e D e t a li s O fP r o d u c t s T o B id d e r ( )

u p d a t e T h e B id d in g P r ic e ( )

s e ll T h e P r o d u c t ( )

g e t T h e P r ic e p a id ( )

a u c t i o n e r ( )

a d d r e s s

l o g o n t o t h e s i t e ( )

s e a r c h fo r t h e r e q u i r e d p r o d u c t ( )

b id fo r p r o d u c t ( )

p a y t h e p r i c e ( )

li s t O fA v a ila b l e P r o d u c t s

li s t O fP r ic e s

w e b H o s t

u p d a t e t h e s i t e w it h p r o d u c t s ( )

s e ll t h e p r o d u c t s ( )

(80)
(81)

search for product

bid the product

pay the price B Idder

request/send details

buy/sell the product

A uctioner

(82)
(83)

login

s earc h

reques t produc t details

get details display details

pay final price or bid for product

update bid price

c hec k for product

give ack n if suitable for selling buy the product

pay price

(84)

: B Id d e r s : s ite p : p ro d u c t 8 : c h e c k fo r p ro d u c t 1 : lo g in 1 2 : lo g o u t 2 : s e a rc h 3 : re q u e s t p ro d u c t d e t a ils 6 : p a y fin a l p ric e o r b i d fo r p ro d u c t 1 0 : b u y t h e p ro d u c t 1 1 : p a y p ric e 4 : g e t d e t a ils 7 : u p d a t e b id p ric e 5 : d is p la y d e t a ils 9 : g ive a c k n if s u it a b le fo r s e llin g

(85)
(86)

log on to the site

search for the product

request details

if final fixed price suitable bid the final price and

buy the product

bid for the product

check for the cutoff price

sell/buy the product

if suitable for selling wait for the

next bid

pay the price no

yes

(87)
(88)

wait for request

wait for the desicion

wait to update bid price

Bid the price

wait until next bid comes

bid for a higher price

wait for bid price

to meet cut off compare the bidding price with cutoff

wait for payment

sell / but the product

(89)
(90)

c e ntra l s e rve r ja va c e ntra l s erve r c las s C en tral da tab as e lis t o f p ric e s w e b h os t s ite c us to m er prod uc t.db

(91)
(92)

Aim: to create a Multi- Threaded Airport Simulation Actors: ATC Controller Use Cases 1. ATC Controller

2. Decision Support System 3. Planning 4. Emergency 5. Sensor 6. Gateway 7. Runway 8. Terminal 9. Available 10.Waiting Queue Algorithmic Procedure:

STEP 1: Start the application

STEP 2: Create the require actors and use cases in the browser window

STEP 3: Go to new use case view and then click the use case view and

(93)

Overview

A critical step of the project is to design a modeling and simulation infrastructure to experiment and validate the proposed solutions

The ever growing demand of air transport shows the vulnerability of the current air traffic management system: Congestion, time delays, etc.particularly in poor whether conditions. The project is focused on controller and pilot assistance systems for approach and ground movements. The critical step of the project was to design an airport modeling and simulation infrastructure to improve the safety and efficiency of ground movements in all whether conditions. It simulates the arrivals and departures at an airport in a time sequence. During every minute, planes may enter the systems, they may land, they may take off, or they may crash. The project must keep track of planes, assign planes to runways, execute the take offs and landings, and keep track of status of each plan, runway and terminal.

So the finally made computer software should model various aspects of the total airports operation-connecting airside and landside, literally from the airspace to the curb.

As part of case study, following analysis diagrams will be created 1. Use cases for the system.

2. Class diagram for initially identified classes. 3. Activity diagram to show flow for each use case. 4. Sequence and Collaboration diagram.

5. State chart diagram shows states before and after each action. Conceptualization

(94)

• Planes arrive for landing at random times, but with a specified probability of a plane arriving during any given minute.

• Planes arrive for take off at random times, but with a specified probability of a plane arriving during any given minute

• Landings have priorities over takeoffs.

• Planes arriving for landing have a random amount of fuel and they will crash if they do not land before they run out of fuel. Input will be:

• The amount of time needed for one plane to land.

The amount of time needed for one plane to takeoff.

• The probability of a plane entering the landing queue in any given minute.

• The probability of a plane entering the takeoff queue in any given minute.

• The maximum minutes until a plane waiting to land will crash. • The statues of each runway, plane and terminal.

The Output of the program will be: • Total simulation time.

• The number of planes that takeoff in the simulated time. • The number of planes that landed in the simulated time. • The average time a plane spent in the takeoff queue. • The average time a plane spent in the landing queue. • Updated status of each runway, plane, and terminal. Key terms:

(95)

- Assign the runway to the plan. 4. Update status of runway and terminal. 5. Get the plane landed safely.

6. Check if time left for next departure. 7. Loop

- Check the status of each terminal.

- Validate if terminal suitable for particular aircraft. - Assign terminal to aircraft.

8. Get the plane parked in the terminal. 9. Update status of terminal.

Requirement Analysis: Textual Analysis:

This covers the requirements and diagrams of the project. The complete simulation of airport control system as follows

Actors:

These are who are involved in interaction of the whole process. 1. Technical head: He is the person who supervises the controls

the ground traffic on runway. He checks the status of runways and assigns the free runways and terminals for takeoff and landing.

2. Pilot: He is the person who controls the aircraft. He transmits or receives signals regarding the free runways, and terminal from the control room. He is responsible for the safe landing or takeoffs the planes.

Use cases:

The steps involved in the whole process are indicated as use cases.

(96)

• Update status of runway, terminal.

1. Transmit/receive signals: The pilot in the aircraft transmits signals for requesting a free runway to takeoff or land. The control room on the ground receives these signals from the aircrafts.

2. Check availability of runway: The status of each runway in the airport is checked if it’s free and its going to be free until the particular aircraft is landed or takeoff. If this is going to be free then runway number is transmitted to the pilot on aircraft.

3. Land the plane: The plane is landed safely on the airport as per directions given by the control room regarding runway and

timings.

4. Check if time left for next departure: If the plane leaves immediately after landing then assign again a runway for

takeoff. If there is still time then the plane has to be parked in a terminal.

5. Check availability of terminals: the status of each terminal is to be checked to find a free terminal. It should be checked

whether that particular model of plane fits into that terminal. Then that particular terminal has to be assigned to the plane. 6. Update Status: the status of runway and terminal are to be set

to be using while using them. The status has to be immediately changed as soon as the work is complete. This should be

supervised carefully to avoid collisions and crashes of aircrafts. Classes:

The classes contain the attributes and operations related to them the main classes classified in this solution are:

(97)

one plane can use runway at a time to takeoff or land.

4. Terminal: This is the place where the planes are parked until the next departure. The terminal is to be parked in it.

5. Takeoff/land: The leaving of planes is called takeoff and

coming back to runway is called landing. The runway is used for either purpose.

Diagrams:

Class Diagram

A Class is a standard UML construct used to detail the pattern from which objects will be produced at run time. A class is a specification- an object is an instance of a class. Classes may be inherited from other classes, have other classes as attributes, delegate responsibilities to other classes and implement abstract interfaces.

Classes of airport simulation are:

Class Attributes Operations

Control Room -Technical head

-No of staff

-systems to control

+Receive signals from planes()

+Check for free runway()

+Send runway no() +Check for next departure()

+Look for free

terminal()

+Send terminal no to plane()

+Get plane parked() Takeoff/Landing -Runway no

(98)

+Request terminal if time left for next departure()

+Receive terminal no() +Get the plane parked in the terminal()

Terminal -No of runways

-Size of terminal -Flight model which fits in

-Status of terminal

-

---Runway -No of runways

-Length of runway Status of runway -Free timings -Runway no

+Update status of runway after each takeoff/landing()

Use Case Diagram

The use case model describes the proposed functionality of the system. A use case represents a discrete unit of interaction between a user and the system. A use case is a single unit of meaningful work. Each use case has a description which describes the functionality that will be built in a proposed system. A use case may ‘include’ another use case functionality or ‘extend’ another use

(99)

Safely .Give acknowledgment about the timings to control

Terminal .Get the plane into the free

Sequence diagram

UML provides a graphical means of depicting object interactions over time in sequence diagrams. These typically show a user or actor and the objects and components they interact with in the execution of a use case.

1. Technical head: He is the person who supervises the controls the ground traffic on runway. He checks the status of runways and assigns free terminals for takeoff and landing. 2. Pilot: He is the person who controls the aircraft. He transmits

or Receives signals regarding the free runways and terminal from the control room. He is responsible for the safe landing or takeoff the planes.

Objects

1. Runway: This is the path the plane uses to land or takeoff. Only one plane can use a runway at a time takeoff or landing.

(100)

3. Whether Conditions: The whether department decodes the atmospheric data files from the current whether conditions and sends them to the control room. The systems in the control room checks whether the condition is suitable for landing the planes.

4. Terminal: This is the place where the planes are parked until the next departure. The terminal differs in size and shape. The plane suitable for that particular terminal is to be parked in it.

5. Cockpit: He is the person who controls the aircraft. He transmits or receives signals regarding the free runways and terminal fro the control room. He is responsible for the safe landing or takeoff of the planes.

Collaboration Diagram

Collaboration names a society of classes, interfaces and other elements that work together to provide some cooperative behavior that is bigger than the sum of all its parts. Collaboration diagram emphasis is based on structural organization of the objects that send and receive messages.

Activity Diagram

An activity diagram is essentially a fancy flowchart. Activity diagrams and state chart diagrams are related. While a state chart diagram focuses attention on an object undergoing a process (or on a process as an object), an activity diagram focuses on the flow of activities involved in a single process.

(101)

shows the possible states of the object and the transitions that cause a change in state. The initial state (black circle) is a dummy to start the action. Final states are also dummy states that terminate the action. Component Diagram

A component is a code module. Component diagrams are physical analogs of class diagram. Each component belongs on a node. Components are shown as rectangles with two tabs at the upper left.

Deployment Diagram

Deployment diagram shows the physical configurations of software and hardware.

(102)

C o n tr o lR o o m N o O fS t a ff : In t e g e r S y s t e m s T o C o n t ro l : S t ri n g t e c h n ic a l H e a d : S t rin g C h e c k fo r fre e ru n w a y () C h e c k fo r fre e t e rm in a l() C h e c k fo r t im e fo r n e x t d e p a t u re () W e a th e rD e p t H e a d : S t rin g C h e c k W e a t h e rC o n d it io n s () S e n d W e a t h e rR e p o rt () W e a t h e rD e p t () C o n tr o l- C o c k p it F lig h t N o : In t e g e r N o o f p ilo t s : In t e g e r t im in g s : In t e g e r if t im e le ft to w a i t s e n d s m e s s a g e to c o n t ro l ro o m () la n d s o n t h e ru n w a y () p la n e is t a k e n t o fre e t e rm in a l () re c ie ve s ru n w a y n o t o la n d () s e n d s s ig n a l fo r la n d in g t o g ro u n d c o n t ro l() T e rm i n a l F re e T im m in g s : In t e g e r m o d e lN o O fA irc ra ft W h ic h It S u it a b le : In t e g e r n o O fF re e T e rm in a l() s iz e O fT e rm i n a l () 11 1 1 . . * 1 1 . . * T a k e O ff a t t ri b u t e c h a n g e S t a tu s O fR u n w a y A ft e rA ln d in g () < < in t e rfa c e > > R u n W a y F re e T i m in g s : In te g e r L e n g t h O fR u n w a y : In t e g e r n o O fR u n w a y : In t e g e r U p d a t e S t a t u s A ft e rE a c h T a k e O ffO rL a n d in g () R u n W a y () 1 1 1 1 la n d in g a t t ri b u te c h a n g e S t a t u s O fR u n w a y A ft e rL a n d in g () < < In t e rfa c e > > 1 1 1 1 A i rp o rt S im u la ti o n

(103)
(104)

send / receive terminals numbers check availability of run awy

send/receive run way num

land / aircraft

check free terminals Control room

park aircraft

Plane cockpit

send / receive terminal numbers

(105)

: c o n tro l ro o m p :p ra n e C o c k p it T :te rm in a l R :ru n w a y W :W e a th e rDe p t 1 : re q u e s t s i g n a l 2 : s e n d s ig n a l 3 : C h e c k W e a th e r c o n d itio n s 4 : s e n d a c k n o w le d g e m e n t 5 : c h e c k a va lia b le fo r ru n w a y 6 : w a it s ig n a l 7 : s e n d s ig n a l 8 : s e n d a c k 9 : u p d a te ru n w a y s ta tu s 1 0 : if tim e i s fo r n e xt d e p s e n d re q 1 1 : i f te r m in a l i s fre e s e n d te rm in a l n o 1 2 : s e n d te rm in a l 1 3 : la n d a irc ra ft 1 4 : u p d a te s ta tu s o f te rm in a l A i rp o rt S im u la ti o n

(106)
(107)

: c o n tro l ro o m

T :te rm in

a l

R :r u n w a

y

W :W e a th e r

D e p t

3 : C h e c k W e a th e r c o n d itio n s

7 : s e n d s ig n a l

8 : s e n d a c k

1 2 : s e n d te rm in a l

1 3 : la n d a irc ra ft

2 : s e n d s ig n a l

4 : s e n d a c k n o w le d g e m e n t

5 : c h e c k a va li a b le fo r ru n w a y

9 : u p d a te ru n w a y s ta tu s

1 4 : u p d a te s ta tu s o f te rm in a l

(108)

References

Related documents

Behavioral diagrams consists of Use case Diagram, Sequence Diagram, Col - laboration Diagram, State chart Diagram, Activity Dia -

Two production process decomposition flow diagrams, the Milking Process Flow Diagram and the Cow Manage- ment Cycle Flow Diagram, were developed to identify the relevant

This project proposes the automatic testing technique to solve partially the testing process by generating test cases from UML Diagram Use Case and State Chart.. Firstly, we

Behavioral diagrams consists of Use case Diagram, Sequence Diagram, Collaboration Diagram, State chart Diagram, Activity

An insert operation can be modeled using many different diagrams, such as sequence diagram, communication diagram, activity diagram, interaction overview diagram and state

Create the Collaboration Diagram Create the Sequence Diagram Create the State Diagram Create the Activity Diagram Create the Deployment Diagram Create the Component Diagram Generate

STEPS Refer to student activity flow chart, theory, algorithm, test input, test output INSTRUCTIONS FOR WRITING JOURNAL Title • Problem Definition • Theory • Algorithm •

Figure 3 shows a process diagram (again based on an activity diagram with stereotypes from the business extensions) where the relationships between different processes are