Professional Documents
Culture Documents
Project
Project
BY
G. S. S. RAMANUJAN (Y6IT900)
V. RAJESH KUMAR GANDLA (Y6IT896)
R. NAGA TEJASWI (Y6IT874)
October- 2009
BONAFIDE CERTIFICATE
Certified that this project work titled Library Management System is the bonafide work
Ms. Naga Tejaswi R. (Y6IT874) who carried out the work under my supervision, and
ACKNOWLEDGEMENT
We regard our sincere thanks to our principal Dr. P. S. SANKAR RAO sir for
proving support and stimulating environment. We would like to express our gratitude to
the management of R. V. R. & J. C. COLLEGE OF ENGINEERING for providing us
with a pleasant Environment and Excellent Lab faculty.
Ramanujan. G. S. S (Y6IT900)
Rajesh Kumar Gandla. V (Y6IT896)
Naga Tejaswi. R (Y6IT874)
4
CONTENTS
1. Problem statement
ANALYSIS
Use case view
2. Identification of Actors.
4. Flow of Events.
6. Activity diagram.
Logical view
7. Identification of Analysis classes.
DESIGN
1. PROBLEM STATEMENT
Problem Scenario:
The first problem is that members waiting in large queues for issuing or
returning of books. Moreover, the arrangement of misplaced books in order at the shelves
is also a laborious process as each book needs to be picked out/opened to find its right
location. Entering the data manually into the database is time & effort consuming
process. It is also difficult for the library management to trace out which books are scarce
and which are excess in number.
Proposed Solution:
The idea is to generate a library system that knows where every book is and
allows visitors to return and issue books automatically. Online library system is nothing
but the maintenance of digital library. Once we enter into the library by using ID
card or Thumb impression the borrowers details are maintained in the database.
The details, which are maintained in the database, are shown below:
ANALYSIS
Use-case view
2. IDENTIFICATION OF ACTORS
Actors represent system users. They are NOT part of the system. They represent
anyone or anything that interacts with (input to or receive output from) the system.
An actor is someone or something that:
• Interacts with or uses the system
• Provides input to and receives information from the system
• Is external to the system and has no control over the use cases
Actors are discovered by examining:
Naming
The name of the actor is displayed below the icon.
Questions to help to identify actors
1. Who is interested in a certain requirement
2. Where is the system used within the organization?
3. Who will benefit from the use of the system?
7
4. Who will supply the system with information, use this information, and remove
this information?
5. Who will support and maintain the system?
6. Does the system use an external resource?
7. Does one person play several different roles?
8. Do several people play the same role?
9. Does the system interact with a legacy system?
Actors identified are:
1) Member:
User is a person who uses the banking system, and performs transactions.
He/she may be anyone in the society. He must have a valid account to use the services of
banking system.
2) Librarian:
The person who maintains the whole banking system; He interacts with the
user and provides services to him. He also forwards the necessary information sent by
user to bank manager.
8
Log-In
NAMING:
• A use case may have a name, although it is typically not a simple name. It is often
written as an informal text description of the actors and the sequences of events
between objects. Use case names often start with a verb. For example, names of
possible use cases for an ATM machine might include Dispense Cash or Transfer
Funds.
• The name of the use case is displayed below the icon.
The set of questions used to identify the use-cases are:
1. What are the tasks of each actor?
2. Will any actor create, store, change, remove or read information in the system?
3. What use cases will create, store, change, remove, or read this information?
4. Will any actor need to inform the system about sudden, external changes?
5. Does any actor need to be informed about certain occurrences in the system?
6. What use cases will support or maintain the system?
7. Can all functional requirements be performed by the use cases?
A use case describes a set of sequences, in which each sequence represents the
interaction of the things outside the system (its actors) with the system itself (and
its key abstraction).
Use cases specify desired behavior; they do not dedicate how the behavior will be
carried out. It helps you to communicate with your developers (who build system
that satisfies your requirements) with out getting hung up on details.
A use case represents a functional requirement of the system as a whole.
A use case carries out some tangible amount of work. From the perspective of a
given actor, a use case does some thing that’s of value to an actor, such as
calculate a result, generate a new object or change the state of another object.
Use cases represent an external view of the system.
Log-In
4. FLOW OF EVENTS
A flow of events is a sequence of transactions (or events) performed by the
system. They typically contain very detailed information. Flow of events document is
typically created in the elaboration phase.
Each use case is documented with flow of events
a description of events needed to accomplish required behavior
written in terms of what the system should do, NOT how it should do it
written in the domain language, not in terms of the implementation
A flow of events should include:
When and how the use case starts and ends
What interaction the use case has with the actors
What data is needed by the use case
The normal sequence of events for the use case
The description of any alternate or exceptional flows
The flow of events for a use case is contained in a document called the Use Case
Specification. Each project should use a standard template for the creation of the Use
Case Specification. Includes the following
1. Use case name, Brief Description
2. Flow of Events -
1. Basic flow.
2. Alternative flow.
3. Special requirements.
4. Pre conditions.
5. Post conditions.
6. Extension points.
14
Generally for a particular account librarian will place the validity. Then librarian
checks the account of the member.
2.2 Alternate Flows
2.2.1 If account expired simply exit from the system.
3.0 Special Requirements
There are no special requirements for this use case.
4.0 Pre conditions
There are no pre conditions.
5.0 Post conditions
There are no post conditions.
6.0 Extension Points
None.
4.0 Preconditions
There are no pre conditions
5.0 Post conditions
There are no post conditions.
6.0 Extension Points
None.
5. USE-CASE DIAGRAM
RELATIONS:
Association Relationship:
An association provides a pathway for communication. The
communication can be between use cases, actors, classes or interfaces. Associations are
the most general of all relationships and consequentially the most semantically weak. If
two objects are usually considered independently, the relationship is an association
By default, the association tool on the toolbox is uni-directional and drawn on a
diagram with a single arrow at one end of the association. The end with the arrow
indicates who or what is receiving the communication.
Bi-directional association:
If you prefer, you can also customize the toolbox to include the bi-
directional tool to the use-case toolbox.
In An ASSOCIATION Relationship, we can provide Stereotype COMMUNICATE also
as shown below
21
<<communicate>>
LOGIN
USER
Dependency Relationship:
EXTEND RELATIONSHIP:
«extend» is used when you wish to show that a use case provides additional functionality
that may be required in another use case.
«include» applies when there is a sequence of behavior that is used frequently in a
number of use cases, and you want to avoid copying the same description of it into each
use case in which it is used.
The following is the complete use case diagram for our application i.e., (Library
Management System).
23
Login <<include>>
<<extend>>
Check Validity
Registration
<<include>>
Valid
Return Book
Extend Book
Borrow Journal
Return Journal
6. ACTIVITY DIAGRAM
ACTIVITIES:
An activity represents the performance of task or duty in a workflow. It
may also represent the execution of a statement in a procedure. An activity is similar
to a state, but expresses the intent that there is no significant waiting (for events) in an
activity.
The activity icon appears as a rectangle with rounded ends with a name and
a compartment for actions.
NewActivity
TRANSITIONS:
Transitions connect activities with other model elements and object flows
connect activities with objects. Transitions are used to show the passing of the flow
of control from activity to activity. They are typically triggered by the completion of
the behavior in the originating activity.
A state transition indicates that an object in the source state will perform
certain specified actions and enter the destination state when a specified event occurs
or when certain conditions are satisfied. A state transition is a relationship between
two states, two activities, or between an activity and a state.
NAMING:
The name of a state should be unique to its enclosing class, or if nested,
within the state. All state icons with the same name in a given diagram represent the
same state.
Actions:
Actions on states can occur at one of four times:
• On entry
• On exit
• Do
• On event
26
DECISIONS:
When modeling the workflow of a system it is often necessary to
show where the flow of control branches based on a decision point. The transitions from
a decision point contain a guard condition, which is used to determine which path from
the decision point is taken. Decisions along with their guard conditions allow you to
show alternate paths through a work flow.
A decision represents a specific location on an activity diagram or state chart
diagram where the workflow may branch based upon guard conditions. There may be
more than two outgoing transitions with different guard conditions, but for the most part,
a decision will have only two outgoing transitions determined by a Boolean expression.
Decision Point
END STATE:
An end state represents a final or terminal state on an activity diagram or state
chart diagram. Place an end state when you want to explicitly show the end of a
workflow on an activity diagram or the end of a state chart diagram. Transitions can only
occur into an end state; however, there can be any number of end states per context.
End state
START STATE:
A start state, (also called an “initial state”) explicitly shows the beginning of a
workflow on an activity diagram or the beginning of the execution of a state machine on
a state chart diagram.
Start state
27
SWIM LANES:
Swim lanes may be used to partition an activity diagram. This typically is done to
show what person or organization is responsible for the activities contained in the swim
lane.
Swim lanes are helpful when modeling a business workflow because they can
represent organizational units or roles within a business model. Swim lanes are very
similar to an object because they provide a way to tell who is performing a certain role.
Swim lanes only appear on activity diagrams.
When a swim lane is dragged onto an activity diagram, it becomes a swim lane
view. Swim lanes appear as small icons in the browser while a swim lane views appear
between the thin, vertical lines with a header that can be renamed and relocated.
SYNCHRONIZATION BARS:
In a workflow there are typically some activities that may be done in parallel. A
synchronization bar allows you to specify what activities may be done concurrently.
Synchronization bars are also used to show joins in the workflow; that is, what
activities must complete before processing may continue.
Means, a synchronization bar may have many incoming transitions and one
outgoing transition, or one incoming transition and many outgoing transitions.
Modeling a workflow in an activity diagram can be done several ways; however, the
following steps present just one logical process:
1. Identify a workflow objective. Ask, "What needs to take place or happen by the end of
the workflow? What needs to be accomplished?" For example, if your activity diagram
models the workflow of ordering a book from an online bookstore, the goal of the entire
workflow could be getting the book to the customer.
2 Decide the pre and post-conditions of the workflow through a start state and an end
state. In most cases, activity diagrams have a flowchart structure so start and end states
are used to designate the beginning and ending of the workflow. State and end states
clarify the perimeter of the workflow.
3. Define and recognize all activities and states that must take place to meet your
objective. Place and name them on the activity diagram in a logical order.
4. Define and diagram any objects that are created or modified within your activity
diagram. Connect the objects and activities with object flows.
5. Decide who or what is responsible for performing the activities and states through
swim lanes. Name each swim lane and place the appropriate activities and states within
each swim lane.
6. Connect all elements on the diagram with transitions. Begin with the "main"
workflow.
7. Place decisions on the diagram where the workflow may split into an alternate flow.
For example, based on a Boolean expression, the workflow could branch to a different
workflow.
8. Evaluate your diagram and see if you have any concurrent workflows. If so, use
synchronizations to represent forking and joining.
9. Set all actions, triggers and guard conditions in the specifications of each model
element.
29
Login Transactions
Login
No
If for No Return a
selection? book
Yes
If he likes
No
Yes
Updation
LOGICAL VIEW
Using the noun phrase strategy, candidate classes can be divided into three
categories: Relevant classes, Fuzzy Area or Fuzzy classes (those classes that we are not
sure about), and irrelevant classes.
It is safe to scrap the irrelevant classes, which either have no purpose or will be
unnecessary. Candidate classes then are selected from the other two categories. Here
identifying classes and developing a UML class diagram just like other activities is an
iterative process. Depending on whether such object modeling is for the analysis or
design phase of development, some classes may need to be added or removed from the
model .Analyst must be able to formulate a statement of purpose for each candidate class;
if not, simply eliminate it.
1 Identifying Tentative Classes:
The following are guidelines for selecting classes in an application:
• Look for nouns and noun phrases in the use cases.
• Some classes are implicit or taken from general knowledge.
• All classes must make sense in the application domain; avoid computer
implementation classes refer them to the design stage.
• Carefully choose and define class names.
Identifying classes is an incremental and iterative process. This incremental and
iterative nature is evident in the development of such diverse software technologies as
graphical user interfaces, database standards, and even fourth-generation languages.
2 Selecting Classes from the Relevant and Fuzzy Categories :
The following guidelines help in selecting candidate classes from the
relevant and fuzzy categories of classes in the problem domain.
32
a) Redundant classes. Do not keep two classes that express the same
information. If more than one word is being used to describe the same idea, select the one
that is the most meaningful in the context of the system. This is part of building a
common vocabulary for the system as a whole. Choose your vocabulary carefully; use the
word that is being used by the user of the system.
b) Adjectives classes. "Be wary of the use of adjectives. Adjectives can be used
in many ways. An adjective can suggest a different kind of object, different use of the
same object, or it could be utterly irrelevant. Does the object represented by the noun
behave differently when the adjective is applied to it? If the use of the adjective signals
that the behavior of the object is different, then make a new class".
For example : Single account holders behave differently than Joint
account holders, so the two should be classified as different classes.
c) Attribute classes: Tentative objects that are used only as values should be
defined or restated as attributes and not as a class. For example, Client Status and Details
of Client are not classes but attributes of the Client class.
d) Irrelevant classes: Each class must have a purpose and every class should be
clearly defined and necessary. You must formulate a statement of purpose for each
candidate class. If you cannot come up with a statement of purpose, simply eliminate the
candidate class.
As this is an incremental process. Some classes will be missing; others will be
eliminated or refined later. Unless you are starting with a lot of domain knowledge, you
probably are missing more classes than you will eliminate. Although some classes
ultimately may become super classes, at this stage simply identify them as individual,
specific classes. Your design will go through many stages on its way to completion, and
you will have adequate opportunity to revise it.
This refining cycles through the development process until you are
satisfied with the results. Remember that this process (of eliminating redundant classes,
classes containing adjectives, possible attributes, and irrelevant classes) is not sequential.
You can move back and forth among these steps as often analysts likes.
33
classes, and frequently supports a number of different interactions that may represent
several different use cases.
2. A collaboration diagram usually contains only object instances, while a class diagram
usually contains only classes.
3. The connections between the object symbols on a collaboration diagram symbolize
links between objects, while on a class diagram the corresponding connections stand for
associations between classes.
4. A collaboration diagram shows the dynamic interaction of a group of objects and thus
every link needed for message passing is shown. The labeled arrows alongside the links
represent messages between objects. On a class diagram, the associations themselves are
usually labeled, but messages are not shown.
5. Finally, any of the three stereotype symbols can be used on either diagram; there are
also differences in this notation.
When the rectangular box variant of the notation is used in a collaboration
diagram it represents object instances rather than classes, is normally undivided and
contains only the class name .On a class diagram, the symbol is usually divided into three
compartments that contain in turn the class name, its attributes and its operations.
CRC cards are an aid to a group role-playing activity. Index cards are used in preference
to pieces of paper due to their robustness and to the limitations that their size (approx.
15cm x 8cm) imposes on the number of responsibilities and collaborations that can be
effectively allocated to each class.
A class name is entered at the top of each card and responsibilities and collaborations are
listed underneath as they become apparent. For the sake of clarity, each collaboration is
normally listed next to the corresponding responsibility.
From a UML perspective, use of CRC cards is in analyzing the object interaction
that is triggered by a particular use case scenario. The process of using CRC cards is
usually structured as follows.
37
1. Conduct a session to identify which objects are involved in the use case.
2. Allocate each object to a team member who will play the role of that object.
3. Act out the use case.
This involves a series of negotiations among the objects to explore how
responsibility can be allocated and to identify how the objects can collaborate with each
other.
4. Identify and record any missing or redundant objects.
Before beginning a CRC session it is important that all team members are briefed on the
organization of the session and a CRC session should be preceded by a separate exercise
that identifies all the classes for that part of the application to be analyzed.
The team members to whom these classes are allocated can then prepare for the
role playing exercise by considering in advance a first-cut allocation of responsibilities
and identification of collaborations. Here, it is important to ensure that the environment
in which the sessions take place is free from interruptions and free for the flow of ideas
among team members.
During a CRC card session, there must be an explicit strategy that helps to
achieve an appropriate distribution of responsibilities among the classes. One simple but
effective approach is to apply the rule that each object should be as lazy as possible,
refusing to take on any additional responsibility unless instructed to do so by its fellow
objects.
During a session conducted according to this rule, each role player identifies the object
that they feel is the most appropriate to take on each responsibility, and attempts to
persuade that object to accept the responsibility. For each responsibility that must be
allocated, one object is eventually persuaded by the weight of rational argument to accept
it. This process can help to highlight missing objects that are not explicitly referred to by
the use case description. When responsibilities can be allocated in several different ways
it is useful to role-play each allocation separately to determine which is the most
appropriate. The aim normally is to minimize the number of messages that must be
passed and their complexity, while also producing class definitions that are cohesive and
well focused.
38
The following are the responsibilities of each class in our application Library
Management System.
1. Login:
This provides the responsibility that the users who are going to login to the
system. If the user is unauthorized then it does not provide the member to login to the
system.
2. Librarian:
This class controls the total maintenance of he Library system and controls all the
operations in the system.
3. Registration:
This creates the account for he user for those who are not having the account in
the library. This is the main responsibility of this class.
4. Updation:
The main responsibility of this class is whenever the user or member going to take
the books immediately it update the account of the member.
5. Book Details:
It provides to the user to get all the details of all the books available in the library.
9. USE-CASE REALIZATIONS
Use case realization is nothing but an instance of a use case which involves the
identification of a possible set of classes, together with an understanding of how those
classes might interact to deliver the functionality of the use case. The set of classes is
known as collaboration.
In the UML, use case realizations are drawn as dashed ovals and relation ship symbols
are as shown below.
Realization relationship
The focus of control is a tall, think rectangle that shows the period of time during which
an object is performing an action, either directly or through a subordinate procedure.
An object lifeline is a vertical dashed line that represents the existence of an object over
a period of time. Most objects that appear in an interaction diagram will be in existence
of an object over a period of time. Most objects that appear in an interaction diagram will
be in existence for the duration of the interaction.
Message to self: A message to self is a tool that sends a message from one object back to
the same object. It does not involve other objects because the message returns to the same
object. The sender of a message is the same as the receiver.
2: verify password
3: process
4: get book
5: refer book
10: getextend
In this expression integer represents the sequential order of the message. This may be
nested within a loop or a branch construct.
The name of a sequence-expression is used to differentiate two concurrent
messages since these are given the same sequence number.
Recurrence reflects either iterative or conditional execution and its syntax is as
follows:
Branching: ‘[‘condition-clause‘ ],
Iteration: ‘* ‘‘[‘iteration-clause ‘ ]’
A collaboration diagram emphasizes the organization of the objects that
participate in an interaction. Collaboration diagrams are a static construct to show objects
and messages involved in accomplishing a purpose or a set of purposes.
• Messages
• Path
• Sequence number
An object is a concrete manifestation of a class to which a set of operations can be
applied and which has a state that stores the effects of the operations. Objects are
instances of classes.
A path is used to indicate how one object is linked to another. A path stereotype is
attached to the far end of the link. The link of the path should be rendered explicitly.
A sequence number is used to indicate the time order of a message. The message is
prefixed with a number which increases monotonically for each new message in the flow
of control.
Two types of Numbering Sequences are:
1. Flat Sequence
2. Decimal Sequence
Difference between sequence and collaboration diagrams
Sequence diagrams are closely related to collaboration diagrams and both are
alternate representations of an interaction.
49
2: verify password
1: enter password
3: process
:return
4: get book Book
:extend
Book
11: set extend
: control:
librarian
50
:Member
Information
1: get memberdetails
3: maintain updations
:Updation
2: set details Option
: Librarian
:User
Account :Catalog
ue
These are the collaboration diagrams in our project Library Management System
51
Attributes
Attributes are part of the essential description of a class. They belong to the class, unlike
objects, which instantiate the class. Attributes are the common structure of what a
member of the class can 'know'. Each object will have its own, possibly unique, value for
each attribute.
Guidelines for identifying attributes of classes are as follows:
Attributes usually correspond to nouns followed by prepositional phrases.
Attributes also may correspond to adjectives or adverbs.
Keep the class simple; state only enough attributes to define the object state.
Attributes are less likely to be fully described in the problem statement.
Omit derived attributes.
Do not carry discovery attributes to excess.
Some questions are there which help in identifying the responsibilities of classes and
deciding what data elements to keep track of:
• What information about an object should we keep track of?
• What services must a class provide?
Answering the first question helps us to identify the attributes of a class. Answering the
second question helps us to identify class methods.
1. ASSOCIATION RELATIONSHIPS:
An association is a bidirectional semantic connection between classes. It is not a
data flow as defined in structured analysis and design data may flow in either direction
across the association. An association between classes means that there is a link between
objects in the associated classes.
2. AGGREGATION RELATIONSHIPS:
An aggregation relationship is a specialized form of association in which a whole
is related to its part(s).
Aggregation is known as a "part-of" or containment relationship. The UML
notation for an aggregation relationship is an association with a diamond next to the class
denoting the aggregate (whole).
Login/checkavailabil <<entity>>
ity Librarian (from
name usecase view)
address name
Borrower-id number
1 1
checkavailability() updatecatalog()
getdetails() updateaccount()
registration() allocate-id()
Item
itemname Itemstatus
itemnumber issuedate
issuedate duedate
duedate itemcount
assignissuedate() checkintime()
assignduedate() penality()
extenditem() checkcount()
returnitem()
55
Class diagrams contain icons representing classes, packages, interfaces, and their
relationships. You can create one or more class diagrams to depict the classes at the top
level of the current model; such class diagrams are themselves contained by the top level
of the current model.
OBJECT:
• AN OBJECT IS a representation of an entity, either real-world or conceptual.
• An object is a concept, abstraction, or thing with well defined boundaries and
meaning for an application.
• Each object in a system has three characteristics: state, behavior, and identity.
STATE: THE STATE OF an object is one of the possible conditions in which it may
exist. The state of an object typically changes over time, and is defined by a set of
properties (called attributes), with the values of the properties, plus the relationships the
object may have with other objects.
Behavior:
• Behavior determines how an object responds to requests from other objects .
• Behavior is implemented by the set of operations for the object.
56
Identity:
• Identity means that each object is unique even if its state is identical to that of
another object.
CLASS: A CLASS IS a description of a group of objects with common properties
(attributes) common behavior (operations), common relationships to other objects, and
common semantics.
Thus, a class is a template to create objects. Each object is an instance of
some class and objects cannot be instances of more than one class.
Classes should be named using the vocabulary of the domain.
In the UML, classes are represented as compartmentalized rectangles.
The top compartment contains the name of the class.
The middle compartment contains the structure of the class (attributes).
The bottom compartment contains the behavior of the class (operations) as shown below.
Entity Classes
• An entity class models information and associated behavior that is generally
long lived.
• This type of class may reflect a real-world entity or it may be needed to perform
tasks internal to the system.
57
• They are typically independent of their surroundings; that is, they are not
sensitive to how the surroundings communicate with the system.
IDENTIFICATION:
The first step is to examine the responsibilities documented in the flow of events
for the identified use cases. Entity classes typically are classes that are needed by the
system to complete some responsibility. The nouns and noun phrases used to describe the
responsibility may be considered for identification purpose. The initial list of nouns must
be filtered because it could contain nouns that are outside the problem domain, nouns that
are just language expressions, nouns that are redundant, and nouns that are descriptions
of class structures.
Boundary Classes:
Boundary classes handle the communication between the system surroundings
and the inside of the system. They can provide the interface to a user or another system
(i.e., the interface to an actor). They constitute the surroundings dependent part of the
system.
Boundary classes are used to model the system interfaces.
Boundary classes are also added to facilitate communication with other systems.
During design phase, these classes are refined to take into consideration the chosen
communication protocols.
Control Classes
• Control classes model sequencing behavior specific to one or more use cases.
• Control classes coordinate the events needed to realize the behavior specified in
the use case.
• Control classes typically are application-dependent classes.
In the early stages of the Elaboration Phase, a control class is added for each
actor/use case pair. The control class is responsible for the flow of events in the use case.
In the early stages of the Elaboration Phase, a control class is added for each
actor/use case pair. The control class is responsible for the flow of events in the use case.
58
Login/checkavailability <<Actor>>
name Librarian (from usecase view)
address name
Borrower-id number
1 1
checkavailability() updatecatalog()
getdetails() updateaccount()
registration() allocate-id()
1..n 1
1..n
1..n
<<entity>>
Borrower Itemstatus
Borrower-id issuedate
name duedate
itemcount
login() 1..n 1..n
additem() checkintime()
extenditem() penality()
returnitem() checkcount()
Item
itemname
itemnumber
issuedate
duedate
assignissuedate()
assignduedate()
extenditem()
returnitem()
60
Use cases and scenarios provide a way to describe system behavior; in the form of
interaction between objects in the system. Sometimes it is necessary to consider inside
behavior of an object.
A state chart diagram shows the states of a single object, the events or messages
that cause a transition from one state to another and the actions that result from a state
change. As in Activity diagram, state chart diagram also contains special symbols for
start state and stop state.
State chart diagram cannot be created for every class in the system, it is only for
those class objects with significant behavior.
STATE:
A state represents a condition or situation during the life of an object during
which it satisfies some condition, performs some action or waits for some event.
UML notation for STATE is
To identify the states for an object its better to concentrate on sequence diagram.
In our application the object for Account may have in the following states, initialization,
open and closed state. These states are obtained from the attribute and links defined for
the object. Each state also contains a compartment for actions.
ACTIONS:
Actions on states can occur at one of four times:
on entry
on exit
do
On event.
61
On entry: What type of action that object has to perform after entering into the state?
On exit: What type of action that object has to perform after exiting from the state?
Do: The task to be performed when object is in this state, and must to continue until it
leaves the state.
On event: An on event action is similar to a state transition label with the following
syntax:
event(args)[condition]: the Action
STATE TRANSITION:
A state transition indicates that an object in the source state will perform certain
specified actions and enter the destination state when a specified event occurs or when
certain conditions are satisfied. A state transition is a relationship between two states,
two activities, or between an activity and a state.
We can show one or more state transitions from a state as long as each transition
is unique. Transitions originating from a state cannot have the same event, unless there
are conditions on the event.
Provide a label for each state transition with the name of at least one event that
causes the state transition. You do not have to use unique labels for state transitions
because the same event can cause a transition to many different states or activities.
Transitions are labeled with the following syntax:
Only one event is allowed per transition, and one action per event.
STATE DETAILS:
Actions that accompany all state transitions into a state may be placed as an entry
action within the state. Like wise that accompany all state transitions out of a state may
62
be placed as exit actions within the state. Behavior that occurs within the state is called an
activity.
An activity starts when the state is entered and either completes or is interrupted
by an outgoing state transition. The behavior may be a simple action or it may be an
event sent to another object.
UML notation for State Details
StateName
entry/ simple action
entry/ ^class name.eventname
do/ simple action
do/ ^class name.event name
exit/ ^class name.event name
1. State: It is a condition or situation during the life of an object during which it satisfies
some condition, performs some activity, or waits for some event.
2. Event: It is the specification of significant occurrence that has a location in time and
space.
3. Transition: It is a relation 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
conditions are satisfied.
4. Action state: An action state is shorthand for a state with an entry action and at least one
outgoing transition involving the implicit event of completing the entry action.
5. Sequential sub state: A submachine state represents the invocation of a state machine
defined elsewhere. The submachine state is depicted as a normal state with the
appropriate “include” declaration within its internal transitions compartment. As an
option, the submachine state may contain one or more sub states, which represent already
created states.
6. Concurrent sub state: A concurrent state is divided into two or more sub states. It is a
state that contains other state vertices. Naturally, any sub state of a concurrent state may
also be a composite state of either type. Any state enclosed within a composite state is
called a sub state of that concurrent state.
7. Initial state: A pseudo state to establish the start of the event into an actual state.
8. Final state: The final state symbol represents the completion of the activity.
9. History state: History state is a state machine describes the dynamic aspects of an object
whose current behavior depends on its past.
10. Vertical Synchronization: This merge branch bar symbol is also known as a
“Synchronization Bar”. It merges concurrent transitions to a single target. It splits a
single transition into parallel transitions.
64
11. Horizontal Synchronization: This merge branch bar symbol is also known as a
“Synchronization Bar”. It merges concurrent transitions to a single target. It splits a
single transition into parallel transitions.
12. Guard conditions: Activity and state diagrams express a decision when conditions are
used to indicate different possible transitions that depend on Boolean conditions of
container object. UML calls those conditions as guard conditions.
13. Forks and joins: A fork construct is used to model a single flow of control that divides
into two or more separate, but simultaneous flows. A join consists of two or more flows
of control that unite into a single flow of control.
DESIGN
65
During the design phase the classes identified in object-oriented analysis must be
revisited with a shift in focus to their implementation. New classes or attributes and
methods must be added for implementation purpose and user interfaces.
Axiom: An axiom is a fundamental truth that always is observed to be valid and for
which is no counterexample or exception.
Axiom 1. The independence axiom.
Maintain the independence of components.
Axiom 2. The information axiom.
Minimize the information content of the design.
Axiom 1 deals with relationship between system components and Axiom 2 deals
with the complexity of the design. Axiom 1 states that, during the design process, as we
go from requirement and use-case to a system component, each component must satisfy
that requirement without affecting other requirements. Axiom 2 is concerned with
simplicity.
Occam’s razor says that, “The best theory explains the known facts with a
minimum amount of complexity and maximum simplicity and straightforwardness.”
Theorem: A theorem is a proposition that may not be self-evident but can be proven
from accepted axioms.
Corollary: A corollary is a proposition that follows from an axiom or another
proposition that has been proven.
Corollary 1. Uncoupled design with less information content. Highly cohesive objects
can improve coupling because only a minimal amount of essential information need be
passed between objects.
Corollary 2. Single purpose. Each class must have a single, clearly defined purpose.
When we document, we should be able to easily describe the purpose of a class in a few
sentences.
66
Corollary 3. Large number of simple classes. Keeping the classes simple allows
reusability.
Corollary 4. Strong mapping. There must be a strong association between the physical
system (analysis’s object) and logical design (design’s object).
Corollary 5. Standardization. Promote standardization by designing interchangeable
components and reusing existing classes or components.
Corollary 6. Design with inheritance. Common behavior must be moved to super classes.
The superclass-subclass structure must make logical sense.
Using corollary 6 in Library Management System the book class inherits the properties of
Book_item class shown as follows
Item
itemname Itemstatus
itemnumber issuedate
issuedate duedate
duedate itemcount
assignissuedate() checkintime()
assignduedate() penality()
extenditem() checkcount()
returnitem()
The above UML diagram indicates the Generalization relationship between the books
and their status.
Attributes
During analysis Stage we need to consider in detail the data types of the attributes
also. Common primitive data types include Boolean (true or false), Character (any
alphanumeric or special character), Integer (whole numbers) and Floating-Point (decimal
numbers). In most object-oriented languages more complex data types, such as Money,
String, Date, or Name can be constructed from the primitive data types or may be
available in standard libraries. An attribute's data type is declared in UML using the
following syntax:
The name is the attribute name, the type-expression is its data type, the initial
value is the value the attribute is set to when the object is first created and the property-
string describes a property of the attribute, such as constant or fixed. The characters in
single quotes are literals.
Attribute declarations can also include arrays also. For example, an Employee
class might include an attribute to hold a list of qualifications that would be declared
using the syntax: Qualification [O ... 10]: String
Operations
Each operation also has to be specified in terms of the parameters that it passes
and returns. The syntax used for an operation is:
Operation name' ('parameter-list ') “: “return-type-expression
An operation's signature is determined by the operation's name, the number and
type of its parameters and the type of the return value if any.
Object visibility
The concept of encapsulation is one of the fundamental principles of object-
orientation. During analysis various assumptions have been made regarding the
encapsulation boundary for an object and the way that objects interact with each other.
68
Interfaces
Generally a class may present more than one external interface to other classes or
the same interface may be required from more than one class. An interface in UML is a
group of externally visible (i.e. public) operations. The interface contains no internal
structure, it has no attributes, no associations and the implementation of the operations is
not defined. Formally, an interface is equivalent to an abstract class that has no attributes,
no associations and only abstract operations.
The following figure shows two alternative notations for an interface. The simpler of the
two UML interface notations is a circle. This is attached by a solid line to the classes that
support the interface.
69
The alternative notation uses a stereotyped class icon. As an interface only specifies the
operations and has no internal structure, the attributes compartment is omitted. This
notation lists the operations on the diagram. The realize relationship, represented by the
dashed line with a triangular arrowhead, indicates that the class supports at least the
operations listed in the interface
<< interface >>
Refining Attributes:
In the analysis phase, the name of the attribute was sufficient. However, in the
design phase, detailed information must be added to the model. There are three basic
types of attributes. They are:
1) Single-value attributes.
2) Multiplicity or multi-value attributes.
3) Reference to another object, or instance connection.
Attributes represent the state of an object. The following is the attribute presentation:
Visibility name: type-expression=initial-value
Where visibility is one of the following:
+ public visibility
# protected visibility
- private visibility
During analysis, we identified the following attributes for classes:
Refining attributes for Librarian class:
• name
• number
name
id
After refining
+ id : String
+ name: String
Refining methods:
After refining
+updateCatalog(String id)
+updateAccount(String id)
+allocateID(String id,String name)
checkAvailability()
registration()
getDetails()
After refining
+checkAvailability(String id)
+registration(String id,String name)
+getDetails(String id)
After refining
+login(String id)
+addItem(String name)
+returnItem(String name)
+extendItem(String name)
After refining
+assign_issuedate(String name)
+assign_issuedate(String name)
+extendItem(String name)
72
+returnItem(String name)
After refining
+Checkintime(Stirng id)
+Penality(String id)
+checkAccount(String id)
Refining relationships:
The relationships are already been drawn, there are no modifications to be done to
those relationships.
Login/Check
Book Status
Availability Librarian
issuedate
Name Name
duedate
Address 1 1 Number 1..n 1 itemcount
Borrower-id
Update Catalog()
checkintime()
checkavailability() Update Account()
penality()
getDetails() Allocate Id()
checkcount()
registration() 1
1 1..n
1
Book Member
itemname 1..n Borrower-id
itemnumber Name
issuedate
duedate Login() 1..n
Additem()
assignissuedate() Extenditem()
assignduedate() Returnitem()
extenditem()
returnitem()
<<Body>>
<<Header>>
<<includes>> LMS system.cpp
LMS system.h
<<Object code>>
LMS system.c
<<Executable>>
Process.exe
sun.jdbc
<<JDBC>>
LMS
System
<<JDBC>>
REFERENCES
4. www.icicibank.com
5. www.citibank.com