OOAD COURSE FILE

80
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions III B.Tech II Semester Academic Dairy for Object Oriented Analysis and Design Academic Dairy Handbook III CSE II SEM 1

description

OOAD COURSE FILESoftware1 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.2 Each student has a separate login for database accessOracle 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.3 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.4 MASM ( Macro Assembler ) is installed in all the systemsStudents can execute their assembly language programs using MASM. MASM is very useful students because when they execute their programsThey can see contents of Processor Registers and how each instruction is being executed in the CPU.1. Rational Rose Software is installed in some systemsUsing this software, students can depict UML diagrams of their projects.2 Softwares installed: C, C++, JDK1.5, MASM, OFFICE-XP, J2EE and DOT NET, Rational Rose.3 Systems are provided for students in the 1:1 ratio.4 Systems are assigned numbers and same system is allotted for students when they do the lab.Software1 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.2 Each student has a separate login for database accessOracle 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.3 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.4 MASM ( Macro Assembler ) is installed in all the systemsStudents can execute their assembly language programs using MASM. MASM is very useful students because when they execute their programsThey can see contents of Processor Registers and how each instruction is being executed in the CPU.1. Rational Rose Software is installed in some systemsUsing this software, students can depict UML diagrams of their projects.2 Softwares installed: C, C++, JDK1.5, MASM, OFFICE-XP, J2EE and DOT NET, Rational Rose.3 Systems are provided for students in the 1:1 ratio.4 Systems are assigned numbers and same system is allotted for students when they do the lab.

Transcript of OOAD COURSE FILE

Page 1: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

III B.Tech II Semester

Academic Dairy

for

Object Oriented Analysis and Design

Faculty: Mrs.G.Sudeepthi

Academic Dairy Handbook III CSE II SEM 1

Page 2: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

DEPARTMENT OF COMPUTER SCIENCE

III/IV CSE –I SEM (2012-2013)

OBJECT ORIENTED ANALYSIS AND DESIGN

The main Objectives of this course are:

1. Object oriented Analysis and Design using UML present the concepts and techniques necessary to

effectively use system requirements to drive the development of a robust design model.

2. The UML is used throughout the project lifecycle to capture and communicate analysis and design

decisions.

3. To gain enough competence in object-oriented analysis and design (OOAD) to tackle a complete

OOproject

4. To acquire UML, a common language for talking about requirements, designs, and component

interfaces.

5. To understand the main principles of OO design.

6. To understand what major tasks are appropriate to developing OO models and software

7. To understand the issues and options in reuse and component based development.

8. Highlighting the impotence of object oriented analysis and design and its limitations

9. Showing how we apply the process of object oriented analysis and design to software development.

10. Pointing out the importance and function of each UML model to the process of object oriented

analysis and design, and explaining the notation of various elements in these models.

11. Providing students with necessary knowledge and skills in using object oriented CASE Tools.

Academic Dairy Handbook III CSE II SEM 2

Page 3: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

UNIT-I

Syllabus:

Introduction to UML: Importance of modeling, principles of modeling, object oriented modeling,

conceptual model of the UML, Architecture, and Software Development Life Cycle.

Objectives:

To Understand the principles of modeling

To identify the different stages in Software Development Life Cycle.

To understand the various building blocks of UML.

Lecture plan:

S.No Topic No. of lectures

1 Importance of modeling 1

2 Principles of modeling 1

3 Object oriented modeling 1

4 Conceptual model of the uml 3

5 Architecture 1

6 Software development life cycle 2

Total No Of Classes 9

Assignment Questions:

Academic Dairy Handbook III CSE II SEM 3

Page 4: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

1. What is UML.Write the importance of modeling and principles of modeling?

2. Explain object oriented modeling?

3. Explain different types of things in the UML?

4. What are the various relationships in the UML? Give Examples.

5. Write short notes on diagrams in the UML.

Case study:

Study and identify the various requirements involved in designing the below explained case studies

Case study 1. The Trusty Car Company Group:

The trusty car company group is rapidly growing business.It was formed about two years ago by

the merger of a number of garages who are specialized in sale of used cars.As the newly formed company

expanded to cover the sale of new vehicles .The primary business is currently considered to be in car sales

both new and used cars .the used cars are from variety of sources.The used cars held at particular garage

come from TCCG garages,some from customer trade ins at the garage.Each garage aims to keep a

limited number of second hand cars in stock depending upon current trends with in the group as well as

local sale patterns.

In addition to used cars each garage keeps limited supply of new cars.These are available to

customed to test drive/purchase.A record is maintained of all new cars on stock with the TCCG.If

customer requires a particular car and the local garage does not have the required car .the sales staff can

check if another car in TCCG has one on stock.If one can be located then a transfer /exchange between

garages is arranged by the manager.If not available then they can place a new requirement with car

manufacturer.Although the members of sales staff can take the bookings for test drives but the final

authorization rests with the manager.

Each garage has number of other departments like

Parts

ServicingAcademic Dairy Handbook III CSE II SEM 4

Page 5: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

Administration

The primary purpose of parts department is in supplying the service department and supporting

car sales.The parts department can also trade with customers directly.The service department has variety

of functions like basic car servicing and valet servicing.The administration department has functions like

taking care of staff salaries,holidays,leaves,general switch board activities,handle booking cars for service

department.

Case study 2: De sc ript i on f o r a n ATM S y s t e m

The software to be designed will control a simulated automated teller machine (ATM) having a

magnetic stripe reader for reading an ATM card, a customer console (keyboard and display) for

interaction with the customer, a slot for depositing envelopes, a dispenser for cash (in multiples of Rs.

100, Rs. 500 and Rs. 1000), a printer for printing customer receipts, and a key-operated switch to allow

an operator to start or stop the machine. The ATM will communicate with the bank's computer over an

appropriate communication link. (The software on the latter is not part of the requirements for this

problem

The ATM will service one customer at a time. A customer will be required to insert an ATM

card and enter a personal identification number (PIN) - both of which will be sent to the bank for

validation as part of each transaction. The customer will then be able to perform one or more

transactions. The card will be retained in the machine until the customer indicates that he/she desires

no further transactions, at which point it will be returned - except as noted below.

The ATM must be able to provide the following services to the customer:

1. A customer must be able to make a cash withdrawal from any suitable account linked to

the card, in multiples of Rs. 100 or Rs. 500 or Rs. 1000. Approval must be obtained from

the bank before cash is dispensed.

2. A customer must be able to make a deposit to any account linked to the card,

consisting of cash and/or checks in an envelope. The customer will enter the amount of the

deposit into the ATM, subject to manual verification when the envelope is removed from

the machine by an operator. Approval must be obtained from the bank before physically

accepting the envelope.

Academic Dairy Handbook III CSE II SEM 5

Page 6: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

3. A customer must be able to make a transfer of money between any two accounts linked to

the card.

4. A customer must be able to make a balance inquiry of any account linked to the card.

5. A customer must be able to abort a transaction in progress by pressing the Cancel key

instead of responding to a request from the machine.

The ATM will communicate each transaction to the bank and obtain verification that it was

allowed by the bank. Ordinarily, a transaction will be considered complete by the bank once it has been

approved. In the case of a deposit, a second message will be sent to the bank indicating that the customer

has deposited the envelope. (If the customer fails to deposit the envelope within the timeout period,

or presses cancel instead, no second message will be sent to the bank and the deposit will not be credited

to the customer.

If the bank determines that the customer's PIN is invalid, the customer will be required to re-

enter the PIN before a transaction can proceed. If the customer is unable to successfully enter the PIN

after three tries, the card will be permanently retained by the machine, and the customer will have to

contact the bank to get it back If a transaction fails for any reason other than an invalid PIN, the ATM

will display an explanation of the problem, and will then ask the customer whether he/she wants to do

another transaction. The ATM will provide the customer with a printed receipt for each successful

transaction

The ATM will have a key-operated switch that will allow an operator to start and stop the

servicing of customers. After turning the switch to the "on" position, the operator will be required to

verify and enter the total cash on hand. The machine can only be turned off when it is not servicing a

customer. When the switch is moved to the "off" position, the machine will shut down, so that the

operator may remove deposit envelopes and reload the machine with cash, blank receipts, etc.

Case Study 3:BANK

Design a system to handle current and savings account for a bank .Accounts are assigned to one or

more customers who may make deposits or with draw of money. each type of account earns interest on

current balance held in it. current accounts may have negative balances (over drafts) and then interest is

Academic Dairy Handbook III CSE II SEM 6

Page 7: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

deducted. Rate of interest is different for each type of account.

Bank employees can check any account that is held at their branch. They are responsible for

invoking the addition of interest and for issuing statements at correct times.

A customer may perform money transfer from one account and get credited to another

account .Transfer with in a branch happen immediately but transfer to other branches take three days

time .The customer passes over to the bank an amount of money in some combination of cash and

cheques. The customer specifies which account to be credited. The teller checks the balance and

authorizes the updating of relevant account.

If the money is incorrect or balance is not sufficient the teller informs the customer and returns the

money and account is not updated.

When customer applies to open a new account the teller processing the application must check

with the manager.The manager has other duties such as checking the books from time to time

Case study 4: Restaurant system:

The system is intended to support the day-to-day operations of a restaurant by improving the processes of

making reservations and allocating tables to customers. The Restaurant system provides the facilities like

• Record Booking

• Cancel Booking

• Record Arrival

• Table Transfer

The new system can offer diners eat at the restaurant without making an advance booking, if a free

table is available. This is known as Walk-in. The new system should display the same information as the

existing booking sheet and in same format, to make it easy for restaurant staff to transfer, to the new

system. When new bookings are recorded or changes made to existing bookings, the display should be

immediately updated, so that restaurant staff is working with the latest information available.

The restaurant makes bookings, cancel bookings, record arrivals and table transfers of the customers.

Academic Dairy Handbook III CSE II SEM 7

Page 8: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

• The receptionist is the employee of the restaurant who interacts with the customer whose work is

supported by the system

The customer rings up to make a booking there is a suitable table free at the required day and time and

the required day and time and the receptionist enters customer’s name, phone no. and records booking.

• When the customer arrives, his arrival is updated in the system and waiter attends to them.

• The customer can also cancel booking what he made or transfer the booking to another day or time.

• The receptionist can easily record , update and cancel the information about the bookings and customers

• The customers eat in restaurants even with out any reservations or bookings called Walk-in.

Subjective Important Questions With Answers:

1. Explain the Algorithmic perspective of modeling.

OBJECT ORIENTED MODELING: In software these are several ways to approach a model. The two most

common views are

1. Algorithmic perspective:

The traditional view of software developments takes an algorithmic prospective. In each approach, the main

building block of software is the procedure or function. This view leads developers to focus on issues of

control and the decomposition of larger algorithmic in smaller ones. There is nothing inherently evil about

such a point of view expects that tends to yield brittle systems. As requirements change and the system

grows, it is very hard to maintain the systems built with Algorithmic focus.

2.Explain the Objective oriented perspective

Object oriented perspective:

In this approach the main building block of all software systems is the Object or Class. An Object is a thing

generally drawn from the vocabulary of the problem or the possible solution. A Class is a description of a

set of common objects. Every object has identity, state, and behavior.Object oriented approach to software

development has proven to be of value in building systems. Object oriented development provides the

Academic Dairy Handbook III CSE II SEM 8

Page 9: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

conceptual foundation for assembling systems out of components using technologies like Java Beans or

COM+.

3.What are the various building blocks of UML?

BUILDING BLOCKS OF THE UML

The vocabulary the UML encompasses three kinds of building blocks:

1. Things

2. Relationships

3. Diagrams

Things:

Things are the abstractions that are first class citizens in a model; relationships tie these things together;

diagrams group interesting collection of things.

Things in UML :

There are four kinds of things in the UML

(i). Structural things

(ii).Behavioral things

(iii). Grouping things

(iv). Annotation things

These things are the basic object oriented buildings blocks of UML. You use them to write well-formed

models.

(i). Structural things

Structural things are nouns of UML models. These are the mostly static parts of the model, representing

elements that are either conceptual or physical. In all these are seven kinds of structural things. '

1. Class:First, a class is a description set of objects that share the same attributes, operations, relationships,

Academic Dairy Handbook III CSE II SEM 9

Page 10: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

and semantics. A class implements one or more interfaces. Graphically a class is rendered as a rectangle,

usually including its name, attribute, and operations.

2. Interface:

Second, an interface is a collection of operations that specify a service of a class or component. An interface

therefore describes the externally visible behavior of that element. The interface

might represent the complete behavior of class or component or a part of that behavior. An interface

defines a set of operation specifications

(That is, there signatures) but never a set of operation implementations. Graphically, an interface is

rendered as a circle together with its name. An interface rarely stands alone. Rather, it is typically

attached to the class or component that realizes the inter face.

3. Collaboration:

Third, a collaboration defines interaction and is a society roles and other elements that work together to

provide some cooperative behavior that's bigger than the some all the elements. Therefore, collaborations

have structural as well as behavioral, dimensions. A given class might participate in several collaborations.

These collaborations therefore represent the implementation of patterns that make up a system. Graphically

the collaboration is rendered as an ellipse with dotted lines, usually including only its name.

4. Use Case:

Fourth, a use case is a description of sequence of actions that a system performs that yields an observable

result of value to a particular actor. A use case is issued to structure the behavioral things in a model. A

use case is realized by collaboration. Graphically, a use case rendered as an ellipse with solid lines,

usually including only its name.

5. Active Class:

Fifth, an active class is a class whose objects own one or more processes or threads and therefore can

initiate control activity.

Academic Dairy Handbook III CSE II SEM 10

Page 11: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

An active class is just like a class except that its objects represent elements whose behavior is concurrent

with other elements. Graphically an active class is drawn just like a class, but with heavy lines, including

its name, attributes, and operations.

6. Component:

Sixth, a component is a physical and replaceable part of a system that provides the realization of a set of

interfaces. A component represents the physical packaging of the logical elements like class, interfaces,

and collaborations. Graphically a component is rendered as rectangle with tabs, including only its name.

7. Node:

Seventh, a node is a physical element that exists at run time and represents a computational resource.

Generally it may have some memory and processing capability. A set of components may reside on node

and may migrate from one node to another node. Graphically a node is rendered as cube, including only its

name.

(ii). Behavioral Things:

These are the dynamic parts of UML models. These are the verbs of a model representing behavior over

time and space.

There two kinds of behavioral things.

1. Interaction

2. State machine

1. Interaction:

An interaction is a behavior that comprises a set of messages exchanged among objects within a

particular context to accomplish a purpose. The behavior of a set of objects can may be specified with an

interaction. An interaction involves elements like messages, action sequences (the behavior invoked by a

message), and links (the connection between objects).Graphically a message is rendered as a directed line,

including the name of its operation.

Academic Dairy Handbook III CSE II SEM 11

Page 12: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

2. State machine:

A state machine is behavior that specifies the sequences of states an object or an interaction goes through

during its lifetime. The behavior of an individual class or a collaboration of classes may be specified with a

state machine. A state machine involves elements

Like states, transitions (the flow from state to state), events (things that trigger a transition), and activities

(the response to a transition).

Graphically a state is rendered as a rounded rectangle, including its name and sub states.

(iii).Grouping Things:

Grouping things are the organizational parts of UML models.

These are the boxes into which a model can be decomposed. The primary kind of grouping thing is

Packages.

1. Package:

A package is a general purpose mechanism for organizing elements into groups. Structural things,

behavioral things and other grouping things may be placed in package. A package is purely conceptual i.e. it

exists at development time. A package is rendered as a tabbed folder, including only its name and

sometimes its contents.

There are several kinds of packages like frameworks, models, and subsystems.

(iv). Annotational Things:

Annotational things are the explanatory parts of UML models. These are the comments that are applied to

describe any element in model. The primary kind of annotational thing is note.

1. Note:

Academic Dairy Handbook III CSE II SEM 12

Page 13: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

A note is simply a symbol for rendering constraints and comments attached to an element or a collection of

elements. Graphically a note is rendered as a rectangle with a dog eared corner, together with a textual or

graphical comment.

Objective Questions:

1. UML is a

a) Procedure oriented language b) Object Oriented Language

c) Graphical Language d) Object Based Language

2. What are the nouns of UML?

a) Structural things b) Behavioural Things

c) Grouping Things d) An notational Things

3. What are the dynamic parts of UML?

a) Structural things b) Behavioural Things

c) Grouping Things d) an notational Things

4. What are the organizational parts of UML?

a) Structural things b) Behavioural Things

c) Grouping Things d) an notational Things

5. What are the explanatory parts of UML?

a) Structural things b) Behavioural Things

c) Grouping Things d) An notational Things

6. Use case is represented as

Academic Dairy Handbook III CSE II SEM 13

Page 14: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

a) Cube b) Circle c) Ellipse d) Rectangle with tabs

7. Node is represented as

a) Cube b) Circle c) Ellipse d) Rectangle with tabs

8. Which of the following thing is grouping thing?

a) use case b) Node c) Note d) Package

9. Which of the following thing is behavioural thing?

a) Class b) Collaboration c) Node d) Interaction

10. Which of the following are the verbs of UML MODEL?

a) Structural things b) Behavioural Things

c) Grouping Things d) an notational Things

11. Which of the following are the static parts of UML model?

a) Structural things b) Behavioral Things

c) Grouping Things d) an notational Things

12. ----------is a society of roles and other elements that work together to provide some cooperative

behaviour that’s bigger than the sum of all the elements.

a) Class b) Collaboration c) Node d) Interaction

13. Which diagram shows the static implementation view of a system?

a) Class b) object c) use case d) component

14. Which diagram shows the static deployment view of a system?

a) Class b) deployment c) use case d) component

15. Which diagram represents static snapshots of instances of the things found in class

Academic Dairy Handbook III CSE II SEM 14

Page 15: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

Diagrams.

a) Class b) object c) use case d) component

16. Which relationship is used between parent and child classes.

a) Dependency b) Generalization c) Association d) Realization

17. Which relationship is used between class and interface

a) Dependency b) Generalization c) Association d) Realization

18. --------is a relationship between two things in which a change to one thing may affect the semantics

of the other thing.

a) Dependency b) Generalization c) Association d) Realization

19. Aggregation is a special kind of ----

a) Dependency b) Generalization c) Associationd) Realization

20. -------is a relationship that describes a set of links among objects.

a) Dependency b) Generalization c) Associationd) Realization

UNIT-II

Syllabus:

Basic Structural Modeling: Classes, Relationships, common Mechanisms, and diagrams.

Advanced Structural Modeling: Advanced classes, advanced relationships, Interfaces, Types and Roles,

Packages

Objective:

To apply knowledge of Structural Modeling for a given application.

Academic Dairy Handbook III CSE II SEM 15

Page 16: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

To identify the various classes, relationships & Interfaces.

Lecture plan:

S.No Topic No. of lectures

1 Classes 1

2 Relationships 2

3 Common Mechanisms 2

4 Diagrams 1

5 Advanced Classes 2

6 Advanced Relationships 4

7 Interfaces 2

8 Types and Roles 1

9 Packages 2

10 Classes 1

11 Relationships 2

12 Advanced classes and Advanced Relations 1

13 Interfaces 2

14 Packages 2

15 Diagrams 2

Total classes to complete UNIT-II 17

Assignment:

Academic Dairy Handbook III CSE II SEM 16

Page 17: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

1. a) Explain about attributes ,operations and responsibilities of Class

b) Enumerate steps to model the vocabulary of a system?

2. a) Enumerate steps to model the distribution of responsibilities in a system

b) Enumerate steps to model the non software things?

3. a) Enumerate steps to model the primitive types?

b) Explain about dependency and generalization relationships with examples?

4. a) Enumerate steps to model simple dependencies?

b) Enumerate steps to model single inheritance?

5. Enumerate steps to model structural relationships with examples?

Case Study:

For the above description of case studies identify the various classes and design the class diagram

1. Trusty car company group

2. ATM System

3. Bank

4. Restaurant system

Subjective Important Questions with answers:

1. Write short notes on Dependency & Generalization

RELATIONSHIP

A relationship is a connection among things.

Graphically, a relationship is rendered as a path, with different kinds of lines used to distinguish the kinds of

relationships.

In object-oriented modeling, there are three kinds of relationships that are especially important:

Academic Dairy Handbook III CSE II SEM 17

Page 18: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

1. dependencies, which represent using relationships among classes (including refinement, ace, and bind

relationships);

A dependency is a using relationship that states that a change in specification of one thing (for example, class Event)

may affect another thing that uses it (for example, class Window), but not necessarily the reverse.Graphically, a

dependency is rendered as a dashed directed line, directed to the thing being depended on. Use dependencies when you

want to show one thing using another We will use dependencies in the context of classes to show that one class uses

another class as an argument in the signature of an operation;In the UML we can also create dependencies among many

other things, especially notes and packages.

2. generalizations: which link generalized classes to their Specialized A generalization is a relationship between a

general thing (called the superclass or parent)and a more specific kind of that thing (called the subclass or

child).Generalization is sometimes called an "is-a-kind-of' relationship: one thing (like theclass BayWindow) is-a-kind-

of a more general thing (for example, the class Window).Generalization means that objects of the child may be used

anywhere the parent mayappear, but not the reverse.generalization means that the child is substitutable for the parent.A

child inherits the properties of its parents, especially their attributes and operations.An operation of a child that has the

same signature as an operation in a parent overrides the operation of the parent; this is known as

polymorphism.Graphically, generalization is rendered as a solid directed line with a large open arrowhead, pointing to

the parent.Use generalizations when you want to show parent/child relationships

2. Explain how to model the vocabulary of a system.

To model the vocabulary of a system

Identify those things that users or implementers use to describe the problem or solution. Use CRC

cards and use case analysis to help fmd these abstractions.

For each abstraction, identify a set of responsibilities. Make sure that each class is crisply defined

Academic Dairy Handbook III CSE II SEM 18

Page 19: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

and that there is a good balance of responsibilities among all your classes.

Provide the attributes and operation that are need to carry out these responsibilities for each class

3.Explain how to model distribution of responsibilities of a system

To model the distribution of responsibilities in a system

Identify a set of classes that work together closely to carry out some behavior.

Identify a set of responsibilities foe each of these classes.

Look at this set of classes as a whole, split classes that have too many responsibilities into smaller

abstractions, collapse tiny classes that have trivial responsibilities into larger ones, and reallocate

responsibilities so that each abstraction reasonably stands on its own.

Consider the ways in which those classes collaborate with one another, and redistribute their

responsibilities accordingly so that no class within a collaboration does too much to too little

4. Write short notes on Responsibilities:

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

When we create a class, we are making a statement that all objects of that class have the same kind of state

and the same kind of behavior.

The attributes and operations are just the features by which the class's responsibilities are carried out.

When we model classes, a good starting point is to specify the responsibilities of the things in the vocabulary.

Techniques like CRC cards and use case-based analysis are especially helpful here.

A class may have any number of responsibility and at most just a handful.

Graphically, responsibilities can be drawn in a separate compartment at the bottom of the class icon.

5.Write short notes on stereotype, tagged values & constraint

A stereotype is an extension of the vocabulary of the UML, allowing you to create new kinds of building blocks

similar to existing ones but specific to your problem. Graphically, a stereotype is rendered as a name enclosed by

guillemets and placed above the name of another element. As an option, the stereotyped element may be rendered by

using a new icon associated with that stereotype.

Academic Dairy Handbook III CSE II SEM 19

Page 20: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

A tagged value is an extension of the properties of a UML element, allowing you to create new information in that

element's specification. Graphically, a tagged value is rendered as a string enclosed by brackets and placed below the

name of another element.

A constraint is an extension of the semantics of a UML element, allowing you to add new rules or to modify existing

ones. Graphically, a constraint is rendered as a string enclosed by brackets and placed near the associated element or

connected to that element or elements by dependency relationships. As an alternative, you can render a constraint in a

note.

6.Explain How to model a comment

To model a comment

Put your comment as text in a note and place it adjacent to the element to which it refers. You can show a

more explicit relationship by connecting a note to its elements using a dependency relationship.

You can hide or make visible the elements of your model as you see fit. This means that you don't have to

make your comments visible everywhere the elements to which it is attached are visible. Rather, expose your

comments in your diagrams only insofar as you need to communicate that information in that context.

If your comment is lengthy or involves something richer than plain text, consider putting your comment in an

external document and linking or embedding that document in a note attached to your model.

As your model evolves, keep those comments that record significant decisions that cannot be inferred from

the model itself, and discard the others.

7. Explain How To model new building blocks

To model new building blocks

Make sure there's not a way to express what you want by using basic U .

Academic Dairy Handbook III CSE II SEM 20

Page 21: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

If there's no other way to express the semantics, identify the primitive thing in the UML that's most like

what you want to mode, and define a new stereotype for that thing. We can define hierarchies of stereotypes

so that you can have general kinds of stereotypes along with their specializations.

Specify the common properties and semantics that go beyond the basic element being

stereotyped by defining a set of tagged values and constraints for the stereotype.

If you want these stereotype elements to have a distinctive visual cue, define a new icon for the stereotype

Objective Questions:

1. ----------is a contract or an obligation of a class.

a) Responsibility b) Operations c) Attributes d) Names

2. ----------is a connection among things.

a) Diagram b) Relationship c) thing d)None

3. Which relationship is used between the super class and sub class

a) Dependency b) Generalization c) Association d) Realization

4. ------ is a relationship that specifies that objects of one thing are connected to objects of another.

a) Dependency b) Generalization c) Association d) Realization

5. -----------extends the vocabulary of the UML

a) Tagged value b) Constraints c) Stereotypes d) adornments

6. ----------- extends the propertied of the UML

a) Tagged value b) Constraints c) Stereotypes d) adornments

7. ------------extends the semantics of a UML

a) Tagged value b) Constraints c) Stereotypes d) adornments

8. --------- creates new kinds of building blocks that are derived from existing ones but that are specific to

our problem.

Academic Dairy Handbook III CSE II SEM 21

Page 22: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

a) Tagged value b) Constraints c) Stereotypes d) adornments

9. ---------- creates new information in that elements specification.

a) Tagged value b) Constraints c) Stereotypes d) adornments

10.-------- is used to add new rules or modify existing ones

a) Tagged value b) Constraints c) Stereotypes d) adornments

11. -------- view of a system encompasses the classes, interfaces, and collaborations that form the

vocabulary of the problem and its solution.

a) Use case b) Design c) Process d) Implementation

12. ---------view of a system encompasses the threads and processes that form the system’s concurrency and

synchronization mechanisms.

a) Use case b) Design c) Process d) Implementation

13.--------- is a stereotype that apply to dependency relationships among packages

a) access b)extend c)include d)become

14.---------is a stereotype that apply to dependency relationship among classes and objects in class diagram.

a)bind b)extend c)include d)become

15.------- is a stereotype that apply to dependency relationship among usecases.

a)bind b)extend c)become d)call

16.------- is a stereotype that is used among objects.

a)bind b)extend c)include d)become

17. Which of the following is structural diagram

a)Class diagram b) use cse diagram c) Sequence diagram d) Statechart

Academic Dairy Handbook III CSE II SEM 22

Page 23: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

18.Which of the following is behavioural diagram.

a)Object b)usecase c)class d)component

19.Which of the following is interaction diagram

a)Object b)usecase c)class d)sequence

20.------- is a collection of operations that are used to specify a service of a class or component.

a) class b)interface c)node d)collaboration

UNIT-III

Syllabus:

Class & Object Diagrams: Terms, concepts, modeling techniques for Class & Object Diagrams.

Objective:

To apply knowledge of common modeling techniques in designing a system.

To design class and object diagram by analyzing and interpreting the given data.

Lecture plan:

S.No Topic No. of lectures

1 Terms 1

2 Concepts 1

3 Modeling Techniques for Class Diagrams 4

4 Modeling Techniques for object Diagrams 1

5 Case Study on Class and Object Diagrams 2

7 Total classes to complete UNIT-III 9

Academic Dairy Handbook III CSE II SEM 23

Page 24: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

Assisgnment:

1. a) Write common properties, contents and common uses of class diagram?

b) Enumerate steps to model Simple collaborations?

2. Enumerate steps to model a logical database schema and explain with example?

Case studies :

Design the object diagram for the above description of case studies

1. Trusty car company group

2. ATM System

3. Bank

4. Restaurant system

Subjective Important Questions with answers:

1.Write short notes on class diagrams

CLASS DIAGRAMS

Class diagrams are the most common diagram found in modeling object oriented systems. A class diagram

shows a set of classes, interfaces, and collaborations and their relationships. You use class diagrams to model

the static design view of a system. For the most part, this involves modeling the vocabulary of the system,

modeling collaborations, or modeling schemes. Class diagrams are also the foundation for a couple of related

diagrams: Component diagrams and deployment diagrams.

Class diagrams are important not only for visualizing, specifying, and documenting structural models,

but also for constructing executable systems through forward and reverse engineering.

Contents:

Class diagrams commonly contain the following things:

Academic Dairy Handbook III CSE II SEM 24

Page 25: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

Classes

Interfaces

Collaborations

Dependency, generalization, and association relationships Like all other diagrams,

class diagrams my contain notes and constraints.

Class diagrams may also contain packages or subsystems, both of which are used to group elements of

your model into larger chunks. Sometimes, you'll want to place instances in your class diagrams, as well,

especially, when you want to visualize the type of instance.

2. What are the three different ways through which you use class diagrams

Common Uses:

You use class diagrams to model the static design view of a system. This view primarily supports the

functional requirement of a system the service the system should provide to its end users.

When you model the static design view of a system, you'll typically use class diagrams in one of three

ways.

1) To model the vocabulary of a system

Modeling the vocabulary of a system involves making a decision about which abstraction are a part of the system

under consideration and which fall outside its boundaries. You use class diagrams to specify these abstractions

and their responsibilities.

2) To model simple collaborations

A collaboration in a society of classes, interfaces, and other elements that work together to provide some cooperative

behavior that's bigger that the sum of the elements.

3) To model a logical database schema

Think of a schema as the blue print for the conceptual design of a date base. In the many domains, you'll want to

store persistent information in a relational data base or in an object-oriented database. You can model schemas for

these database using class diagrams.

Academic Dairy Handbook III CSE II SEM 25

Page 26: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

When we create a class diagram, you just model a part of the things and relationships that make up your system's

design view. For this reason, each class diagram should focus on one collaboration at time.

3. Write short notes on forward and reverse engineering

Forward engineering is the process of transforming a model into code through a mapping to an implementation

language. Forward engineering results in a loss of information, because models written in the UML are semantically

richer that any current object-oriented programming language. In fact, this is a or reason why you need models in

addition to code. Structural features, such as collaborations, and behavioral features, such as interactions, can be

visualized clearly in the UML, but not so clearly from raw code.

To forward engineer a class diagram.

Identify the rules for mapping to your implementation language or languages of choice. This is something

you'll want to do for your project or your organization as a whole.

Depending on the semantics of the languages you choose, you may have to constrain you use of certain UML

features.

Use tagged values to specify your target language. You can do this at the level of individual classes if you

need precise control. You can also do so at a higher level, such as with collaborations or packages.

Use tools to forward engineer your models.

Reverse engineering is the process of transforming code into a model through a mapping from a specific

implementation language. Reverse engineering results in a flood of

information, some of which is at a lower level of detail than you'll need to build useful models. At the same time,

reverse engineering is incomplete. There is a loss of information when forwarded engineering models into codes, and

so you can't completely recreate from code unless your tools encode information in the source commits that goes

beyond the semantics of the implementation language.

To reverse engineer a class diagram.

Identify the rules for mapping from your implementation language or languages of choice. This is something

you'll want to do for your project or your organization as a whole.

Using a tool, point to the model you'd like to reverse engineer. Use your tool to generate a new model or

modify an existing one that was previously forward engineered.

Using a tool, create a class diagram by querying the model. For example, you might start with one or more

Academic Dairy Handbook III CSE II SEM 26

Page 27: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

classes, then expand the diagram by following specific relationships or other neighboring classes. Exposes or

hide details of the contents of this class diagrams as necessary to communicate your intent.

Objective Questions:

1.Which diagram shows a set of classes,interfaces and collaborations and their relationships

a)Object b)usecase c)class d)component

2.Class diagram commonly contains

a)classes b)interfaces c)collaborations d)all

3.--------diagram shows the static design view of a system

a)Object b)usecase c)class d)component

4.Common uses of class diagram are

a)to model the vocabulary of a system b)to model simple collaborations

c)To model a logical database schema c)all

5.------is a diagram which shows set of objects,their state and relationships.

a)Object b)usecase c)class d)component

6.Which diagram shows static design view of a system.

a)Object b)usecase c)class d)component

7.------involves modelling a snapshot of the system at a moment in time

a)Object b)usecase c)class d)component

8.Object diagram commonly contain

a) Objects b)links c) class d) a&b

9.Common uses of object diagram is

Academic Dairy Handbook III CSE II SEM 27

Page 28: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

a)to model object structure b)to model simple collaborations

c)To model a logical database schema d)none

10.which diagram shows the static process view of a system

a)Object b)usecase c)class d)component

11.-----is an instance of a class diagram

a) object diagram b) component diagram c) deployment d)none

UNIT-IV

Syllabus:

Basic Behavioral Modeling-I: Interactions, Interaction diagrams.

Objective:

To identify the flow of control of messages and interaction among the objects

To model the flow of control by using sequence and collaboration diagram in a given system.

Lecture plan:

S.No Topic No. of lectures

1 Interactions 2

2 Interaction Diagrams 3

3 Interaction and Interactions Diagrams 1

Total classes to complete UNIT-IV 5

Assisgnment:

1. Write short notes on

a) Objects and roles

b) Links

Academic Dairy Handbook III CSE II SEM 28

Page 29: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

2. a) Enumerate steps to model a flow of control?

b) Write contents , common properties, common uses of interaction diagram?

3. Differentiate between Sequence diagram and Collaboration diagram?

Case Study:

Design the following Sequence & collaboration diagram for the above description of case studies

1. Trusty car company group

2. ATM System

3. Bank

4. Restaurant system

Subjective Important Questions With answers:

1.What are interaction diagram and explain the common properties involved in designing it

TERMS AND CONCEPTS:

An interaction diagram shows an interaction, consisting of a set of objects and their relationships, including the

messages that may be dispatched among them. A sequence diagram is an interaction diagram that emphasizes the time ordering

of messages. Graphically, a sequence diagram is a table that shows objects arranged along the X axis and the messages, ordered

increasing time, along the Y axis .A collaboration diagram is an interaction is an interaction diagram that emphasizes the

structural organization of the objects that send and receive messages. Graphically, a collaboration diagram is a collection of

vertices and arcs.

Common Properties:

An interaction diagram is the just a special kind of diagram and shares the same common properties as do all other

diagrams-a name and graphical contents that are a projection into a model. What distinguishes an interaction diagram from all

other kind of diagrams is its particular content.

Academic Dairy Handbook III CSE II SEM 29

Page 30: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

2.What are the various thing to remember while designing interaction diagrams and explain

about asynchronous messages

Things to Note:

The flow of time is shown from top to bottom, that is messages higher on the diagram happen before

those lower down

The blue boxes are instances of the represented classes, and the vertical bars below are timelines

The arrows (links) are messages - operation calls and returns from operations

The hide and show messages use guards to determine which to call.  Guards are always shown in

square braces [ ] and represent constraints on the message (the message is sent only if the constraint

is satisfied)

The messages are labelled with the operation being called and parameters are shown.  You can

choose to enter the parameters or not - this is dependent upon their importance to the collaboration

being shown

Academic Dairy Handbook III CSE II SEM 30

Page 31: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

The sequence numbers are not shown on the messages as the sequence is intrinsic to the diagram

Asynchronous Messages

You can specify a message as asynchronous if processing can continue while the message is being

executed.  In the example below, the asynchronous call does not block processing for the regular call right

below.  This is useful if the operation being called is run remotely, or in another thread.

3.Write short notes on Collaboration Diagrams

Collaborations are more complex to follow than sequence diagrams, but they do provide the added benefit

of more flexibility in terms of spatial layout.

Academic Dairy Handbook III CSE II SEM 31

Page 32: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

Putting it all Together

Using interaction diagrams, we can clarify the sequence of operation calls among objects used to complete a

single use case.  When drawing these diagrams, try to keep them as clear and simple as possible.   Sequence

diagrams are easy to read and follow, as they enforce a standard layout on the diagram.  Collaborations have

the added advantage of interfaces and freedom of layout, but can be difficult to follow, understand and

create.

It's also important not to confuse interaction diagrams with state and activity diagrams.  Interaction

diagrams are used to diagram a single use case.  When you want to examine the behaviour of a single

instance over time use a state diagram, and if you want to look at the behaviour of the system over time use

an activity diagram.

Objective Questions:

1.Which of the following is an event

a)signal b)calls c)the passing of time d)a change in time

2.------------represents a named object that is dispatched asynchronously by one object and then received by

another.

a)signal b)calls c)the passing of time d)a change in time

3.---------represents the dispatch of an operation

a)signal b)calls c)the passing of time d)a change in time

4.---------is a event that represents the passage of time

a)signal b)calls c)time event d)a change in time

5.-------is an event that represents a change in state.

a)signal b)calls c)the passing of time d)a change in time

Academic Dairy Handbook III CSE II SEM 32

Page 33: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

6.which of the following is external event

a)the pushing of a button b)an interrupt from a collision

c)a&b d)none

7.which of the following internal event

a)the pushing of a button b)an interrupt from a collision

c)a&b d)overflow exception

8.------is a condition or situation during the life of an object during which it satisfies some

condition,performs some activity

a)state b)event c)node d)note

9.---------is a relationship between two states indicating that an object in the first state will perform certain

actions and enter the second state when a specified event occurs and specified conditions are satisfied.

a)state b)transition c)branching d)node

10.-------is an object that owns a process or thread and can initiate control activity.

a)active object b)event c)branching d)node

11.---------is a lightweight flow that can execute concurrently with other threads within the same process.

a)Thread b)active object c)branching d)node

12.-----------is a class whose instances are active objects.

a)Thread b)active object c)branching d)active class

13.--------is a stereotype which apply to active classes

a)process b)become c)extend d)include

14.-------is a denotation for the time at which an event occurs.

Academic Dairy Handbook III CSE II SEM 33

Page 34: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

a)timing mark b)location c)process d)Thread

15.---------- diagram shows a state machine, emphasizing the flow of control from state to state

a)class b)object c)component d)state chart

16.---------is a behaviors that specifies the sequences of states an object goes through during its lifetime in

response to events.

a)state machine b)use case c)active class d)node

17.statechart diagram commonly contain

a)simple states b)composite state c)transition d)all

18.common use of state chart diagram

a)to model reactive objects b)to model work flow

c)to model operation d)none

19.which of the following is behavioural diagram

a)class b)object c)component d)state chart

20.which of the following is used to model the dynamic aspects of a system

a)class b)object c)component d)state chart

UNIT-V

Syllabus:

Basic Behavioral Modeling-II: Use cases, Use case Diagrams, Activity Diagrams.

Objective:

Ability to identify the various steps involved in forward & Reverse Engineering.

Ability to identify the flow of events in different applications

Academic Dairy Handbook III CSE II SEM 34

Page 35: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

Ability to identify various activities, action states, messages & transitions.

Lecture plan:

S.No Topic No. of lectures

1

Use Cases 2

2 Use Cases Diagrams 3

3 Acitivty Diagrams 2

Total classes to complete UNIT-V 7

Assignment:

1. Write short notes on

a) Use cases and Actors

b) Use cases and Flow of events

c) Use cases and Scenarios.

d) Use cases and Collaborations

2. a) Enumerate steps to model the behaviour of an element?

b) How to organize use cases? Explain.

3. a) Write Contents, common uses,Common properties of use case diagram

b) Enumerate steps to model the context of a system.

4. Enumerate steps to model the requirements of a system.

Case study:

Design the usecase diagram and activity diagram for the above description of case studies

Trusty car company group

Academic Dairy Handbook III CSE II SEM 35

Page 36: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

2. ATM System

3. Bank

4. Restaurant system

Subjective Important Questions with answers:

1. Explain how to organize use cases and generalization can be viewed in usecases

ORGANIZING USE CASES

You can organize use cases by grouping them in packages in the same manner in which you can

organize classes.

You can also organize use cases by specifying generalization, include, and extend relationships

among them.

Generalization

Generalization among use cases is just like generalization among classes. Here it means that the child

use case inherits the behavior and meaning of the parent use case; the child may add to or override the

behavior of its parent; and the child may be substituted any place the parent appears (both the parent

and the child may have concrete instances)

2.Write short notes on Include relationship

Include relationship

An include relationship between use cases means that the base use case explicitly incorporates the

behavior of another use case at a location specified in the base. The included use case never stands

alone, but is only instantiated as part of some larger base that includes it.

You use an include relationship to avoid describing the same flow of events several times, by

putting the common behavior in a use case of its own (the use case that is included by a base use

case).

You render an include relationship as a dependency, stereotyped as include.

To specify the location in a flow of events in which the base use case includes the behavior of

another, you simply write include followed by the name of the use case you want to include

3.What are the uses of Extend relationship?

Academic Dairy Handbook III CSE II SEM 36

Page 37: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

An extend relationship between use cases means that the base use case implicitly incorporates the behavior of

another use case at a location specified indirectly by the extending use case.

The base use case may stand alone, but under certain conditions, its behavior may be extended by the behavior

of another use case.

This base use case may be extended only at certain points called, its extension points.

You render an extend relationship as a dependency, stereotyped as extend.

You may list the extension points of the base use case in an extra compartment.

These extension points are just labels that may appear in the flow of the base use case. Uses of extend

relationship

You use an extend relationship to model the part of a use case which is optional system behavior.

In this way, you separate optional behavior from mandatory behavior.

You may also use an extend relationship to model a separate subflow that is executed only under given

conditions.

You may use an extend relationship to model several flows that may be inserted at a certain point, governed

by explicit interaction with an actor.

Other Features

Use cases are classifiers, so they may have attributes and operations that you may render just as for classes.

One can think of these attributes as the objects inside the use case that you need to describe its outside

behavior.

Similarly, consider the operations as the actions of the system you need to describe a flow of events.

These objects and operations may be used in interaction diagrams to specify the behavior of the use case.

As classifiers, we can also attach state machines to use cases.

You can use state machines as yet another way to describe the behavior represented by a use case.

Objective Questions:

1. .------specifies the behaviour of a system or a part of a system

a)usecase b)object c)class d)component

2. .-------describes a set of sequence, in which each sequence represents the interaction of the

things outside the system

Academic Dairy Handbook III CSE II SEM 37

Page 38: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

a)usecase b)object c)class d)component

3. .---------represents set of roles of users

a)an actor b)object c)class d)component

4. .A use case describes

a)what a system does b)how a system does c) a&b d)none

5. .Actors may be connected to use cases only by …………,…….relationship

a)association b)dependency c)realization d)b&c

6. .-----------is a specifice sequence of actions is usecase diagram

a)usecse b)scenario c)actor d)a&c

7. -----------------is used to model the use case view of a system

a)use case b)object c)component d)deployment

8. Which of the following is behavioural diagram

a)usecase b)class c)object d) component

9. .------------is a diagram that shows a set of use cases and actors and their relationships

a)usecase b)class c)object d) component

10. . Use case diagram commonly contain

a)use cases b)actors c)relationships d)all

11. Common use of use case diagram

a) to model the context of a system b)to model the requirements of a system

c) A&b d) none

12. which stereotype is used in use case diagram

Academic Dairy Handbook III CSE II SEM 38

Page 39: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

a)extend b)include c)a&b d)none

13. .----------diagram shows flow of control from activity to activity

a) Activity b)object c)class d)component

14. Activity diagram commonly contains

a) Activity states b)action states c)transition d)all

15. ------represents the synchronization of two or more concurrent flows of control.

a)join b)fork c)branching d)Transition

16. ---------specifies a locus of activities in activity diagram

a)join b)fork c)branching d)swimlanes

17. Common uses of activity diagram

a) to model a workflow b)to model an operation c) a&b d) none

18. -------represents the splitting of a single flow of control into two or more concurrent flows of

control.

a)join b)fork c)branching d)swimlanes

19. .Which state can be further decomposed.

a)activity b)action c)a&b d)none

20. .-------is an ongoing nonatomic execution within a state machine

a)activity b)action c)a&b d)none

UNIT-IV

Syllabus:

Academic Dairy Handbook III CSE II SEM 39

Page 40: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

Advanced Behavioral Modeling: Events and signals, state machines, processes and Threads, time and

space, state chart diagrams.

Objective:

Ability to identify the various steps involved in identifying the various states in various applications

Ability to apply forward and reverse engineering to state chart diagrams.

Lecture plan:

S.No Topic No. of lectures

1 Events and Signals 3

2 State Machines 4

3 Processes and Threads 2

4 Time and Space 2

5 State Chart Diagrams 2

7 Processes and Threads 2

8 State chart Diagrams 1

Total classes to complete UNIT-VI 13

Assignment:

1. Explain the following events

a. Signals

b. Call Events

c. The passing of time

d. A change in state.

2. Enumerate steps to model a family of signals and explain?

Academic Dairy Handbook III CSE II SEM 40

Page 41: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

3. Enumerate steps to model exceptions and explain?

4. Explain the following terms in UML

a. States

b. Transition

c. Sub states.

5. a) Enumerate steps to model the lifetime of an object.

b) Enumerate steps to model multiple flows of control.

Case study:

Design the state chart diagram for the above description of case studies

Trusty car company group

2. ATM System

3. Bank

4. Restaurant system

Subjective Important Questions with answers:

1.Write short notes on event and signal

An event is the specification of a significant occurrence that has a location in time and space. In the context of

state machines, an event is an occurrence of a stimulus that can trigger a state transition. A signal is a kind of event

that represents the specification of an asynchronous stimulus communicated between instances.

Kinds of Events:

Events may be external or internal. External events are those that pass between the system and its actors. For

example, the pushing of a button and an interrupt from a collision sensor are both examples of external events. Internal

events are those that pass among the objects that live inside the system, An overflow exception is an internal event.

In the UML, you can model four kinds of events, signals, calls, the passing of time, and a change in state.

Academic Dairy Handbook III CSE II SEM 41

Page 42: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

Signals:

A signal represents a named object that is dispatched asynchronously by one object and the received by

another. Exceptions are supported by the most contemporary programming languages and are the most common

kind of internal signal that you will need to model.

Signals have a lot in common with plain classes. For example, signals many have instances, although you

don't generally need to model them explicitly. Signals may also be involved in generalization relationships,

permitting you to model hierarchies of events, some of each are general. Also as for classes, signals may have

attributes and operations.

A signal may be sent as the action of a state transition in a machine or the sending of a message in an

interaction. The execution of an operation can also send signals. In fact, when you model a class or an interface and

important part of specifying the behavior of that element is specifying the signal that its operations can send. In the

UML, you model the relationship between an operation and the events that it can send by using a dependency

relationship, stereotyped as send.

In the UML, as shown in the below figure you model signals stereotyped classes. You can use a dependency,

stereotyped as send, to indicate that an operation sends a particular signal.

2. Explain how to model exceptions and signals

To model a family of signals:

Consider all the different kinds of signals to which a given set of active objects may respond.

Look for the common kind of signals and place them in a generalization/ specialization hierarchy

using inheritance. Elevate more general ones and lower more specialized.

Look for the opportunity for polymorphism in the state machines of these active objects. Where

you fmd polymorphism, adjust the hierarchy as necessary by introducing intermediate abstract

signals.

To model exceptions:

For each class and interface, and for each operation of such elements. Consider the

exceptional conditions that may raise.

Arrange these exceptions in a hierarchy. Elevate general ones, lower

specialized ones, and introduce intermediate exceptions, as necessary.

Academic Dairy Handbook III CSE II SEM 42

Page 43: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

For each operation, specify the exceptions that it may raise. You can do so

explicitly or you can put this in the operation's specification

3 What are the various parts of a transitions

TRANSITIONS:

A transition is a relationship between two states indicating that on an object in the first state will perform

certain actions and enter the second state when a specified event occurs and specified conditions are satisfied. On

such a change of state, the transition is said to fire. Until the transition fires, the object is said to be in the source

state; after it fires, it is said to be the

target state.

A transition has five parts.

1) Source state The state effect by the transition; if an object is in the source state, an outgoing

transition may fire when the object receives the trigger event of the transition

and if the guard condition, if any, is satisfied.

2) Event Trigger The event whose reception by the object in the source state makes the

transition eligible to fire, providing its guard condition is satisfied.

3) Guard condition A Boolean expression that is evaluated when the transition is triggered by the

reception of the trigger; if the expression evaluates False, the transition does

not fire and if there is no other transition that could be triggered by that same

event, the event is lost.

4) Action An executable atomic computation that may directly act on the object that

owns the state machines, and indirectly on other objects that are visible to the

object.

5) Target state The state that is active after the completion of the transition. A transition is

Academic Dairy Handbook III CSE II SEM 43

Page 44: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

rendered as a solid directed line from the source to the target state.

Objective Questions:

1.Which of the following is an event

a) signal b)calls c)the passing of time d)a change in time

2.------------represents a named object that is dispatched asynchronously by one object and then received by

another.

a) signal b)calls c)the passing of time d)a change in time

3.---------represents the dispatch of an operation

a)signal b)calls c)the passing of time d)a change in time

4.---------is a event that represents the passage of time

a)signal b)calls c)time event d)a change in time

5.-------is an event that represents a change in state.

a)signal b)calls c)the passing of time d)a change in time

6.which of the following is external event

a)the pushing of a button b)an interrupt from a collision

c)a&b d)none

7.which of the following internal event

a)the pushing of a button b)an interrupt from a collision

c)a&b d)overflow exception

8.------is a condition or situation during the life of an object during which it satisfies some

condition,performs some activity

a)state b)event c)node d)note

Academic Dairy Handbook III CSE II SEM 44

Page 45: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

9.---------is a relationship between two states indicating that an object in the first state will perform certain

actions and enter the second state when a specified event occurs and specified conditions are satisfied.

a)state b)transition c)branching d)node

10.-------is an object that owns a process or thread and can initiate control activity.

a)active object b)event c)branching d)node

11.---------is a lightweight flow that can execute concurrently with other threads within the same process.

a)Thread b)active object c)branching d)node

12.-----------is a class whose instances are active objects.

a)Thread b)active object c)branching d)active class

13.--------is a stereotype which apply to active classes

a)process b)become c)extend d)include

14.-------is a denotation for the time at which an event occurs.

a)timing mark b)location c)process d)Thread

15.---------- diagram shows a state machine, emphasizing the flow of control from state to state

a)class b)object c)component d)state chart

16.---------is a behaviors that specifies the sequences of states an object goes through during its lifetime in

response to events.

a)state machine b)use case c)active class d)node

17.statechart diagram commonly contain

a)simple states b)composite state c)transition d)all

18.common use of state chart diagram

Academic Dairy Handbook III CSE II SEM 45

Page 46: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

a)to model reactive objects b)to model work flow

c)to model operation d)none

19.which of the following is behavioural diagram

a)class b)object c)component d)state chart

20.which of the following is used to model the dynamic aspects of a system

a)class b)object c)component d)state chart

UNIT-VII

Syllabus:

Architectural Modeling: Component, Deployment, Component diagrams and Deployment diagrams.

Objective:

Ability to identify the various components and nodes in component & deployment diagrams

Ability to model run time view of a system of a given application by using component &

deployment diagrams.

Lecture plan:

S.No Topic No. of lectures

1 Component 2

2 Deployment 2

3 Component Diagrams 2

4 Deployment Diagrams 2

5 Component and Deployment 2

Total classes to complete UNIT-VII 8

Assignment:Academic Dairy Handbook III CSE II SEM 46

Page 47: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

1. Write short notes on

a) Components and classes

b) Components and interfaces.

2. a) Explain about different kinds of components.

b) What are the stereo types that apply to components.Explain?

3. a) Enumerate steps to model executables and libraries.

b) Enumerate steps to model tables,files and documents?

4. a) Enumerate steps to model an API.

b) Enumerate steps to model source code?

5. Write short notes on

a) Nodes and Components

b) Organizing nodes

Case study:

Design the component and deployment diagram for the above description of case studies

Trusty car company group

2. ATM System

3. Bank

4. Restaurant system

Subjective Important Questions with answers:

1.Explain about nodes

Academic Dairy Handbook III CSE II SEM 47

Page 48: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

node is a physical element that exists at run time and represents a computational resource, generally having

at least some memory and often, processing capability. Graphically, a node is rendered as a cube.

Names:Every node must have a name that distinguishes it from other nodes. A name is a textual string. That

name alone is known as a simple name; a path name is the node name prefixed by the name of the package in which

that node lives. A node is typically drawn showing only its name. Just as with classes, you may draw nodes adorned

with tagged values or with additional compartments to expose their details.

Nodes and Components:

In many ways, nodes are a lot like components: Bothe have names; bote may participate in dependency,

generalization, and association relationships; both may be nested; both may have instances; both maybe participants

in interactions. However, there some significant differences between nodes and components.

Components are things that participate in the execution of a system; nodes are things that execute

components.

Components represent the physical packaging of otherwise logical elements; nodes represent the

physical deployment of components.

The first difference is the most important. Simply put, nodes execute components are things that are

executed by nodes.

ORGANIZING NODES:

You can organize by grouping them in packages in the same manner in which you can organize classes

and components.

You can also organize nodes by specifying dependency, generalization, and association relationships among

them.

2. What are the various contents of component diagrams

COMPONENT DIAGRAMS

Academic Dairy Handbook III CSE II SEM 48

Page 49: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

Terms and Concepts:

A common diagram shows a set of components and their relationships. Graphically, a component diagrams

is a collection of vertices and arcs.

Common Properties:

A component diagram is just a special kind of diagram and shares the same common properties as do all other

diagrams-a name and graphical contents that are a projection into a model. What distinguishes a component diagram

from all other kinds of diagrams is its particular content.

Contents:

Component diagrams commonly contain

Components

Interfaces

Dependency, generalization, association, and realization relationships

Like all other diagrams, component diagrams may contain notes and limits.

Component diagrams may also containing packages or subsystems, both of which are used to group

elements of your model into larger chunks.

Common Uses:

You use component diagrams to model the static implementation views of a system. This view primarily

supports the configuration management of a systems parts, made up of components that can be assembled in various

ways to produce a running system.

When you model the static implementation views of a system, you'll typically use component

diagrams in one of four ways.

To model source code

With the most contemporary object- oriented programming languages, you'll cut code using

integrated development environments that store your source code in files. You can use component

Academic Dairy Handbook III CSE II SEM 49

Page 50: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

diagrams to model the configuration management of these files, which represent work-product

components.

1. To model executable releases

A release is a relatively complete and consistent set of artifacts delivered to an internal or external user. In the context

of components, a release focuses on

the parts necessary to deliver a running system. When you model a release using component

diagrams, you are visualizing, specifying, and documenting the decisions about the physical parts

that constitute your software-that is, its deployment components.

2.To model physical databases

Think of a physical database as the concrete realization of a schema, living in the world of bits.

Schemas, in effect , offer as API to persistent information; the model of a physical database represents

the storage of that information in the tables of a relational database or the pages of an object-oriented

database. You use component diagrams to represent these and other kinds of physical database.

3. To model adaptable systems

Some systems are quite static; their components enter the scene, participate in an

execution, and then depart. Other systems are more dynamic, involving mobile agents or

components that migrate for purposes of load balancing and failure recovery. You component diagrams

in conjunction with some of the UML's diagrams for modeling behavior to represent these kinds of

systems.

3.How to model systems software source code

TO MODEL A SYSTEM'S SOURCE CODE

Either by forward or reverse engineering, identify the set of source code files of interest and model them as

components stereotyped as files.

For larger systems, use packages to show groups of source code files.

Consider exposing a tagged values indicating such information as the version number of the source code

file, its author, and the date it was last changed. Use tools to manage the values of this tag.

Academic Dairy Handbook III CSE II SEM 50

Page 51: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

Model the compilation dependencies among these files using dependencies. Again, use tolls to help

generate and manage these dependencies.

Objective Questions:

1.------------is a physical and replaceable part of a system

a) node b)object c)component d)class

2.----------is a collection of operations that are used to specify a service of a class or component

a) node b)object c)component d)interface

3.DLL and EXE files are -----------------components

a)deployment b)work product c)exection d)none

4.Source code files are--------------components

a)deployment b)work product c)exection d)none

5.which of the following stereotype is applied to components

a)file b)become c)extend d)include

6.-----------is a physical element that exists at run time and represents a computational resource.

a) node b)object c)component d)class

7.----------diagram shows a set of components and their relationships

a)class b)object c)component d)deployment

8.Component diagram commonly contain

a)components b)interfaces c)relationships d)all

Academic Dairy Handbook III CSE II SEM 51

Page 52: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

9.common use of component diagram

a)to model source code b) to model work flow

c) to model an operation d)b&c

10.-----------is a diagram that shows the configuration of run time processing nodes and the components that

live on them

a)class b)object c)component d)deployment

11.Deployment diagrams commonly contain

a)nodes b)Dependency c)Association d)All

12.Common use deployment diagram

a)To model embedded system b)To model work flow

c)To model an operation d)all

13.which diagram shows the static deployment view of a system

a)component b)Deployment c)class d)object

14.-----------diagrams are essentially class diagrams that focus on a systems nodes

a)component b)Deployment c)class d)object

15.-----------diagram is a special kind of class diagram that focuses on a system’s components

a)component b)Deployment c)class d)object

UNIT-VIII

Syllabus:

Case Study: The Unified Library application

Academic Dairy Handbook III CSE II SEM 52

Page 53: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

The Library System is a web-based application used to automate a library. It allows the librarian to

maintain the information about books, magazines and CDs. It also allows the librarian to maintain the

information about its users. It provides the facilities such as search for items, browse, checkout items,

return items, make reservation, remove reservation etc. to its users.

To borrow the items from the library, the users must register in the system. The search option

allows the users to search for any item in the library. If the user finds that the required item is available in

the library, he/she can checkout the item from the library. If the item is currently not available in the

library, the user can make reservation for the item. When the item becomes available the respective user

who made the reservation for that item first is notified.

The reservation is canceled when the user checks out the item from the library or through an explicit

cancellation procedure. The system allows the librarian to easily create, update, and delete information

about titles, borrowers, items and reservations in the system. The librarian is an employee of the library

who interacts with the borrowers whose work is supported by the system. The Library System can run on

popular web-browser platforms like Windows Explorer, Netscape Navigator etc. It can be easily extended

with new functionality

The Library System might be:

It is a support system

The library lends books, magazines and CDs to borrowers who are registered in the system

The Library System handles the purchases of new titles for the library

Popular titles are brought in multiple copies. Old books, magazines and CDs are removed when they

are out of date or in poor condition

The librarian is an employee of the library who interacts with the borrowers whose work is supported

by the system

A borrower can reserve a book, magazine or CD that is not currently available in the library so that

when it is returned or purchased by the library, the borrower is notified

Academic Dairy Handbook III CSE II SEM 53

Page 54: OOAD COURSE FILE

Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions

The reservation is canceled when the borrower checks out the book, magazine or CD or through an

explicit cancellation procedure

The librarian can easily create, update, and delete information about titles, borrowers, items and

reservations in the system

The system can run on popular web-browser platforms like Windows Explorer, Netscape navigator etc.

The system is easy to extend with new functionality

Objective:

Ability to design unified library application by using various diagram in UML.

Ability to model & visualize any given application.

Lecture plan:

S.No TopicNo. of

lectures

1

Case Study

The Unified Library application

4

Total classes to complete UNIT-VIII 4

Assignment:

1. Study the library management application and visualize by the various diagrams in UML.

Academic Dairy Handbook III CSE II SEM 54