You are on page 1of 73

SOFTWARE MAINTENANCE:

1. What is Software Maintenance


1.1 Introduction
Software maintenance is often considered to be (if it is considered at all) an n!leasant"
time consmin#" e$!ensi%e and nrewardin# occ!ation & somet'in# t'at is carried ot at
t'e end of de%elo!ment onl( w'en absoltel( necessar( (and 'o!efll( not %er( often))
As sc' it is often considered to be t'e *!oor relation+ of software de%elo!ment ,
bd#ets often do not allow for it (or allow too little)" and few !ro#rammers #i%en a
c'oice wold c'oose to carr( ot maintenance o%er de%elo!mental wor-) T'is %iew" t'at
software maintenance is *t'e last resort+ is lar#el( born ot of i#norance)
Misconce!tions" misnderstandin#s and m(t's concernin# t'is crcial area of software
en#ineerin# abond)
Software Maintenance sffers from an *ima#e !roblem+ de to t'e fact t'at alt'o#'
software 'as been maintained for (ears" relati%el( little is written abot t'e to!ic) .ittle
fndin# for researc' abot software maintenance e$ists" t's" t'e academic commnit(
!blis'es relati%el( few !a!ers on t'e sb/ect) Maintenance or#anisations wit'in bsiness
!blis' e%en less becase of t'e cor!orate fear of #i%in# awa( t'e 0com!etiti%e ed#e0)
Alt'o#' t'ere are some te$tboo-s on software maintenance" t'e( are relati%el( few and
far between (e$am!les are inclded in t'e biblio#ra!'()) 1eriodicals address t'e to!ic
infre2entl( and few ni%ersities inclde software maintenance e$!licitl( in t'eir de#ree
!ro#rammes ) T'is lac- of !blis'ed information contribtes to t'e misnderstandin#s
and misconce!tions t'at !eo!le 'a%e abot software maintenance)
1art of t'e confsion abot software maintenance relates to its definition3 w'en it be#ins"
w'en it ends and 'ow it relates to de%elo!ment) T'erefore it is necessar( to first consider
w'at is meant b( t'e term software maintenance)
What is Software Maintenance?
In order to define software maintenance we need to define e$actl( w'at is meant b(
software) It is a common misconce!tion to belie%e t'at software is !ro#rams and t'at
maintenance acti%ities are carried ot e$clsi%el( on !ro#rams) T'is is becase man(
software maintainers are more familiar wit'" or rat'er are more e$!osed to !ro#rams t'an
ot'er com!onents of a software s(stem , sall( it is t'e !ro#ram code t'at attracts most
attention)
1.2 A Definition of Software
A more com!re'ensi%e %iew of software is #i%en b( Mc4ermid (5665) w'o states t'at it
*consists of t'e !ro#rams" docmentation and o!eratin# !rocedres b( w'ic' com!ters
can be made sefl to man+) Table 5)5 below de!icts t'e com!onents of a software
s(stem accordin# to t'is %iew and incldes some e$am!les of eac')
Mc4ermid7s definition s##ests t'at software is not onl( concerned wit' !ro#rams &
sorce and ob/ect code & bt also relates to docmentation of an( facet of t'e !ro#ram"
sc' as re2irements anal(sis" s!ecification" desi#n" s(stem and ser manals" and t'e
!rocedres sed to set ! and o!erate t'e software s(stem) Mc4ermid7s is not t'e onl(
definition of a software s(stem bt it is com!re'ensi%e and widel( acce!ted)Software
Com!onents
1.3 A Definition of Maintenance
T'e se of t'e word maintenance to describe acti%ities nderta-en on software s(stems
after deli%er( 'as been considered a misnomer de to its failre to ca!tre t'e
e%oltionar( tendenc( of software !rodcts) Maintenance 'as traditionall( meant t'e
!-ee! of an artifact in res!onse to t'e #radal deterioration of !arts de to e$tended se"
w'ic' is sim!l( correcti%e maintenance) So for e$am!le" one carries ot maintenance on
a car or a 'ose sall( to correct !roblems e)#) re!lacin# t'e bra-es or fi$in# t'e lea-in#
roof) If 'owe%er we were to bild an e$tension to t'e 'ose or fit a sn roof to a car t'en
t'ose wold sall( be t'o#'t of as im!ro%ements (rat'er t'an a maintenance acti%ities))
T'erefore to a!!l( t'e traditional definition of maintenance in t'e conte$t of software
means t'at software maintenance is onl( concerned wit' correctin# errors) 8owe%er"
correctin# errors acconts for onl( !art of t'e maintenance effort)
Conse2entl(" a nmber of at'ors 'a%e ad%anced alternati%e terms t'at are considered to
be more inclsi%e and encom!ass most" if not all" of t'e acti%ities nderta-en on e$istin#
software to -ee! it o!erational and acce!table to t'e sers) T'ese inclde *software
e%oltion+" *!ost&deli%er( e%oltion+ and *s!!ort+) 8owe%er it can be ar#ed t'at t'ere
is not'in# wron# wit' sin# t'e word maintenance !ro%ided software en#ineers are
edcated to acce!t its meanin# wit'in t'e software en#ineerin# conte$t re#ardless of w'at
it means in non&software en#ineerin# disci!lines) After all" an( wor- t'at needs to be
done to -ee! a software s(stem at a le%el considered sefl to its sers will still 'a%e to
be carried ot re#ardless of t'e name it is #i%en)
1.4 Definitions of Software Maintenance
As a reslt of t'e abo%e" attem!ts 'a%e been made to de%elo! a more com!re'ensi%e
definition of maintenance w'ic' wold be a!!ro!riate for se wit'in t'e conte$t of
software s(stems) Some definitions focs on t'e !articlar acti%ities carried ot drin#
maintenance" for e$am!le" Accordin# to Martin and McClre (569:)" software
maintenance mst be !erformed in order to
Correct errors
Correct desi#n flaws
Interface wit' ot'er s(stems
Ma-e en'ancements
Ma-e necessar( c'an#es to t'e s(stem
Ma-e c'an#es in files or databases
Im!ro%e t'e desi#n
Con%ert !ro#rams so t'at different 'ardware" software" s(stem featres" and
telecommnications facilities can be sed
Ot'ers insist on a #eneral %iew w'ic' considers software maintenance as *an( wor- t'at
is nderta-en after deli%er( of a software s(stem+" for e$am!le:
0) ) ) c'an#es t'at 'a%e to be made to com!ter !ro#rams after t'e( 'a%e been deli%ered
to t'e cstomer or ser)0 (Martin and McClre 569:))
0Maintenance co%ers t'e life of a software s(stem from t'e time it is installed ntil it is
!'ased ot)0(%on Ma(r'aser 566;))
T'e !roblem wit' t'ese definitions is t'at t'e( fail to indicate w'at is actall( done
drin# maintenance) Also t'e common t'eme of t'e abo%e definitions is t'at maintenance
is an 0after&t'e&fact0 acti%it() <ased on t'ese definitions" no maintenance acti%ities occr
drin# t'e software de%elo!ment effort (t'e !re&deli%er( sta#e of t'e life c(cle of a
software s(stem)) Maintenance occrs after t'e !rodct is in o!eration (drin# t'e !ost&
deli%er( sta#e)) Sc'neiderwind (569=) belie%es t'at maintenance is difficlt becase of
t'is s'ort&si#'ted %iew t'at maintenance is a !ostdeli%er( acti%it() 4rin# de%elo!ment
little consideration is made to t'e maintenance !'ase w'ic' is to follow" t'e de%elo!ers
considerin# t'eir wor- done once t'e s(stem is 'anded o%er to sers)
Ot'er !ers!ecti%es inclde:
t'e 7b#&fi$in#7 %iew w'ic' considers software maintenance as an acti%it( in%ol%in# t'e
detection and correction of errors fond in !ro#rams"
t'e 7need&to&ada!t7 %iew w'ic' sees maintenance as a acti%it( w'ic' entails c'an#in# t'e
software w'en its o!erational en%ironment or ori#inal re2irement c'an#es)
t'e 7s!!ort7 to sers %iew w'ere maintenance of software is seen as !ro%idin# a ser%ice
to sers of t'e s(stem)
T'e IEEE software maintenance standard" IEEE ST4 5>56&566:" w'ic' draws on t'ese
different %iews" defines software maintenance as:
Modification of a software !rodct after deli%er(" to correct falts" to im!ro%e
!erformance or ot'er attribtes" or to ada!t t'e !rodct to a modified en%ironment (?an
Edelstein 566:))
Can also be defined as"
Maintenance is t'e acti%it( associated wit' -ee!in# o!erational com!ter s(stems
continosl( in tne wit' re2irements of sers @ data !rocessin# o!eration)
Software Maintenance is an( wor- done to a com!ter !ro#ram after its first installation
and im!lementation in an o!erational en%ironment
T'e maintenance of software s(stems is moti%ated b( a nmber of factors:
To !ro%ide continit( of ser%ice: T'is entails fi$in# b#s" reco%erin# from failres" and
accommodatin# c'an#es in t'e o!eratin# s(stem and 'ardware"
To s!!ort mandator( !#rades: T'ese are sall( cased b( c'an#es in #o%ernment
re#lations" and also b( attem!ts to maintain a com!etiti%e ed#e o%er ri%al !rodcts)
To s!!ort ser re2ests for im!ro%ements: E$am!les inclde en'ancement of
fnctionalit(" better !erformance and cstomisation to local wor-in# !atterns)
To facilitate ftre maintenance wor-: T'is sall( in%ol%es code and database
restrctrin#" and !datin# docmentation)
1.5 Maintenance image pro!ems
T'e inclsion of t'e word maintenance in t'e term software maintenance 'as been lin-ed
to t'e ne#ati%e ima#e associated wit' t'e area) 8i##ins (5699) describes t'e !roblem:
)))!ro#rammers" ))tend to t'in- of !ro#ram de%elo!ment as a form of !AAle sol%in#" and
it is reassrin# to t'eir e#o w'en t'e( mana#e to sccessfll( com!lete a difficlt section
of code) Software maintenance" on t'e ot'er 'and" entails %er( little new creation and is
t'erefore cate#orised as dll" ne$citin# detecti%e wor-)
Similarl(" Sc'neidewind (569=) contends t'at to wor- in maintenance 'as been a-in to
'a%in# bad breat') Frt'er" some at'ors ar#e t'at t'e #eneral lac- of consenss on
software maintenance terminolo#( 'as also contribted to t'e ne#ati%e ima#e associated
wit' it)
2. Wh" is Software Maintenance necessar"
2.1 #$er$iew
In order to answer t'is 2estion we need to consider w'at 'a!!ens w'en t'e s(stem is
deli%ered to t'e sers) T'e sers o!erate t'e s(stem and ma( find t'in#s wron# wit' it" or
identif( t'in#s t'e( wold li-e to see added to it) ?ia mana#ement feedbac- t'e
maintainer ma-es t'e a!!ro%ed corrections or im!ro%ements and t'e im!ro%ed s(stem is
deli%ered to t'e sers) T'e c(cle t'en re!eats itself" t's !er!etatin# t'e loo! of
maintenance and e$tendin# t'e life of t'e !rodct) In most cases t'e maintenance !'ase
ends ! bein# t'e lon#est !rocess of t'e entire life c(cle" and so far otwei#'s t'e
de%elo!ment !'ase in terms of time and cost) ErrorB Reference sorce not fond) s'ows
t'e lifec(cle of maintenance on a software !rodct and w'( (t'eoreticall() it ma( be
ne%er endin#)
Fi#re 5)5 T'e Maintenance .ifec(cle
.e'man7s (569;) first two laws of software e%oltion 'el! e$!lain w'( t'e O!erations
and Maintenance !'ase can be t'e lon#est of t'e life&c(cle !rocesses) 8is first law is t'e
.aw of Continin# C'an#e" w'ic' states t'at a s(stem needs to c'an#e in order to be
sefl) T'e second law is t'e .aw of Increasin# Com!le$it(" w'ic' states t'at t'e
strctre of a !ro#ram deteriorates as it e%ol%es) O%er time" t'e strctre of t'e code
de#rades ntil it becomes more cost&effecti%e to rewrite t'e !ro#ram)
3. %"pes of Software Maintenance
In order for a software s(stem to remain sefl in its en%ironment it ma( be necessar( to
carr( ot a wide ran#e of maintenance acti%ities !on it) Swanson (56=C) was one of t'e
first to e$amine w'at reall( 'a!!ens drin# maintenance and was able to identif( t'ree
different cate#ories of maintenance acti%it()
3.1 &orrecti$e
C'an#es necessitated b( actal errors (defects or residal 0b#s0) in a s(stem are termed
correcti%e maintenance) T'ese defects manifest t'emsel%es w'en t'e s(stem does not
o!erate as it was desi#ned or ad%ertised to do)
A defect or *b#+ can reslt from desi#n errors" lo#ic errors and codin# errors) 4esi#n
errors occr w'en for e$am!le c'an#es made to t'e software are incorrect" incom!lete"
wron#l( commnicated or t'e c'an#e re2est misnderstood) .o#ic errors reslt from
in%alid tests and conclsions" incorrect im!lementation of desi#n s!ecification" falt(
lo#ic flow or incom!lete test data) Codin# errors are cased b( incorrect im!lementation
of detailed lo#ic desi#n and incorrect se of t'e sorce code lo#ic) 4efects are also
cased b( data !rocessin# errors and s(stem !erformance errors) All t'ese errors"
sometimes called *residal errors+ or *b#s+ !re%ent t'e software from conformin# to its
a#reed s!ecification)
In t'e e%ent of a s(stem failre de to an error" actions are ta-en to restore o!eration of
t'e software s(stem) T'e a!!roac' 'ere is to locate t'e ori#inal s!ecifications in order to
determine w'at t'e s(stem was ori#inall( desi#ned to do) 8owe%er" de to !ressre from
mana#ement" maintenance !ersonnel sometimes resort to emer#enc( fi$es -nown as
*!atc'in#+) T'e ad 'oc natre of t'is a!!roac' often #i%es rise to a ran#e of !roblems
t'at inclde increased !ro#ram com!le$it( and nforeseen ri!!le effects)
Increased !ro#ram com!le$it( sall( arises from de#eneration of !ro#ram strctre
w'ic' ma-es t'e !ro#ram increasin#l( difficlt" if not im!ossible" to com!re'end) T'is
state of affairs can be referred to as t'e *s!a#'etti s(ndrome+ or *software fati#e+)
Dnforeseen ri!!le effects im!l( a c'an#e to one !art of a !ro#ram ma( affect ot'er
sections in an n!redictable fas'ion) T'is is often de to lac- of time to carr( ot a
t'oro#' *im!act anal(sis+ before effectin# t'e c'an#e)
Correcti%e maintenance 'as been estimated to accont for >;E of all maintenance
acti%ities)
:)> Ada!ti%e
An( effort t'at is initiated as a reslt of c'an#es in t'e en%ironment in w'ic' a software
s(stem mst o!erate is termed ada!ti%e c'an#e) Ada!ti%e c'an#e is a c'an#e dri%en b(
t'e need to accommodate modifications in t'e en%ironment of t'e software s(stem"
wit'ot w'ic' t'e s(stem wold become increasin#l( less sefl ntil it became obsolete)
T'e term en%ironment in t'is conte$t refers to all t'e conditions and inflences w'ic' act
from otside !on t'e s(stem" for e$am!le bsiness rles" #o%ernment !olicies" wor-
!atterns" software and 'ardware o!eratin# !latforms) A c'an#e to t'e w'ole or !art of t'is
en%ironment will warrant a corres!ondin# modification of t'e software)
Dnfortnatel(" wit' t'is t(!e of maintenance t'e ser does not see a direct c'an#e in t'e
o!eration of t'e s(stem" bt t'e software maintainer mst e$!end resorces to effect t'e
c'an#e) T'is tas- is estimated to consme abot >FE of t'e total maintenance acti%it()
:): 1erfecti%e
T'e t'ird widel( acce!ted tas- is t'at of !erfecti%e maintenance) T'is is actall( t'e most
common t(!e of maintenance encom!assin# en'ancements bot' to t'e fnction and t'e
efficienc( of t'e code and incldes all c'an#es" insertions" deletions" modifications"
e$tensions" and en'ancements made to a s(stem to meet t'e e%ol%in# andGor e$!andin#
needs of t'e ser) A sccessfl !iece of software tends to be sb/ected to a sccession of
c'an#es resltin# in an increase in its re2irements) T'is is based on t'e !remise t'at as
t'e software becomes sefl" t'e sers tend to e$!eriment wit' new cases be(ond t'e
sco!e for w'ic' it was initiall( de%elo!ed) E$!ansion in re2irements can ta-e t'e form
of en'ancement of e$istin# s(stem fnctionalit( or im!ro%ement in com!tational
efficienc()
As t'e !ro#ram contines to #row wit' eac' en'ancement t'e s(stem e%ol%es from an
a%era#e&siAed !ro#ram of a%era#e maintainabilit( to a %er( lar#e !ro#ram t'at offers
#reat resistance to modification) 1erfecti%e maintenance is b( far t'e lar#est consmer of
maintenance resorces" estimates of arond F;E are not ncommon)
T'e cate#ories of maintenance abo%e were frt'er defined in t'e 566: IEEE Standard on
Software Maintenance (IEEE 5>56 566:) w'ic' #oes on to define a fort' cate#or()
:)H 1re%enti%e
T'e lon#&term effect of correcti%e" ada!ti%e and !erfecti%e c'an#e is e$!ressed in
.e'man7s law of increasin# entro!(:
As a lar#e !ro#ram is continosl( c'an#ed" its com!le$it(" w'ic' reflects deterioratin#
strctre" increases nless wor- is done to maintain or redce it) (.e'man 569F))
T'e IEEE defined !re%entati%e maintenance as 0maintenance !erformed for t'e !r!ose
of !re%entin# !roblems before t'e( occr0 (IEEE 5>56 566:)) T'is is t'e !rocess of
c'an#in# software to im!ro%e its ftre maintainabilit( or to !ro%ide a better basis for
ftre en'ancements)
T'e !re%entati%e c'an#e is sall( initiated from wit'in t'e maintenance or#anisation
wit' t'e intention of ma-in# !ro#rams easier to nderstand and 'ence facilitate ftre
maintenance wor-) 1re%enti%e c'an#e does not sall( #i%e rise to a sbstantial increase
in t'e baseline fnctionalit()
1re%enti%e maintenance is rare (onl( abot FE) t'e reason bein# t'at ot'er !ressres tend
to !s' it to t'e end of t'e 2ee) For instance" a demand ma( come to de%elo! a new
s(stem t'at will im!ro%e t'e or#anisationIs com!etiti%eness in t'e mar-et) T'is will
li-el( be seen as more desirable t'an s!endin# time and mone( on a !ro/ect t'at deli%ers
no new fnction) Still" it is eas( to see t'at if one considers t'e !robabilit( of a software
nit needin# c'an#e and t'e time !ressres t'at are often !resent w'en t'e c'an#e is
re2ested" it ma-es a lot of sense to antici!ate c'an#e and to !re!are accordin#l()
T'e most com!re'ensi%e and at'oritati%e std( of software maintenance was condcted
b( <) 1) .ientA and E) <) Swanson (569;)) Fi#re 5)> de!icts t'e distribtion of
maintenance acti%ities b( cate#or( b( !ercenta#e of time from t'e .ientA and Swanson
std( of some H9= software or#anisations) Clearl(" correcti%e maintenance (t'at is" fi$in#
!roblems and rotine deb##in#) is a small !ercenta#e of o%erall maintenance costs"
Martin and McClre (569:) !ro%ide similar data)
:)F Maintenance as On#oin# S!!ort
T'is cate#or( of maintenance wor- refers to t'e ser%ice !ro%ided to satisf( non&
!ro#rammin# related wor- re2ests) On#oin# s!!ort" alt'o#' not a c'an#e in itself" is
essential for sccessfl commnication of desired c'an#es) T'e ob/ecti%es of on#oin#
s!!ort inclde effecti%e commnication between maintenance and end ser !ersonnel"
trainin# of end&sers and !ro%idin# bsiness information to sers and t'eir or#anisations
to aid decision ma-in#)
Effecti%e commnication is essential as maintenance is !robabl( t'e most cstomer&
intensi%e !art of t'e software life c(cle" since a #reater !ro!ortion of maintenance effort
is s!ent !ro%idin# en'ancements re2ested b( cstomers t'an is s!ent on ot'er t(!es of
s(stem c'an#e) Jood cstomer relations are im!ortant for se%eral reasons and can lead to
a redction in t'e misinter!retation of sers c'an#e re2ests" a better nderstandin# of
sers7 bsiness needs and increased ser in%ol%ement in t'e maintenance !rocess) Failre
to ac'ie%e t'e re2ired le%el of commnication between t'e maintenance or#anisation
and t'ose affected b( t'e software c'an#es ma( e%entall( lead to software failre)
Trainin# of end sers & t(!ical ser%ices !ro%ided b( t'e maintenance or#anisation inclde
manals" tele!'one s!!ort " 'el! des-" on&site %isits" informal s'ort corses" and ser
#ro!s)
<siness information & sers need %arios t(!es of timel( and accrate bsiness
information (for e$am!le" time" cost" resorce estimates) to enable t'em ta-e strate#ic
bsiness decisions) Kestions sc' as *s'old we en'ance t'e e$istin# s(stem or re!lace
it com!letel(+ ma( need to be considered)
4. %he Importance of &ategorising Software &hanges
H)5 O%er%iew
In !rinci!le" software maintenance acti%ities can be classified indi%idall() In !ractice"
'owe%er" t'e( are often intertwined) For e$am!le" in t'e corse of modif(in# a !ro#ram
de to t'e introdction of a new o!eratin# s(stem (ada!ti%e c'an#e)" obscre 7b#s7 ma(
be introdced) T'e b#s 'a%e to be traced and dealt wit' (correcti%e maintenance))
Similarl(" t'e introdction of a more efficient sortin# al#orit'm into a data !rocessin#
!ac-a#e (!erfecti%e maintenance) ma( re2ire t'at t'e e$istin# !ro#ram code be
restrctred (!re%enti%e maintenance)) Fi#re 5): de!icts t'e !otential relations between
t'e different t(!es of software c'an#e) 4es!ite t'e o%erla!!in# natre of t'ese c'an#es"
t'ere are se%eral reasons w'( a #ood nderstandin# of t'e distinction between t'em is
im!ortant)
Firstl(" it allows mana#ement to set !riorities for c'an#e re2ests) Some c'an#es re2ire
a faster res!onse t'an ot'ers) Secondl(" t'ere are limitations to software c'an#e) Ideall(
c'an#es are im!lemented as t'e need for t'em arises) In !ractice" 'owe%er t'is is not
alwa(s !ossible for se%eral reasons:
Resorce .imitations: Some of t'e ma/or 'indrances to t'e 2alit( and !rodcti%it( of
maintenance acti%ities are t'e lac- of s-illed and trained maintenance !ro#rammers and
t'e sitable tools and en%ironment to s!!ort t'eir wor-) Cost ma( also be an isse)
Kalit( of t'e e$istin# s(stem: In some 7old7 s(stems" t'is can be so !oor t'at an( c'an#e
can lead to n!redictable ri!!le effects and a !otential colla!se of t'e s(stem)
Or#anisational strate#(: T'e desire to be on a !ar wit' ot'er or#anisations" es!eciall(
ri%als" can be a #reat determinant of t'e siAe of a maintenance bd#et)
Inertia: T'e resistance to c'an#e b( sers ma( !re%ent modification to a software
!rodct" 'owe%er im!ortant or !otentiall( !rofitable sc' c'an#e ma( be)
T'irdl( software is often sb/ect to incremental release w'ere c'an#es made to a
software !rodct are not alwa(s done all to#et'er) T'e c'an#es ta-e !lace incrementall("
wit' minor c'an#es sall( im!lemented w'ile a s(stem is in o!eration) Ma/or
en'ancements are sall( !lanned and incor!orated" to#et'er wit' ot'er minor c'an#es"
in a new release or !#rade) T'e c'an#e introdction mec'anism also de!ends on
w'et'er t'e software !ac-a#e is bes!o-e or off&t'e&s'elf) Wit' bes!o-e software" c'an#e
can often be effected as t'e need for it arises) For off&t'e&s'elf !ac-a#es" sers normall(
'a%e to wait for t'e ne$t !#rade)
Swanson7s definitions allow t'e software maintenance !ractitioner to be able to tell t'e
ser t'at a certain !ortion of a maintenance or#anisationIs efforts is de%oted to ser&
dri%en or en%ironment&dri%en re2irements) T'e ser re2irements s'old not be bried
wit' ot'er t(!es
Fi# 5):) T'e Relations'i! between t'e different t(!es of software c'an#e
of maintenance) T'e !oint 'ere is t'at t'ese t(!es of !dates are not correcti%e in natre
Lt'e( are im!ro%ements and no matter w'ic' definitions are sed" it is im!erati%e to
discriminate between corrections and en'ancements)
<( std(in# t'e t(!es of maintenance acti%ities abo%e it is clear t'at re#ardless of w'ic'
tools and de%elo!ment model is sed" maintenance is needed) T'e cate#ories clearl(
indicate t'at maintenance is more t'an fi$in# b#s) T'is %iew is s!!orted b( Mones
(5665)" w'o comments t'at *or#anisations lm! en'ancements and t'e fi$in# of b#s
to#et'er+) 8e #oes on to sa( t'at t'is distorts bot' acti%ities and leads to confsion and
mista-es in estimatin# t'e time it ta-es to im!lement c'an#es and bd#ets) E%en worse"
t'is 0lm!in#0 !er!etates t'e notion t'at maintenance is fi$in# b#s and mista-es)
<ecase man( maintainers do not se maintenance cate#ories" t'ere is confsion and
misinformation abot maintenance)
5. A &omparison etween De$e!opment and Maintenance
F)5 O%er%iew
Alt'o#' maintenance cold be re#arded as a contination of de%elo!ment" t'ere is a
fndamental difference between t'e two acti%ities) T'e constraints t'at t'e e$istin#
s(stem im!oses on maintenance #i%es rise to t'is difference) For e$am!le" in t'e corse
of desi#nin# an en'ancement" t'e desi#ner needs to in%esti#ate t'e crrent s(stem to
abstract t'e arc'itectral and t'e low&le%el desi#ns) T'is information is t'en sed to
ascertain 'ow t'e c'an#e can be accommodated
!redict t'e !otential ri!!le effect of t'e c'an#e
determine t'e s-ills and -nowled#e re2ired to do t'e /ob
To e$!lain t'e difference between new de%elo!ment and software maintenance frt'er"
Mones (569C) !ro%ides an interestin# analo#(:
*T'e tas- of addin# fnctional re2irements to e$istin# s(stems can be li-ened to t'e
arc'itectral wor- of addin# a new room to an e$istin# bildin#) T'e desi#n will be
se%erel( constrained b( t'e e$istin# strctre" and bot' t'e arc'itect and t'e bilders
mst ta-e care not to wea-en t'e e$istin# strctre w'en additions are made) Alt'o#'
t'e costs of t'e new room sall( will 'e lower t'an t'e costs of constrctin# an entirel(
new bildin#" t'e costs !er s2are foot ma( be mc' 'i#'er becase of t'e need to
remo%e e$istin# walls" rerote !lmbin# and electrical circits and ta-e s!ecial care to
a%oid disr!tin# t'e crrent site+" (2oted in Corbi 5696))
C) T'e Cost of Maintenance
C)5 O%er%iew
Alt'o#' t'ere is no real a#reement on t'e actal costs" sfficient data e$ist to indicate
t'at maintenance does consme a lar#e !ortion of o%erall software lifec(cle costs) Art'r
(5699) states t'at onl( a 2arter to a t'ird of all lifec(cle costs are attribted to software
de%elo!ment" and t'at some C=E of lifec(cle costs are e$!ended in t'e o!erations and
maintenance !'ase of t'e life c(cle) Mones (566H) states t'at maintenance will contine to
#row and become t'e !rimar( wor- of t'e software indstr() Table 5)> (Art'r 5699)
!ro%ides a sam!le of data com!lied b( %arios !eo!le and or#anisations re#ardin# t'e
!ercenta#e of lifec(cle costs de%oted to maintenance) T'ese data were collected in t'e
late 56=;s" !rior to all t'e software en#ineerin# inno%ations" met'ods" and tec'ni2es t'at
!r!ort to decrease o%erall costs)
8owe%er" des!ite software en#ineerin# inno%ations" recent literatre s##ests t'at
maintenance is #ainin# more notoriet( becase of its increasin# costs) A researc'
mar-etin# firm" t'e Jartner Jro!" estimated t'at D)S) cor!orations alone s!end o%er N:;
billion annall( on software maintenance" and t'at in t'e 566;s" 6FE of lifec(cle costs
wold #o to maintenance (Moad 566; Fi#re 5)H)) Clearl(" maintenance is costl(" and t'e
costs are increasin#) All t'e inno%ati%e software en#ineerin# efforts from t'e 56=;s and
569;s 'a%e not redced lifec(cle costs) Sr%e( Oear Maintenance (E)
Cannin# 56=> C;
<oe'm56=: H;&9;
deRoseGN(man 56=C C;&=;
Mills 56=C =F
Pei-owitA 56=6 C=
Cas'man and 8olt 56=6 C;&9;
Table 5)> Maintenance Costs as a 1ercenta#e of Total Software .ife&c(cle Costs
Toda( !ro#rammers7 salaries consme t'e ma/orit( of t'e software bd#et" and most of
t'eir time is s!ent on maintenance as it is a labor intensi%e acti%it() As a reslt"
or#anisations 'a%e seen t'e o!erations and maintenance !'ase of t'e software life c(cle
consme more and more resorces o%er time)
Ot'ers attribte risin# maintenance costs to t'e a#e and lac- of strctre of t'e software)
Osborne and C'i-ofs-( (566;) state t'at mc' of toda(7s software is ten to fifteen (ears
old" and were created wit'ot benefit of t'e best desi#n and codin# tec'ni2es) T'e reslt
is !oorl( desi#ned strctres" !oor codin#" !oor lo#ic" and !oor docmentation for t'e
s(stems t'at mst be maintained)

Fi#re 5)H T'e 1ercenta#e of Software life&c(cle costs de%oted to maintenance)
O%er =FE of maintenance costs are for !ro%idin# en'ancements in t'e form of ada!ti%e
and !erfecti%e maintenance) T'ese en'ancements are si#nificantl( more e$!ensi%e to
com!lete t'an corrections as t'e( re2ire ma/or redesi#n wor- and considerabl( more
codin# t'an a correcti%e action) T'e reslt is t'at t'e ser dri%en en'ancements
(im!ro%ements) dominate t'e costs o%er t'e life c(cle)
Se%eral later stdies confirm t'at .ientA and Swanson7s data from 569; was still accrate
in 566;) Table 5): smmarises data from se%eral researc'ers and s'ows t'at
noncorrecti%e wor- ran#es from =9E to 9HE of t'e o%erall effort" t'erefore t'at t'e
ma/orit( of maintenance costs are bein# s!ent on en'ancements) Maintenance is
e$!ensi%e t'erefore becase re2irements and en%ironments c'an#e and t'e ma/orit( of
maintenance costs are dri%en b( sers)Maintenance Cate#or( .ientA @ Swanson
569; <all
569= 4e-la%a
566; Abran
566;
Correcti%e >>E 5=E 5CE >5E
Non&correcti%e =9E 9:E 9HE =6E
Table 5): 1ercenta#e effort s!ent on Correcti%e and Non&Correcti%e maintenance
T'e sitation at t'e trn of t'e millennim s'ows little si#n of im!ro%ement)
T'e Maintenance <d#et
Normall(" after com!letin# a len#t'( and costl( software de%elo!ment effort"
or#anisations do not want to de%ote si#nificant resorces to !ostdeli%er( acti%ities)
4efinin# w'at is meant b( *a si#nificant resorce+ is in itself !roblematic , 'ow mc'
s'old maintenance costQ
Dnderestimation of maintenance costs is !artl( 'man natre as de%elo!ers do not want
to belie%e t'at maintenance for t'e new s(stem will consme a si#nificant !ortion of
lifec(cle costs) T'e( 'o!e t'at t'e new s(stem will be t'e e$ce!tion to t'e norm as
modern software en#ineerin# tec'ni2es and met'ods were sed) T'erefore t'e software
maintenance !'ase of t'e life c(cle will not" b( definition" consme lar#e amonts of
mone() Accordin#l(" sfficient amonts of mone( are often not allocated for
maintenance) Wit' limited resorces" maintainers can onl( !ro%ide limited maintenance)
T'e lac- of financial resorces for maintenance is de in lar#e !art to t'e lac- of
reco#nition t'at 0maintenance0 is !rimaril( en'ancin# deli%ered s(stems rat'er t'an
correctin# b#s)
Anot'er factor inflencin# 'i#' maintenance costs is t'at needed items are often not
inclded initiall( in t'e de%elo!ment !'ase" sall( de to sc'edles or monetar(
constraints" bt are deferred ntil t'e o!erations and maintenance !'ase) T'erefore
maintainers end ! s!endin# a lar#e amont of t'eir time codin# t'e fnctions t'at were
dela(ed ntil maintenance) As a reslt de%elo!ment costs remain wit'in bd#et bt
maintenance costs increase)
As can be seen from Table 5):" t'e maintenance cate#ories are !articlarl( sefl w'en
tr(in# to e$!lain t'e real costs of maintenance) If or#anisations 'a%e t'is data" t'e( will
nderstand w'( maintenance is e$!ensi%e and will be able to defend t'eir estimates of
time to com!lete tas-s and resorces re2ired)
) A Software Maintenance Framewor-
'.1 #$er$iew
To a lar#e e$tent t'e re2irement for software s(stems to e%ol%e in order to accommodate
c'an#in# ser needs contribtes to t'e 'i#' maintenance cost) 8owe%er" t'ere are ot'er
factors w'ic' contribte indirectl( to t'is b( 'inderin# maintenance acti%ities) A Software
Maintenance Framewor- (w'ic' is a deri%ati%e of t'e Software Maintenance Framewor-
!ro!osed b( 8awort' et al) 566>) will be sed to discss some of t'e factors t'at
contribte to t'e maintenance c'allen#e) T'e elements of t'is framewor- are t'e ser
re2irements" or#anisational and o!erational en%ironments" maintenance !rocess"
maintenance !ersonnel" and t'e software !rodct (Table 5)H))
Com!onent Featre
5) Dsers @ re2irements Re2ests for additional fnctionalit(" error correction and
im!ro%e maintainabilit(
Re2est for non&!ro#rammin# related s!!ort
>) Or#anisational en%ironment C'an#e in !olicies
Com!etition in t'e mar-et !lace
:) O!erational en%ironment 8ardware inno%ations
Software inno%ations
H) Maintenance !rocess Ca!trin# re2irements
?ariation in !ro#rammin# and wor-in# !ractices
1aradi#m s'ift
Error detection and correction
F) Software !rodct Matrit( and difficlt( of a!!lication domain
Kalit( of docmentation
Malleabilit( of !ro#rams
Com!le$it( of !ro#rams
1ro#ram strctre
In'erent 2alit(
C) Maintenance !ersonnel Staff trno%er
4omain e$!ertise
Table: Com!onents of t'e Software Maintenance Framewor-
=)> Dsers and t'eir Re2irements
Dsers often 'a%e little nderstandin# of software maintenance and so can be ns!!orti%e
of t'e maintenance !rocess) T'e( ma( ta-e t'e %iew t'at
Software maintenance is li-e 'ardware maintenance
C'an#in# software is eas(
C'an#es cost too mc' and ta-e too lon#
Dsers ma( be naware t'at t'eir re2est
ma( in%ol%e ma/or strctral c'an#es to t'e software w'ic' ma( ta-e time to im!lement
mst be feasible" desirable" !rioritised" sc'edled and resorced
ma( conflict a#ainst one anot'er or a#ainst com!an( !olic( sc' t'at it is ne%er
im!lemented
=): Or#anisational and O!erational En%ironment
An en%ironmental factor is a factor w'ic' acts !on t'e !rodct from otside and
inflences its form or o!eration) T'e two cate#ories of en%ironment are
T'e or#anisational en%ironment & e)#) bsiness rles" #o%ernment re#lations" ta$ation
!olicies" wor- !atterns" com!etition in t'e mar-et !lace
T'e o!erational en%ironment & software s(stems e)#) o!eratin# s(stems" database
s(stems" com!ilers and 'ardware s(stems e)#) !rocessor" memor(" !eri!'erals
In t'is en%ironment t'e sc'edlin# of maintenance wor- can be !roblematic as r#ent
Rfi$esI alwa(s #o to t'e 'ead of t'e 2ee t's !settin# sc'edles and ne$!ected"
mandator( lar#e scale c'an#es will also need r#ent attention) Frt'er !roblems can stem
from t'e or#anisational en%ironment in t'at t'e maintenance bd#et is often nderfnded)

)H Maintenance 1rocess
T'e term !rocess 'ere refers to an( acti%it( carried ot or action ta-en eit'er b( a
mac'ine or maintenance !ersonnel drin# software maintenance) T'e facets of a
maintenance !rocess w'ic' affect t'e e%oltion of t'e software or contribte to
maintenance costs inclde
T'e difficlt( of ca!trin# c'an#e (and c'an#in#) re2irements & re2irements and ser
!roblems onl( become clearer w'en a s(stem is in se) Also sers ma( not be able to
e$!ress t'eir re2irements in a form nderstandable to t'e anal(st or !ro#rammer & t'e
7information #a!7) T'e re2irements and c'an#es e%ol%e" t'erefore t'e maintenance team
is alwa(s !la(in# *catc'&!+
?ariation in !ro#rammin# !ractice , t'is ma( !resent difficlties if t'ere is no
consistenc(" t'erefore standards or st(listic #idelines are often !ro%ided) Wor-in#
!ractices im!act on t'e wa( a c'an#e is effected) *Time to c'an#e+ can be ad%ersel(
affected b( *cle%er code+3 ndocmented assm!tions3 and ndocmented desi#n and
im!lementation decisions) After some time" !ro#rammers find it difficlt to nderstand
t'eir own code)
1aradi#m s'ift & older s(stems de%elo!ed !rior to t'e ad%ent of strctred !ro#rammin#
tec'ni2es ma( be difficlt to maintain) 8owe%er" e$istin# !ro#rams ma( be restrctred
or 7re%am!edI sin# tec'ni2es and tools e)#) strctred !ro#rammin#" ob/ect orientation"
'ierarc'ical !ro#ram decom!osition" reformatters and !rett(&!rinters)
Error detection and correction & error&free software is %irtall( non&e$istent) Software
!rodcts tend to 'a%e 7residal7 errors) T'e later t'ese errors are disco%ered t'e more
e$!ensi%e t'e( are to correct) T'e cost #ets e%en 'i#'er if t'e errors are detected drin#
t'e maintenance !'ase (Fi#re 5)F))
=)F Software 1rodct
As!ects of a software !rodct t'at contribte to t'e maintenance c'allen#e inclde
Matrit( and difficlt( of t'e a!!lication domain: T'e re2irements of a!!lications t'at
'a%e been widel( sed and well nderstood are less li-el( to nder#o sbstantial
modifications t'an t'ose t'at are still in t'eir infanc()
In'erent difficlt( of t'e ori#inal !roblem: For e$am!le" !ro#rams dealin# wit' sim!le
!roblems sc' as sortin# are ob%iosl( easier to 'andle t'an t'ose sed for more com!le$
com!tations sc' as weat'er forecastin#)
Kalit( of t'e docmentation: T'e lac- of !&to&date s(stems docmentation effects
maintenance !rodcti%it() Maintenance is difficlt to !erform becase of t'e need to
nderstand (or com!re'end) !ro#ram code) 1ro#ram nderstandin# is a labor&intensi%e
acti%it( t'at increases costs) I<M estimated t'at a !ro#rammer s!ends arond F;E of 'is
time in t'e area of !ro#ram anal(sis)
Malleabilit( of t'e !ro#rams: T'e malleable or 7soft7 natre of software !rodcts ma-es
t'em more %lnerable to ndesirable modifications t'an 'ardware items) Inad%ertent
software c'an#es ma( 'a%e n-nown and e%en fatal re!ercssions) T'is is !articlarl(
tre of 7safet(&related7 or 7safet(&critical7 s(stems)
In'erent 2alit(: T'e tendenc( for a s(stem to deca( as more c'an#es are nderta-en
im!lies t'at !re%enti%e maintenance needs to be nderta-en to restore order in t'e
!ro#rams)
=)C Maintenance 1ersonnel
T'is refers to indi%idals in%ol%ed in t'e maintenance of a software !rodct) T'e(
inclde maintenance mana#ers" anal(sts" desi#ners" !ro#rammers and testers) T'e as!ects
of !ersonnel t'at affect maintenance acti%ities inclde t'e followin#:
Staff trno%er: 4e to 'i#' staff trno%er man( s(stems end ! bein# maintained b(
indi%idals w'o are not t'e ori#inal at'ors t'erefore a sbstantial !ro!ortion of t'e
maintenance effort is s!ent on /st nderstandin# t'e code) Staff w'o lea%e ta-e
irre!laceable -nowled#e wit' t'em)
4omain e$!ertise: Staff ma( end ! wor-in# on a s(stem for w'ic' t'e( 'a%e neit'er t'e
s(stem domain -nowled#e nor t'e a!!lication domain -nowled#e) Maintainers ma(
t'erefore inad%ertentl( case t'e *ri!!le effect+) T'is !roblem ma( be worsened b( t'e
absence of docmentation or ot of date or inade2ate docmentation) A contrar(
sitation is w'ere a !ro#rammer becomes Rensla%edI to a certain a!!lication becase
s'eG'e is t'e onl( !erson w'o nderstands it)
Ob%iosl( t'e factors of !rodct" en%ironment" ser and maintenance !ersonnel do not
e$ist in isolation bt interact wit' one anot'er) T'ree ma/or t(!es of relation and
interaction t'at can be identified are !rodctGen%ironment" !rodctGser and
!rodctGmaintenance !ersonnel (Fi#re 5)C))
Relations'i! between !rodct and en%ironment & as t'e en%ironment c'an#es so mst t'e
!rodct in order to be sefl)
Relations'i! between !rodct and ser & in order for t'e s(stem to sta( sefl and
acce!table to its sers it also 'as to c'an#e to accommodate t'eir c'an#in# re2irements)
Interaction between !ersonnel and !rodct & t'e maintenance !ersonnel w'o im!lement
c'an#es also act as rece!tors of t'e c'an#es) T'at is" t'e( ser%e as t'e main a%ene b(
w'ic' c'an#es in t'e ot'er factors & ser re2irements" maintenance !rocess"
or#anisational and o!erational en%ironments & act !on t'e software !rodct) T'e natre
of t'e maintenance !rocess sed and t'e attribtes of t'e maintenance !ersonnel will
im!act !on t'e 2alit( of t'e c'an#e)
(. )otentia! So!utions to the Maintenance )ro!em
A nmber of !ossible soltions to maintenance !roblems 'a%e been s##ested" t'e(
inclde
<d#et and Effort Reallocation
Com!lete Re!lacement of t'e S(stem
Maintenance of t'e E$istin# S(stem
9)5 <d#et and Effort Reallocation
<ased on t'e obser%ation t'at software maintenance costs at least as mc' as new
de%elo!ment" some at'ors 'a%e !ro!osed t'at rat'er t'an allocatin# less resorce to
de%elo! nmaintainable or difficlt to maintain s(stems" more time and resorce s'old
be in%ested in t'e de%elo!ment , s!ecification and desi#n , of more maintainable
s(stems) 8owe%er" t'is is difficlt to !rse" and e%en if it was !ossible" wold not
address t'e !roblem of le#ac( s(stems t'at are alread( in)
9)> Com!lete Re!lacement of t'e S(stem
One mi#'t be tem!ted to s##est t'at *if maintainin# an e$istin# s(stem costs as mc' as
de%elo!in# a new one" t'en w'( not de%elo! a new s(stem from scratc'+) In !ractice of
corse it is not t'at sim!le as t'ere are costs and ris-s in%ol%ed) T'e or#anisation ma( not
be able to afford t'e ca!ital otla( and t'ere is no #arantee t'at t'e new s(stem will
fnction an( better t'an t'e old one) Additionall( t'e e$istin# s(stem re!resents a
%alable -nowled#e base t'at cold !ro%e sefl for t'e de%elo!ment of ftre s(stems
t'ereb( redcin# t'e c'ance of re&in%entin# t'e w'eel) It wold be nrealistic for an
or#anisation to !art wit' sc' as asset)
9): Maintenance of t'e e$istin# s(stem
In most maintenance sitations bd#et and effort reallocation is not !ossible and
com!letel( redesi#nin# t'e w'ole software s(stem is sall( ndesirable (bt
ne%ert'eless forced in some sitations)) Ji%en t'at t'ese a!!roac'es are beset wit'
!roblems" maintainin# t'e e$istin# s(stem is often t'e onl( alternati%e)
Maintenance cold be ac'ie%ed" albeit it in an *ad 'oc+ fas'ion b( ma-in# necessar(
modifications as R!atc'esI to t'e sorce code" often b( 'ittin# alien code R'ead&onI)
8owe%er t'is a!!roac' is fra#'t wit' difficlt( and is often ado!ted becase of time
!ressres) Correcti%e maintenance is almost alwa(s done in t'is wa( for t'e same reason)
An alternati%e and cost&effecti%e soltion is to a!!l( !re%entati%e maintenance)
1re%entati%e maintenance ma( ta-e se%eral forms" it ma(:
be a!!lied to t'ose sections of t'e software t'at are most often t'e tar#et for c'an#e (t'is
a!!roac' ma( be %er( cost effecti%e as it 'as been estimated t'at 9;E of c'an#es affect
onl( :;E of t'e code))
in%ol%e !datin# inaccrate docmentation
in%ol%e restrctrin#" re%erse en#ineerin# or t'e re&se of e$istin# software com!onents
Dnfortnatel( !re%enti%e maintenance is rare3 t'e reason bein# t'at ot'er !ressres tend
to !s' it to t'e end of t'e 2ee)
##AD *SI+, *M-
1. Mode!ing
5)5 W'at is Modelin# Q
A software de%elo!ment met'od consists of a modelin# lan#a#e and a !rocess) T'e
Dnified Modelin# .an#a#e (DM.) is called a modelin# lan#a#e" not a met'od) T'e
modelin# lan#a#e is t'e notation t'at met'ods se to e$!ress desi#ns) T'e !rocess
describes t'e ste!s ta-en in doin# a desi#n)
Models !ro%ide %arios !ers!ecti%es" w'en !t to#et'er will !ro%ide an o%erall %iew of
t'e s(stem) W'ile creatin# a model" for a #i%en le%el of abstraction" it is to be decided
w'ic' elements are to be inclded and w'ic' are to be e$clded) Some t(!e of notation
re!resents models %isall() T'e notation often ta-es t'e form of #ra!'ical s(mbols and
connections)
Models are bilt so t'at we can better nderstand t'e s(stem t'at we are de%elo!in#)
Models in software 'el! s to %isaliAe" s!ecif(" constrct and docment t'e artifacts of a
software intensi%e s(stem)
5)> 1rinci!les of Modelin#
S T'e c'oice of t'e ri#'t model is e$tremel( im!ortant since it decides t'e wa( in w'ic'
we deal wit' t'e !roblem
S T'e le%els of !recision for eac' model %ar(
S T'e best models are connected to realit(
S A sin#le model ma( not be able to re!resent all t'e details of a s(stem) A s(stem can be
re!resented b( a set of inde!endent models)
5): W'at is <siness Modelin#Q
DM. is not onl( sed for modelin# s(stem software bt also for modelin# t'e bsiness
!rocess) <siness modelin# is a tec'ni2e to model bsiness !rocesses) <siness models
!ro%ide wa(s of e$!ressin# t'e bsiness !rocesses in terms of bsiness acti%ities and
collaborati%e be'a%ior)
<siness modelin# is a tec'ni2e w'ic' will 'el! in findin# ot w'et'er we 'a%e
identified all t'e s(stem se cases as well as determinin# t'e bsiness %ale of t'e
s(stem)
W'( <siness Modelin#Q
T'e s(stem can !ro%ide %ale onl( if we -now 'ow it will be sed" w'o will se it and in
w'at circmstances it will be sed)
To ensre t'at cstomer&oriented soltions are bilt" we mst not o%erloo-
S t'e en%ironment in w'ic' t'ese s(stems will wor-
S t'e roles and res!onsibilities of t'e em!lo(ees sin# t'e s(stem
S t'e 0t'in#s0 t'at are 'andled b( t'e bsiness" as a basis for bildin# t'e s(stem
One of t'e #reat benefits of bsiness modelin# is to elicit better s(stem re2irements"
re2irements t'at will dri%e t'e creation of information s(stems t'at actall( fit in t'e
or#aniAation and t'at will indeed be sed b( end&sers)
>) Dnified 1rocess
>)5 W'at is Dnified 1rocessQ
A !rocess is a set of acti%ities intended to reac' a #oal) T'e in!ts to t'e software !rocess
are t'e needs of t'e bsiness and t'e ot!t will be t'e software !rodct)
We can se DM. wit' a nmber of software en#ineerin# !rocesses) T'e Dnified 1rocess
is one sc' lifec(cle a!!roac' well&sited to t'e DM.) T'e #oals of t'e Dnified 1rocess
are to enable t'e !rodction of 'i#'est 2alit( software t'at meets end&ser needs wit'
!redictable sc'edles and bd#ets) T'e Dnified 1rocess ca!tres some of t'e best crrent
software de%elo!ment !ractices in a form t'at is tailorable for a wide ran#e of !ro/ects
and or#aniAations) On t'e mana#ement side" t'e Dnified 1rocess !ro%ides a disci!lined
a!!roac' on 'ow to assi#n tas-s and res!onsibilities wit'in a software de%elo!ment
or#aniAation)
>)> Dnified 1rocess & Featres
T'e Dnified 1rocess ca!tres man( of modern software de%elo!ment7s best !ractices in a
form sitable for a wide ran#e of !ro/ects and or#aniAations:
S 4e%elo! software iterati%el( and incrementall()
S Mana#e re2irements)
S Dse com!onent&based arc'itectres)
T'e Dnified 1rocess is iterati%e" incremental" arc'itectre&centric" se&case dri%en)
a) Iterati%e
T'e de%elo!ment is iterati%e and in%ol%es a se2ence of ste!s and eac' iteration adds
some new information) Eac' iteration is e%alated and sed to !rodce in!t for t'e ne$t
iteration) T's" t'is !rocess !ro%ides continos feedbac- t'at im!ro%es t'e final
!rodct)
b) Incremental
T'e iterations are incremental in fnction) Eac' iteration bilds on t'e se cases
de%elo!ed in t'e !re%ios iterations)
c) Arc'itectre&Centric
T'e im!ortance of well defined basic s(stem arc'itectre is realiAed and is establis'ed in
t'e initial sta#e of t'e !rocess) T'e arc'itectral ble !rint ser%es as a solid basis a#ainst
w'ic' to !lan and mana#e software com!onent based de%elo!ment)
d) Dse Case dri%en
4e%elo!ment acti%ities nder t'e Dnified 1rocess are se case dri%en) T'e Dnified
!rocess !laces stron# em!'asis on bildin# s(stems based on a t'oro#' nderstandin#
of 'ow t'e deli%ered s(stem will be sed)
>): A brief otline of a t(!ical de%elo!ment !rocess
A t(!ical OO de%elo!ment !rocess is iterati%e and incremental) It 'as t'e followin#
sta#es:
Ince!tion
Elaboration
Constrction
Transition
A software s(stem is not released in a bi# ban# at t'e end of t'e !ro/ect bt is de%elo!ed
and released in !'ases) T'e constrction !'ase t(!icall( 'as man( iterations " in w'ic'
eac' iteration bilds !rodction 2alit( software" (tested and inte#rated) t'at satisfies a
sbset of !ro/ect re2irements)
>):)5 Ince!tion !'ase
4rin# t'e ince!tion !'ase" we de%elo! bsiness model for t'e !ro/ect) 4etermine
ro#'l( 'ow mc' it will cost and 'ow mc' it will earn)
T'e feasibilit( std( is !erformed as well as t'e o%erall sco!e and siAe of t'e !ro/ect is
determined drin# t'e ince!tion !'ase) T'e actors of t'e s(stem and t'eir interaction wit'
t'e s(stem are anal(Aed at a 'i#' le%el) Identif(in# all se cases and describin# im!ortant
se cases also 'a!!ens at t'is sta#e)
Ince!tion can ta-e man( forms) It ma( be as informal as a c'at in t'e cafeteria" or a fll&
fled#ed feasibilit( std( t'at ta-es wee-s)
At t'e end of t'e Ince!tion sta#e" t'e followin# ob/ecti%es are to be ac'ie%ed:
S Concrrence on t'e sco!e of t'e !ro/ect and t'e estimates
S Dnderstandin# of t'e re2irements
>):)> Elaboration !'ase
In t'e elaboration !'ase" a baseline arc'itectre is establis'ed" t'e !ro/ect !lan is
de%elo!ed and ris- assessment is also !erformed)
T'e ma/or t(!es of ris-s are
S Re2irements Ris-s
S Tec'nolo#ical Ris-s
S S-ills Ris-s
S 1olitical Ris-s
4ealin# wit' Re2irements Ris-s
Dse cases can be em!lo(ed to !ro%ide basis for commnication between cstomer and
de%elo!ers in !lannin# a !ro/ect
Dse case is a t(!ical interaction between ser and s(stem to ac'ie%e a #oal) E)#) as we
se ATM one se case will be & 4is!ense cas'" anot'er ma( be !rint recei!t" dis!la(
balance and so on)
S-eleton 4omain models can be drawn sin# OO tec'ni2es li-e DM.
Considerations for Wor-flow" Rlebase" Secrit( need to made
4ealin# wit' Tec'nolo#ical Ris-s
<ild !rotot(!es t'at tr( ot !ieces of tec'nolo#( t'at we !lan to se) e)#) if we are sin#
Ma%a and relational database" bild a sim!le a!!lication sin# t'ese) Tr( ot tools t'at
s!!ort or c'oice of tec'nolo#() S!end time #ettin# comfortable wit' t'em) Also"
consider 'ow eas( or difficlt it is to !ort to ot'er !latforms in ftre)
4ealin# wit' S-ills Ris-s
Ac2ire s-ills t'ro#' trainin# and mentorin#
Read rele%ant tec'nical boo-s
.oo- for !atterns
1attern is an idea t'at 'as been sefl in one !ractical conte$t and ma( !robabl( be sefl
in ot'ers
In t'e modelin# conte$t" t'e( can be loo-ed !on as e$am!le models
T'e( describe common wa(s of doin# t'in#s
T'e( are collected b( !eo!le w'o s!ot re!eatin# t'emes in anal(sis and desi#n
Eac' t'eme is described so t'at !eo!le can read it and see 'ow to a!!l( it)
T's" !atterns !romote rese)
4ealin# wit' 1olitical Ris-s
Trainin# on Effecti%e Team wor- can be of #reat 'el! 'ere)
T'e cost and sc'edle estimates can be comfortabl( made at t'is sta#e and create a !lan
for constrction)
1lannin# t'e Constrction !'ase
8a%e or cstomer cate#oriAe se cases into 'i#'" medim and low bsiness %ale
8a%e t'e de%elo!ers cate#oriAe se cases into 'i#'" medim and low ris-s& t'ese wold
reflect le%el of difficlt(" im!act on s(stem desi#n" lac- of ade2ate nderstandin# )))
Assmin# a fll( committed de%elo!er" estimate len#t' of time re2ired for eac' se
case& inclde anal(sis" desi#n" codin# nit testin#" inte#ration and docmentation)
4etermine or iteration len#t'& an iteration s'old be lon# eno#' for s to do se%eral
se cases)
Estimate effort in%ol%ed for eac' iteration& a!!l( load factors & e)#) we will ne%er 'a%e a
de%elo!er wit' no distractions & so difference between ideal time and realit( will be t'e
load factor)
4etermine or !ro/ect %elocit( & 'ow fast can we #o) T'is is 'ow mc' de%elo!ment can
we do in an iteration)
e)#) if we 'a%e C de%elo!ers" : wee- iteration len#t' and a load factor of >" we will 'a%e
6 ideal de%elo!er&wee-s !er iteration
4eal wit' Dse cases wit' 'i#' ris- first
8a%e a release !lan read(
Eac' iteration is a mini&!ro/ect in itself) It s'old end wit' s(stem tests to confirm t'at
t'e se cases 'a%e been bilt correctl( and a demo to t'e ser
Eac' iteration bilds on t'e se cases de%elo!ed in t'e !re%ios iterations& it is
incremental in natre
Eac' iteration will in%ol%e rewritin# some e$istin# code to ma-e it more fle$ible & it is
iterati%e in natre
Dse Refactorin# in iteratin# code
Test e$tensi%el(
Refactorin#
Software Entro!(: T'e !rinci!le of software entro!( s##ests t'at !ro#rams start off in a
well desi#ned state" bt as bits of fnctionalit( are added" t'e( lose t'eir strctre and
deform into a mass of s!a#'ettiB
Refactorin# is a tec'ni2e sed to redce t'e s'ort term !ain of redesi#nin#
It in%ol%es small ste!s li-e renamin# a met'od" consolidatin# similar met'ods into a
s!erclass and t'e li-e) Eac' ste! is tin( bt !erformin# t'ese ste!s can ma-e a
remar-able difference to t'e !ro#ram)
Test after eac' sc' ste!
4o not add new fnctionalit( and refactor at t'e same time
At t'e end of t'e elaboration
T'e se case model s'old be com!lete
Nonfnctional Re2irements s'old be elaborated
Software Arc'itectre s'old be described
Re%ised ris- list s'old be !resent
A !reliminar( ser manal (o!tional)
>):): Constrction !'ase
All t'e com!onents are de%elo!ed and t'e com!onents are inte#rated drin# t'e
constrction !'ase) All t'e featres are com!letel( tested drin# t'is sta#e) Resorces are
mana#ed and o!erations are controlled to o!timiAe cost" sc'edle and 2alit()
T'e constrction !'ase is incremental and iterati%e) It is incremental becase eac'
iteration bilds on t'e code de%elo!ed in t'e !re%ios iterations) It is iterati%e since eac'
iteration in%ol%es rewritin# some e$istin# code to ma-e it more fle$ible) Refactorin# is
done after e%er( iteration)
At t'e end of t'e constrction"
T'e !rodct s'old be stable and matre for release
Actal %erss !lanned e$!enditre s'old be acce!table
>):)H Transition !'ase
T'e ob/ecti%e of t'is !'ase is to transition t'e software !rodct to t'e ser commnit()
4e%elo!in# new releases" correctin# defects and o!timiAation of t'e software are !art of
t'is !'ase)
T'e acti%ities in t'is !'ase inclde
Dser Trainin#
Con%ersion of O!erational databases
Roll ot t'e !rodct to mar-etin# and sales
T'e ob/ecti%es of t'e transition !'ase are
Cstomer Satisfaction
Ac'ie%in# t'e concrrence of t'e sta-e'olders t'at t'e de!lo(ment baselines are
com!lete and consistent wit' t'e e%alation criteria
Ac'ie%in# final !rodct baseline ra!idl( in a cost effecti%e manner
:) Introdction to DM. T
T'e DM. ma( be sed to %isaliAe" s!ecif(" constrct and docment t'e artifacts of a
software&intensi%e s(stem)
T'e DM. is onl( a lan#a#e and so is /st one !art of a software de%elo!ment met'od)
T'e DM. is !rocess inde!endent" alt'o#' o!timall( it s'old be sed in a !rocess t'at
is se case dri%en" arc'itectre&centric" iterati%e" and incremental)
:)5 W'at is DM.
T'e Dnified Modelin# .an#a#e (DM.) is a robst notation t'at we can se to bild
OOA4 models) It is called so" since it was t'e nification" of t'e ideas from different
met'odolo#ies from t'ree ami#os , <ooc'" Rmba#' and Macobson)
T'e DM. is t'e standard lan#a#e for %isaliAin#" s!ecif(in#" constrctin#" and
docmentin# t'e artifacts of a software&intensi%e s(stem) It can be sed wit' all
!rocesses" t'ro#'ot t'e de%elo!ment life c(cle" and across different im!lementation
tec'nolo#ies)
T'e DM. combines t'e best from
4ata Modelin# conce!ts
<siness Modelin# (wor- flow)
Ob/ect Modelin#
Com!onent Modelin#
T'e DM. ma( be sed to
4is!la( t'e bondar( of a s(stem and its ma/or fnctions sin# se cases and actors
Illstrate se case realiAations wit' interaction dia#rams
Re!resent a static strctre of a s(stem sin# class dia#rams
Model t'e be'a%ior of ob/ects wit' state transition dia#rams
Re%eal t'e !'(sical im!lementation arc'itectre wit' com!onent @ de!lo(ment dia#rams
E$tend t'e fnctionalit( of t'e s(stem wit' stereot(!es
:)> E%oltion of DM.
One of t'e met'ods was t'e Ob/ect Modelin# Tec'ni2e (OMT)" de%ised b( Mames
Rmba#' and ot'ers at Jeneral Electric) It consists of a series of models & se case"
ob/ect" d(namic" and fnctional t'at combines to #i%e a fll %iew of a s(stem)
T'e <ooc' met'od was de%ised b( Jrad( <ooc' and de%elo!ed t'e !ractice of anal(Ain#
a s(stem as a series of %iews) It em!'asiAes anal(Ain# t'e s(stem from bot' a macro
de%elo!ment %iew and micro de%elo!ment %iew and it was accom!anied b( a %er(
detailed notation)
T'e Ob/ect&Oriented Software En#ineerin# (OOSE) met'od was de%ised b( I%ar
Macobson and focsed on t'e anal(sis of s(stem be'a%ior) It ad%ocated t'at at eac' sta#e
of t'e !rocess t'ere s'old be a c'ec- to see t'at t'e re2irements of t'e ser were bein#
met)
:): W'( Dnification
Eac' of t'ese met'ods 'ad t'eir stron# !oints and t'eir wea- !oints) Eac' 'ad its own
notation and its own tools) T'is made it %er( difficlt for de%elo!ers to c'oose t'e
met'od and notation t'at sited t'em and to se it sccessfll() New %ersions of some of
t'e met'ods were created" eac' drawin# on stren#t's of t'e ot'ers to a#ment t'eir
wea-er as!ects) T'is led to a #rowin# similarit( between t'e met'ods and 'ence t'e
Dnification)
:)H T'e DM. is com!osed of t'ree different !arts:
Model elements
4ia#rams
?iews
Model Elements
T'e model elements re!resent basic ob/ect&oriented conce!ts sc' as classes" ob/ects" and
relations'i!s)
Eac' model element 'as a corres!ondin# #ra!'ical s(mbol to re!resent it in t'e dia#rams)
4ia#rams
4ia#rams !ortra( different combinations of model elements)
For e$am!le" t'e class dia#ram re!resents a #ro! of classes and t'e relations'i!s" sc'
as association and in'eritance" between t'em)
T'e DM. !ro%ides nine t(!es of dia#ram & se case" class" ob/ect" state c'art" se2ence"
collaboration" acti%it(" com!onent" and de!lo(ment
?iews
?iews !ro%ide t'e 'i#'est le%el of abstraction for anal(Ain# t'e s(stem)
Eac' %iew is an as!ect of t'e s(stem t'at is abstracted to a nmber of related DM.
dia#rams)
Ta-en to#et'er" t'e %iews of a s(stem !ro%ide a !ictre of t'e s(stem in its entiret()
In t'e DM." t'e fi%e main %iews of t'e s(stem are
Dser
Strctral
<e'a%ioral
Im!lementation
En%ironment
n addition to model elements" dia#rams" and %iews" t'e DM. !ro%ides mec'anisms for
addin# comments" information" or semantics to dia#rams)
And it !ro%ides mec'anisms to ada!t or e$tend itself to a !articlar met'od" software
s(stem" or or#aniAation)
E$tensions of DM.
Stereot(!es can be sed to e$tend t'e DM. notational elements
Stereot(!es ma( be sed to classif( and e$tend associations" in'eritance relations'i!s"
classes" and com!onents
E$am!les
Class stereot(!es: bondar(" control" entit(
In'eritance stereot(!es: e$tend
4e!endenc( stereot(!es: ses
Com!onent stereot(!es: sbs(stem
:)F DM. 4ia#rams
:)F)5 Dse Case 4ia#rams
T'e se case dia#ram !resents an otside %iew of t'e s(stem
T'e se&case model consists of se&case dia#rams)
T'e se&case dia#rams illstrate t'e actors" t'e se cases" and t'eir relations'i!s)
Dse cases also re2ire a te$tal descri!tion (se case s!ecification)" as t'e %isal
dia#rams can7t contain all of t'e information t'at is necessar()
T'e cstomers" t'e end&sers" t'e domain e$!erts" and t'e de%elo!ers all 'a%e an in!t
into t'e de%elo!ment of t'e se&case model)
Creatin# a se&case model in%ol%es t'e followin# ste!s:
definin# t'e s(stem
identif(in# t'e actors and t'e se cases
describin# t'e se cases
definin# t'e relations'i!s between se cases and actors)
definin# t'e relations'i!s between t'e se cases
Dse Case:
4efinition: is a se2ence of actions a s(stem !erforms t'at (ields an obser%able reslt of
%ale to a !articlar actor)
Dse Case Namin#:
Dse Case s'old alwa(s be named in bsiness terms" !ic-in# t'e words from t'e
%ocablar( of t'e !articlar domain for w'ic' we are modelin# t'e s(stem) It s'old be
meanin#fl to t'e ser becase se case anal(sis is alwa(s done from serIs !ers!ecti%e)
It will be sall( %erbs or s'ort %erb !'rases)
Dse Case S!ecification s'all docment t'e followin#
<rief 4escri!tion
1recondition
Main Flow
Alternate Flow
E$ce!tional flows
1ost Condition
S!ecial Re2irements
Notation of se case

Actor:
4efinition: someone or somet'in# otside t'e s(stem t'at interacts wit' t'e s(stem
S An actor is e$ternal & it is not actall( !art of w'at we are bildin#" bt an interface
needed to s!!ort or se it)
S It re!resents an(t'in# t'at interacts wit' t'e s(stem)
Notation for Actor

Relation:
Two im!ortant t(!es of relation sed in Dse Case 4ia#ram
Inclde, An Inclde relations'i! s'ows be'a%ior t'at is common to one or more se
cases (Mandator()
Inclde relation reslts w'en we e$tract t'e common sb flows and ma-e it an se case
E$tend , An e$tend relations'i! s'ows o!tional be'a%ior (O!tional)
E$tend relation reslts sall( w'en we add a bit more s!ecialiAed featre to t'e alread(
e$istin# one" we sa( t'e se case < e$tends its fnctionalit( to se case A)
A s(stem bondar( rectan#le se!arates t'e clinic s(stem from t'e e$ternal actors)
An e$tend relations'i! indicates t'at one se case is a %ariation of anot'er) E$tend
notation is a dotted line" labeled UUe$tendVV" and wit' an arrow toward t'e base case)
T'e e$tension !oint" w'ic' determines w'en t'e e$tended case is a!!ro!riate" is written
inside t'e base case)
:)F)> Class 4ia#rams
Class dia#ram s'ows t'e e$istence of classes and t'eir relations'i!s in t'e strctral %iew
of a s(stem)
DM. modelin# elements in class dia#rams
Classes and t'eir strctre and be'a%ior
Relations'i!s
Association
A##re#ation
Com!osition
4e!endenc(
JeneraliAation G S!ecialiAation ( in'eritance relations'i!s)
Mlti!licit( and na%i#ation indicators
Role names
A class describes !ro!erties and be'a%ior of a t(!e of ob/ect)
Classes are fond b( e$aminin# t'e ob/ects in se2ence and collaboration dia#ram
A class is drawn as a rectan#le wit' t'ree com!artments
Classes s'old be named sin# t'e %ocablar( of t'e domain
Namin# standards s'old be created
e)#)" all classes are sin#lar nons startin# wit' a ca!ital letter
T'e be'a%ior of a class is re!resented b( its o!erations)
O!erations ma( be fond b( e$aminin# interaction dia#rams
T'e strctre of a class is re!resented b( its attribtes
Attribtes ma( be fond b( e$aminin# class definitions" t'e !roblem re2irements" and
b( a!!l(in# domain -nowled#e
Notation:
Class information: %isibilit( and sco!e
T'e class notation is a :&!iece rectan#le wit' t'e class name" attribtes" and o!erations)
Attribtes and o!erations can be labeled accordin# to access and sco!e) 8ere is a new"
e$!anded Order class)
Relations'i!
& Association
Association re!resents t'e !'(sical or conce!tal connection between two or more
ob/ects
An association is a bi&directional connection between classes
An association is s'own as a line connectin# t'e related classes
& A##re#ation
An a##re#ation is a stron#er form of relations'i! w'ere t'e relations'i! is between a
w'ole and its !arts
It is entirel( conce!tal and does not'in# more t'an distin#is'in# a Rw'oleI from t'e
R!artI)
It doesnIt lin- t'e lifetime of t'e w'ole and its !arts
An a##re#ation is s'own as a line connectin# t'e related classes wit' a diamond ne$t to
t'e class re!resentin# t'e w'ole

& Com!osition
Com!osition is a form of a##re#ation wit' stron# owners'i! and coincident lifetime as
t'e !art of t'e w'ole)

& Mlti!licit(
Mlti!licit( defines 'ow man( ob/ects !artici!ate in relations'i!s
Mlti!licit( is t'e nmber of instances of one class related to ONE instance of t'e ot'er
class
T'is table #i%es t'e most common mlti!licities)Mlti!licities Meanin#
;))5 Aero or one instance) T'e notation n ) ) m indicates n to m instances
;))T or T no limit on t'e nmber of instances (incldin# none)
5 e$actl( one instance
5))T at least one instance
For eac' association and a##re#ation" t'ere are two mlti!licit( decisions to ma-e: one
for eac' end of t'e relations'i!
Alt'o#' associations and a##re#ations are bi&directional b( defalt" it is often desirable
to restrict na%i#ation to one direction
If na%i#ation is restricted" an arrow'ead is added to indicate t'e direction of t'e
na%i#ation
& 4e!endenc(
A de!endenc( relations'i! is a wea-er form of relations'i! s'owin# a relations'i!
between a client and a s!!lier w'ere t'e client does not 'a%e semantic -nowled#e of t'e
s!!lier
A de!endenc( is s'own as a das'ed line !ointin# from t'e client to t'e s!!lier
JeneraliAation: is a relations'i! between a #eneral t'in# (called t'e s!er class or t'e
!arent) and a more s!ecific -ind of t'at t'in# (called t'e sbclass(es) or t'e c'ild))
& An association class is an association t'at also 'as class !ro!erties(or a class 'as
association !ro!erties)
& A constraint is a semantic relations'i! amon# model elements t'at s!ecifies conditions
and !ro!ositions t'at mst be maintained as tre: ot'erwise" t'e s(stem described b( t'e
model is in%alid
& An interface is a s!ecifier for t'e e$ternall( %isible o!erations of a class wit'ot
s!ecification of internal strctre) An interface is formall( e2i%alent to abstract class
wit' no attribtes and met'ods" onl( abstract o!erations)
A 2alifier is an attribte or set of attribtes w'ose %ales ser%e to !artition t'e set of
instances associated wit' an instance across an association)
:)F): Interaction 4ia#rams
Interaction dia#rams is sed to model t'e d(namic be'a%ior of t'e s(stem
Interaction dia#ram 'el!s s to identif( t'e classes and its met'ods
Interaction dia#rams describe 'ow se cases are realiAed as interactions amon# ob/ects
S'ow classes" ob/ects" actors and messa#es between t'em to ac'ie%e t'e fnctionalit( of
a Dse Case
T'ere are two t(!es of interaction dia#rams
Se2ence 4ia#ram
Collaboration 4ia#ram
Se2ence dia#ram: s'ow t'e interaction of ob/ects wit' res!ect to time
Se2ence dia#rams 'a%e two a$es
'oriAontal a$is re!resents t'e ob/ects in%ol%ed in a se2ence)
%ertical a$is re!resents t'e !assa#e of time
T'e followin# se2ence dia#ram realiAes a scenario of reser%in# a co!( of boo- in a
librar()
Collaboration dia#ram: s'ows t'e interaction of t'e ob/ects and also t'e #ro! of all
messa#es sent or recei%ed b( an ob/ect) T'is allows s to see t'e com!lete set of ser%ices
t'at an ob/ect mst !ro%ide)
T'e followin# collaboration dia#ram realiAes a scenario of reser%in# a co!( of boo- in a
librar(
4ifference between t'e Se2ence 4ia#ram and Collaboration 4ia#ram
Se2ence dia#rams: em!'asiAe t'e tem!oral as!ect of a scenario & t'e( focs on time)
Collaboration dia#rams: em!'asiAe t'e s!atial as!ect of a scenario & t'e( focs on 'ow
ob/ects are lin-ed)
:)F)H Acti%it( 4ia#ram
An acti%it( dia#ram is essentiall( a fanc( flowc'art) Acti%it( dia#rams and statec'art
dia#rams are related) W'ile a statec'art dia#ram focses attention on an ob/ect
nder#oin# a !rocess (or on a !rocess as an ob/ect)" an acti%it( dia#ram focses on t'e
flow of acti%ities in%ol%ed in a sin#le !rocess) T'e acti%it( dia#ram s'ows t'e 'ow t'ose
acti%ities de!end on one anot'er)
Acti%it( dia#rams can be di%ided into ob/ect swimlanes t'at determine w'ic' ob/ect is
res!onsible for w'ic' acti%it() A sin#le transition comes ot of eac' acti%it(" connectin# it
to t'e ne$t acti%it()
A transition ma( branc' into two or more mtall( e$clsi%e transitions) Jard
e$!ressions (inside W X) label t'e transitions comin# ot of a branc') A branc' and its
sbse2ent mer#e mar-in# t'e end of t'e branc' a!!ear in t'e dia#ram as 'ollow
diamonds)
A transition ma( for- into two or more !arallel acti%ities) T'e for- and t'e sbse2ent
/oin of t'e t'reads comin# ot of t'e for- a!!ear in t'e dia#ram as solid bars)
:)F)F State C'art 4ia#ram
A state c'art (transition) dia#ram is sed to s'ow
T'e life 'istor( of a #i%en class" secase" o!eration
T'e e%ents t'at case a transition from one state to anot'er
T'e actions t'at reslt from a state c'an#e
:)F)C Com!onent 4ia#ram
4escribe or#aniAation and de!endenc( between t'e software im!lementation
com!onents)
Com!onents are distribtable !'(sical nits & e)#) sorce code" ob/ect code)
:)F)= 4e!lo(ment 4ia#ram
4escribe t'e confi#ration of !rocessin# resorce elements and t'e ma!!in# of software
im!lementation com!onents onto t'em)
Contain com!onents & e)#) ob/ect code" sorce code and nodes (e)#) !rinter" database"
client mac'ine)
DA%A .AS/ MA+A,/M/+%0
5) Introdction
4<MS , A 4atabase is a collection of interrelated data and a 4atabase Mana#ement
S(stem is a set of !ro#rams to se andGor modif( t'is data)
5) 5 A!!roac'es to 4ata Mana#ement
File&<ased S(stems
Con%entionall(" before t'e 4atabase s(stems e%ol%ed" data in software s(stems was
stored in and re!resented sin# flat files)
4atabase S(stems
4atabase S(stems e%ol%ed in t'e late 56C;s to address common isses in a!!lications
'andlin# lar#e %olmes of data w'ic' are also data intensi%e) Some of t'ese isses cold
be traced bac- to t'e followin# disad%anta#es of File&based s(stems)
4rawbac-s of File&<ased S(stems
As s'own in t'e fi#re" in a file&based s(stem" different !ro#rams in t'e same a!!lication
ma( be interactin# wit' different !ri%ate data files) T'ere is no s(stem enforcin# an(
standardiAed control on t'e or#aniAation and strctre of t'ese data files)
4ata Redndanc( and Inconsistenc(
Since data resides in different !ri%ate data files" t'ere are c'ances of redndanc( and
resltin# inconsistenc() For e$am!le" in t'e abo%e e$am!le s'own" t'e same cstomer
can 'a%e a sa%in#s accont as well as a mort#a#e loan) 8ere t'e cstomer details ma( be
d!licated since t'e !ro#rams for t'e two fnctions store t'eir corres!ondin# data in two
different data files) T'is #i%es rise to redndanc( in t'e cstomer7s data) Since t'e same
data is stored in two files" inconsistenc( arises if a c'an#e made in t'e data in one file is
not reflected in t'e ot'er)
Dnantici!ated Keries
In a file&based s(stem" 'andlin# sddenGad&'oc 2eries can be difficlt" since it re2ires
c'an#es in t'e e$istin# !ro#rams)
4ata Isolation
T'o#' data sed b( different !ro#rams in t'e a!!lication ma( be related" t'e( reside in
isolated data files)
Concrrent Access Anomalies
In lar#e mlti&ser s(stems t'e same file or record ma( need to be accessed b( mlti!le
sers simltaneosl() 8andlin# t'is in a file&based s(stems is difficlt)
Secrit( 1roblems
In data&intensi%e a!!lications" secrit( of data is a ma/or concern) Dsers s'old be #i%en
access onl( to re2ired data and not t'e w'ole database) In a file&based s(stem" t'is can
be 'andled onl( b( additional !ro#rammin# in eac' a!!lication)
Inte#rit( 1roblems
In an( a!!lication" t'ere will be certain data inte#rit( rles w'ic' needs to be maintained)
T'ese cold be in t'e form of certain conditionsGconstraints on t'e elements of t'e data
records) In t'e sa%in#s ban- a!!lication" one sc' inte#rit( rle cold be *Cstomer I4"
w'ic' is t'e ni2e identifier for a cstomer record" s'old be non&em!t(+) T'ere can be
se%eral sc' inte#rit( rles) In a file&based s(stem" all t'ese rles need to be e$!licitl(
!ro#rammed in t'e a!!lication !ro#ram)
It ma( be noted t'at" we are not tr(in# to sa( t'at 'andlin# t'e abo%e isses li-e
concrrent access" secrit(" inte#rit( !roblems" etc)" is not !ossible in a file&based s(stem)
T'e real isse was t'at" t'o#' all t'ese are common isses of concern to an( data&
intensi%e a!!lication" eac' a!!lication 'ad to 'andle all t'ese !roblems on its own) T'e
a!!lication !ro#rammer needs to bot'er not onl( abot im!lementin# t'e a!!lication
bsiness rles bt also abot 'andlin# t'ese common isses)
5)> Ad%anta#es of 4atabase S(stems

As s'own in t'e fi#re" t'e 4<MS is a central s(stem w'ic' !ro%ides a common
interface between t'e data and t'e %arios front&end !ro#rams in t'e a!!lication) It also
!ro%ides a central location for t'e w'ole data in t'e a!!lication to reside)
4e to its centraliAed natre" t'e database s(stem can o%ercome t'e disad%anta#es of t'e
file&based s(stem as discssed below)
Minimal 4ata Redndanc(
Since t'e w'ole data resides in one central database" t'e %arios !ro#rams in t'e
a!!lication can access data in different data files) 8ence data !resent in one file need not
be d!licated in anot'er) T'is redces data redndanc() 8owe%er" t'is does not mean all
redndanc( can be eliminated) T'ere cold be bsiness or tec'nical reasons for 'a%in#
some amont of redndanc() An( sc' redndanc( s'old be carefll( controlled and t'e
4<MS s'old be aware of it)
4ata Consistenc(
Redced data redndanc( leads to better data consistenc()
4ata Inte#ration
Since related data is stored in one sin#le database" enforcin# data inte#rit( is mc' easier)
Moreo%er" t'e fnctions in t'e 4<MS can be sed to enforce t'e inte#rit( rles wit'
minimm !ro#rammin# in t'e a!!lication !ro#rams)
4ata S'arin#
Related data can be s'ared across !ro#rams since t'e data is stored in a centraliAed
manner) E%en new a!!lications can be de%elo!ed to o!erate a#ainst t'e same data)
Enforcement of Standards
Enforcin# standards in t'e or#aniAation and strctre of data files is re2ired and also
eas( in a 4atabase S(stem" since it is one sin#le set of !ro#rams w'ic' is alwa(s
interactin# wit' t'e data files)
A!!lication 4e%elo!ment Ease
T'e a!!lication !ro#rammer need not bild t'e fnctions for 'andlin# isses li-e
concrrent access" secrit(" data inte#rit(" etc) T'e !ro#rammer onl( needs to im!lement
t'e a!!lication bsiness rles) T'is brin#s in a!!lication de%elo!ment ease) Addin#
additional fnctional modles is also easier t'an in file&based s(stems)
<etter Controls
<etter controls can be ac'ie%ed de to t'e centraliAed natre of t'e s(stem)
4ata Inde!endence
T'e arc'itectre of t'e 4<MS can be %iewed as a :&le%el s(stem com!risin# t'e
followin#:
& T'e internal or t'e !'(sical le%el w'ere t'e data resides)
& T'e conce!tal le%el w'ic' is t'e le%el of t'e 4<MS fnctions
& T'e e$ternal le%el w'ic' is t'e le%el of t'e a!!lication !ro#rams or t'e end ser)
4ata Inde!endence is isolatin# an !!er le%el from t'e c'an#es in t'e or#aniAation or
strctre of a lower le%el) For e$am!le" if c'an#es in t'e file or#aniAation of a data file do
not demand for c'an#es in t'e fnctions in t'e 4<MS or in t'e a!!lication !ro#rams"
data inde!endence is ac'ie%ed) T's 4ata Inde!endence can be defined as immnit( of
a!!lications to c'an#e in !'(sical re!resentation and access tec'ni2e) T'e !ro%ision of
data inde!endence is a ma/or ob/ecti%e for database s(stems)
Redced Maintenance
Maintenance is less and eas(" a#ain" de to t'e centraliAed natre of t'e s(stem)
5): Fnctions of a 4<MS
T'e fnctions !erformed b( a t(!ical 4<MS are t'e followin#:
4ata 4efinition
T'e 4<MS !ro%ides fnctions to define t'e strctre of t'e data in t'e a!!lication) T'ese
inclde definin# and modif(in# t'e record strctre" t'e t(!e and siAe of fields and t'e
%arios constraintsGconditions to be satisfied b( t'e data in eac' field)
4ata Mani!lation
Once t'e data strctre is defined" data needs to be inserted" modified or deleted) T'e
fnctions w'ic' !erform t'ese o!erations are also !art of t'e 4<MS) T'ese fnction can
'andle !lanned and n!lanned data mani!lation needs) 1lanned 2eries are t'ose w'ic'
form !art of t'e a!!lication) Dn!lanned 2eries are ad&'oc 2eries w'ic' are !erformed
on a need basis)
4ata Secrit( @ Inte#rit(
T'e 4<MS contains fnctions w'ic' 'andle t'e secrit( and inte#rit( of data in t'e
a!!lication) T'ese can be easil( in%o-ed b( t'e a!!lication and 'ence t'e a!!lication
!ro#rammer need not code t'ese fnctions in 'isG'er !ro#rams)
4ata Reco%er( @ Concrrenc(
Reco%er( of data after a s(stem failre and concrrent access of records b( mlti!le sers
are also 'andled b( t'e 4<MS)
4ata 4ictionar( Maintenance
Maintainin# t'e 4ata 4ictionar( w'ic' contains t'e data definition of t'e a!!lication is
also one of t'e fnctions of a 4<MS)
1erformance
O!timiAin# t'e !erformance of t'e 2eries is one of t'e im!ortant fnctions of a 4<MS)
8ence t'e 4<MS 'as a set of !ro#rams formin# t'e Ker( O!timiAer w'ic' e%alates t'e
different im!lementations of a 2er( and c'ooses t'e best amon# t'em)
T's t'e 4<MS !ro%ides an en%ironment t'at is bot' con%enient and efficient to se
w'en t'ere is a lar#e %olme of data and man( transactions to be !rocessed)
5)H Role of t'e 4atabase Administrator
T(!icall( t'ere are t'ree t(!es of sers for a 4<MS) T'e( are :
T'e End Dser w'o ses t'e a!!lication) Dltimatel(" t'is is t'e ser w'o actall( !ts t'e
data in t'e s(stem into se in bsiness) T'is ser need not -now an(t'in# abot t'e
or#aniAation of data in t'e !'(sical le%el) S'e also need not be aware of t'e com!lete data
in t'e s(stem) S'e needs to 'a%e access and -nowled#e of onl( t'e data s'e is sin#)
T'e A!!lication 1ro#rammer w'o de%elo!s t'e a!!lication !ro#rams) S'e 'as more
-nowled#e abot t'e data and its strctre since s'e 'as mani!late t'e data sin# 'er
!ro#rams) S'e also need not 'a%e access and -nowled#e of t'e com!lete data in t'e
s(stem)
T'e 4atabase Administrator (4<A) w'o is li-e t'e s!er&ser of t'e s(stem) T'e role of
t'e 4<A is %er( im!ortant and is defined b( t'e followin# fnctions)
4efinin# t'e Sc'ema
T'e 4<A defines t'e sc'ema w'ic' contains t'e strctre of t'e data in t'e a!!lication)
T'e 4<A determines w'at data needs to be !resent in t'e s(stem ad 'ow t'is data 'as to
be re!resented and or#aniAed)
.iaisin# wit' Dsers
T'e 4<A needs to interact continosl( wit' t'e sers to nderstand t'e data in t'e
s(stem and its se)
4efinin# Secrit( @ Inte#rit( C'ec-s
T'e 4<A finds abot t'e access restrictions to be defined and defines secrit( c'ec-s
accordin#l() 4ata Inte#rit( c'ec-s are also defined b( t'e 4<A)
4efinin# <ac-! G Reco%er( 1rocedres
T'e 4<A also defines !rocedres for bac-! and reco%er() 4efinin# bac-! !rocedres
incldes s!ecif(in# w'at data is to bac-ed !" t'e !eriodicit( of ta-in# bac-!s and also
t'e medim and stora#e !lace for t'e bac-! data)
Monitorin# 1erformance
T'e 4<A 'as to continosl( monitor t'e !erformance of t'e 2eries and ta-e measres
to o!timiAe all t'e 2eries in t'e a!!lication)
5)H Role of t'e 4atabase Administrator
T(!icall( t'ere are t'ree t(!es of sers for a 4<MS) T'e( are :
T'e End Dser w'o ses t'e a!!lication) Dltimatel(" t'is is t'e ser w'o actall( !ts t'e
data in t'e s(stem into se in bsiness) T'is ser need not -now an(t'in# abot t'e
or#aniAation of data in t'e !'(sical le%el) S'e also need not be aware of t'e com!lete data
in t'e s(stem) S'e needs to 'a%e access and -nowled#e of onl( t'e data s'e is sin#)
T'e A!!lication 1ro#rammer w'o de%elo!s t'e a!!lication !ro#rams) S'e 'as more
-nowled#e abot t'e data and its strctre since s'e 'as mani!late t'e data sin# 'er
!ro#rams) S'e also need not 'a%e access and -nowled#e of t'e com!lete data in t'e
s(stem)
T'e 4atabase Administrator (4<A) w'o is li-e t'e s!er&ser of t'e s(stem) T'e role of
t'e 4<A is %er( im!ortant and is defined b( t'e followin# fnctions)
4efinin# t'e Sc'ema
T'e 4<A defines t'e sc'ema w'ic' contains t'e strctre of t'e data in t'e a!!lication)
T'e 4<A determines w'at data needs to be !resent in t'e s(stem ad 'ow t'is data 'as to
be re!resented and or#aniAed)
.iaisin# wit' Dsers
T'e 4<A needs to interact continosl( wit' t'e sers to nderstand t'e data in t'e
s(stem and its se)
4efinin# Secrit( @ Inte#rit( C'ec-s
T'e 4<A finds abot t'e access restrictions to be defined and defines secrit( c'ec-s
accordin#l() 4ata Inte#rit( c'ec-s are also defined b( t'e 4<A)
4efinin# <ac-! G Reco%er( 1rocedres
T'e 4<A also defines !rocedres for bac-! and reco%er() 4efinin# bac-! !rocedres
incldes s!ecif(in# w'at data is to bac-ed !" t'e !eriodicit( of ta-in# bac-!s and also
t'e medim and stora#e !lace for t'e bac-! data)
Monitorin# 1erformance
T'e 4<A 'as to continosl( monitor t'e !erformance of t'e 2eries and ta-e measres
to o!timiAe all t'e 2eries in t'e a!!lication)
In t'e Relational Model" nli-e t'e 8ierarc'ical and Networ- models" t'ere are no
!'(sical lin-s) All data is maintained in t'e form of tables consistin# of rows and
colmns) 4ata in two tables is related t'ro#' common colmns and not !'(sical lin-s or
!ointers) O!erators are !ro%ided for o!eratin# on rows in tables) Dnli-e t'e ot'er two
t(!e of 4<MS" t'ere is no need to tra%erse !ointers in t'e Relational 4<MS) T'is ma-es
2er(in# mc' more easier in a Relational 4<MS t'an in t'e t'e 8ierarc'ical or
Networ- 4<MS) T'is" in fact" is a ma/or reason for t'e relational model to become more
!ro#rammer friendl( and mc' more dominant and !o!lar in bot' indstrial and
academic scenarios) Oracle" S(base" 4<>" In#res" Informi$" MS&SK. Ser%er are few of
t'e !o!lar Relational 4<MSs)
CDSTOMERCDST) NO) CDSTOMER NAME A44RESS CITO
5F:=5 Nanb'ai @ Sons .) M) Road Mmbai
))) ))) ))) )))
))) ))) ))) )))
))) ))) ))) )))
CONTACTS OR4ERS
CDST)NO) CONTACT 4ESIJNATION OR4ER NO) OR4ER 4ATE
CDSTOMER NO)
5F:=5 Nanb'ai Owner :>5C >H&Mne&566= 5F:=5
5F:=5 Ra/es' MnimAccontant ))) ))) )))
))) ))) ))) ))) ))) )))
))) ))) ))) ))) ))) )))

1ARTSOR4ERS&1ARTS
1ARTS NO) 1ARTS 4ESC 1ART 1RICE OR4ER NO) 1ART NO) KDANTITO
S: Am-ette :)F0 Flo!!ies H;;);; :>5C C5 :;;
))) ))) ))) :>5C S: 5>;
))) ))) ))) ))) ))) )))
))) ))) ))) ))) ))) )))
SA.ES&8ISTORO 1ART NO) REJION OEAR DNITS
S: East 566C >;;;
S: Nort' 566C FF;;
S: Sot' 566C 5>;;;
S: West 566C >;;;;
T'e recent de%elo!ments in t'e area 'a%e s'own ! in t'e form of certain ob/ect and
ob/ectGrelational 4<MS !rodcts) E$am!les of sc' s(stems are JemStone and ?ersant
O4<MS) Researc' 'as also !roceeded on to a %ariet( of ot'er sc'emes incldin# t'e
mlti&dimensional a!!roac' and t'e lo#ic&based a!!roac')
:&.e%el 4atabase S(stem Arc'itectre
T'e E$ternal .e%el re!resents t'e collection of %iews a%ailable to different end&sers)
T'e Conce!tal le%el is t'e re!resentation of t'e entre information content of t'e
database)
T'e Internal le%el is t'e !'(sical le%el w'ic' s'ows 'ow t'e data data is stored" w'at are
t'e re!resentation of t'e fields etc)
2. %he Interna! -e$e!
T'is c'a!ter discsses t'e isses related to 'ow t'e data is !'(sicall( stored on t'e dis-
and some of t'e access mec'anisms commonl( sed for retrie%in# t'is data)
T'e Internal .e%el is t'e le%el w'ic' deals wit' t'e !'(sical stora#e of data) W'ile
desi#nin# t'is la(er" t'e main ob/ecti%e is to o!timiAe !erformance b( minimiAin# t'e
nmber of dis- accesses drin# t'e %arios database o!erations)
T'e fi#re s'ows t'e !rocess of database access in #eneral) T'e 4<MS %iews t'e
database as a collection of records) T'e File Mana#er of t'e nderl(in# O!eratin# S(stem
%iews it as a set of !a#es and t'e 4is- Mana#er %iews it as a collection of !'(sical
locations on t'e dis-)
W'en t'e 4<MS ma-es a re2est for a s!ecific record to t'e File Mana#er" t'e latter
ma!s t'e record to a !a#e containin# it and re2ests t'e 4is- Mana#er for t'e s!ecific
!a#e) T'e 4is- Mana#er determines t'e !'(sical location on t'e dis- and retrie%es t'e
re2ired !a#e)
>)5 Clsterin#
In t'e abo%e !rocess" if t'e !a#e containin# t'e re2ested record is alread( in t'e
memor(" retrie%al from t'e dis- is not necessar() In sc' a sitation" time ta-en for t'e
w'ole o!eration will be less) T's" if records w'ic' are fre2entl( sed to#et'er are
!laced !'(sicall( to#et'er" more records will be in t'e same !a#e) 8ence t'e nmber of
!a#es to be retrie%ed will be less and t'is redces t'e nmber of dis- accesses w'ic' in
trn #i%es a better !erformance)
T'is met'od of storin# lo#icall( related records" !'(sicall( to#et'er is called clsterin#)
E#: Consider CDSTOMER table as s'own below) Cst I4 Cst Name Cst Cit(
)))
5;;;5 Ra/ 4el'i )))
5;;;> ))) ))) )))
5;;;: ))) ))) )))
5;;;H ))) ))) )))
))) ))) ))) )))
))) ))) ))) )))
If 2eries retrie%in# Cstomers wit' consecti%e CstYI4s fre2entl( occr in t'e
a!!lication" clsterin# based on CstYI4 will 'el! im!ro%in# t'e !erformance of t'ese
2eries) T'is can be e$!lained as follows)
Assme t'at t'e Cstomer record siAe is 5>9 b(tes and t'e t(!ical siAe of a !a#e retrie%ed
b( t'e File Mana#er is 5 Zb (5;>H b(tes))
If t'ere is no clsterin#" it can be assmed t'at t'e Cstomer records are stored at random
!'(sical locations) In t'e worst&case scenario" eac' record ma( be !laced in a different
!a#e) 8ence a 2er( to retrie%e 5;; records wit' consecti%e CstYIds (sa(" 5;;;5 to
5;5;;)" will re2ire 5;; !a#es to be accessed w'ic' in trn translates to 5;; dis-
accesses)
<t" if t'e records are clstered" a !a#e can contain 9 records) 8ence t'e nmber of !a#es
to be accessed for retrie%in# t'e 5;; consecti%e records will be ceil(5;;G9) [ 5:) i)e)"
onl( 5: dis- accesses will be re2ired to obtain t'e 2er( reslts) T's" in t'e #i%en
e$am!le" clsterin# im!ro%es t'e s!eed b( a factor of =)=
K: For w'at record siAe will clsterin# be of no benefit to im!ro%e !erformance Q
A: W'en t'e record siAe and !a#e siAe are sc' t'at a !a#e can contain onl( one record)
K: Can a table 'a%e clsterin# on mlti!le fields simltaneosl( Q
A: No
SIntra&file Clsterin# , Clstered records belon# to t'e same file (table) as in t'e abo%e
e$am!le)
SInter&file Clsterin# , Clstered records belon# to different files (tables)) T'is t(!e of
clsterin# ma( be re2ired to en'ance t'e s!eed of 2eries retrie%in# related records from
more t'an one tables) 8ere interlea%in# of records is sed)
>)> Inde$in#
Inde$in# is anot'er common met'od for ma-in# retrie%als faster)
Consider t'e e$am!le of CDSTOMER table sed abo%e) T'e followin# 2er( is based on
Cstomer7s cit()
*Retrie%e t'e records of all cstomers w'o reside in 4el'i+
8ere a se2ential searc' on t'e CDSTOMER table 'as to be carried ot and all records
wit' t'e %ale 74el'i7 in t'e CstYCit( field 'a%e to be retrie%ed) T'e time ta-en for t'is
o!eration de!ends on t'e nmber of !a#es to be accessed) If t'e records are randoml(
stored" t'e !a#e accesses de!ends on t'e %olme of data) If t'e records are stored
!'(sicall( to#et'er" t'e nmber of !a#es de!ends on t'e siAe of eac' record also)
If sc' 2eries based on CstYCit( field are %er( fre2ent in t'e a!!lication" ste!s can be
ta-en to im!ro%e t'e !erformance of t'ese 2eries) Creatin# an Inde$ on CstYCit( is one
sc' met'od) T'is reslts in t'e scenario as s'own below)
A new inde$ file is created) T'e nmber of records in t'e inde$ file is same as t'at of t'e
data file) T'e inde$ file 'as two fields in eac' record) One field contains t'e %ale of t'e
CstYCit( field and t'e second contains a !ointer to t'e actal data record in t'e
CDSTOMER table)
W'ene%er a 2er( based on CstYCit( field occrs" a searc' is carried ot on t'e Inde$
file) 8ere" it is to be noted t'at t'is searc' will be mc' faster t'an a se2ential searc' in
t'e CDSTOMER table" if t'e records are stored !'(sicall( to#et'er) T'is is becase of
t'e mc' smaller siAe of t'e inde$ record de to w'ic' eac' !a#e will be able to contain
more nmber of records)
W'en t'e records wit' %ale 74el'i7 in t'e CstYCit( field in t'e inde$ file are located"
t'e !ointer in t'e second field of t'e records can be followed to directl( retrie%e t'e
corres!ondin# CDSTOMER records)
T's t'e access in%ol%es a Se2ential access on t'e inde$ file and a 4irect access on t'e
actal data file)
Retrie%al S!eed %Gs D!date S!eed : T'o#' inde$es 'el! ma-in# retrie%als faster" t'e(
slow down !dates on t'e table since !dates on t'e base table demand !date on t'e
inde$ field as well)
It is !ossible to create an inde$ wit' mlti!le fields i)e)" inde$ on field combinations)
Mlti!le inde$es can also be created on t'e same table simltaneosl( t'o#' t'ere ma(
be a limit on t'e ma$imm nmber of inde$es t'at can be created on a table)
K: In w'ic' of t'e followin# sitations will inde$es be ineffecti%e Q
a) W'en t'e !ercenta#e of rows bein# retrie%ed is lar#e
b) W'en t'e data table is small and t'e inde$ record is of almost t'e same siAe as of t'e
actal data record)
c) In 2eries in%ol%in# ND.. G Not ND.. in t'e inde$ed field)
d)All of t'e abo%e
A: d) All of t'e abo%e
K: Can a clsterin# based on one field and inde$in# on anot'er field e$ist on t'e same
table simltaneosl( Q
A: Oes
>): 8as'in#
8as'in# is (et anot'er met'od sed for ma-in# retrie%als faster) T'is met'od !ro%ides
direct access to record on t'e basis of t'e %ale of a s!ecific field called t'e 'as'Yfield)
8ere" w'en a new record is inserted" it is !'(sicall( stored at an address w'ic' is
com!ted b( a!!l(in# a mat'ematical fnction ('as' fnction) to t'e %ale of t'e 'as'
field) T's for e%er( new record"
'as'Yaddress [ f ('as'Yfield)" w'ere f is t'e 'as' fnction)
.ater" w'en a record is to be retrie%ed" t'e same 'as' fnction is sed to com!te t'e
address w'ere t'e record is stored) Retrie%als are faster since a direct access is !ro%ided
and t'ere is no searc' in%ol%ed in t'e !rocess)
An e$am!le of a t(!ical 'as' fnction is #i%en b( a nmeric 'as' field" sa( an id"
modls a %er( lar#e !rime nmber)
K: Can t'ere be more t'an one 'as' fields on a file Q
A: No
As 'as'in# relates t'e field %ale to t'e address of t'e record" mlti!le 'as' fields will
ma! a record to mlti!le addresses at t'e same time) 8ence t'ere can be onl( one 'as'
field !er file)
Collisions : Consider t'e e$am!le of t'e CDSTOMER table #i%en earlier w'ile
discssin# clsterin#) .et CDSTYI4 be t'e 'as' field and t'e 'as' fnction be defined as
((CDSTYI4 mod 5;;;;)TCH \ 5;>F)) T'e records wit' CDSTYI4 5;;;5" 5;;;>" 5;;;:
etc) will be stored at addresses 5;96" 55F:" 5>5= etc) res!ecti%el()
It is !ossible t'at two records 'as' to t'e same address leadin# to a collision) In t'e abo%e
e$am!le" records wit' CDSTYI4 %ales >;;;5" >;;;>" >;;;: etc) will also ma! on to t'e
addresses 5;96" 55F:" 5>5= etc) res!ecti%el() And same is t'e case wit' CDSTYI4 %ales
:;;;5" :;;;>" :;;;: etc)
T'e met'ods to resol%e a collision are b( sin# :
5) .inear Searc':
W'ile insertin# a new record" if it is fond t'at t'e location at t'e 'as' address is alread(
occ!ied b( a !re%iosl( inserted record" searc' for t'e ne$t free location a%ailable in t'e
dis- and store t'e new record at t'is location) A !ointer from t'e first record at t'e
ori#inal 'as' address to t'e new record will also be stored) 4rin# retrie%al" t'e 'as'
address is com!ted to locate t'e record) W'en it is seen t'at t'e record is not a%ailable at
t'e 'as' address" t'e !ointer from t'e record at t'at address is followed to locate t'e
re2ired record)
In t'is met'od" t'e o%er 'ead incrred is t'e time ta-en for t'e linear searc' to locate t'e
ne$t free location w'ile insertin# a record)
>) Collision C'ain:
8ere" t'e 'as' address location contains t'e 'ead of a list of !ointers lin-in# to#et'er all
records w'ic' 'as' to t'at address)
In t'is met'od" an o%erflow area needs to be sed if t'e nmber of records ma!!in# on to
t'e same 'as' address e$ceeds t'e nmber of locations lin-ed to it)
:)> 1ro!erties of Relations
S No 4!licate T!les , A relation cannot contain two or more t!les w'ic' 'a%e t'e
same %ales for all t'e attribtes) i)e)" In an( relation" e%er( row is ni2e)
S T!les are nordered , T'e order of rows in a relation is immaterial)
S Attribtes are nordered , T'e order of colmns in a relation is immaterial)
S Attribte ?ales are Atomic , Eac' t!le contains e$actl( one %ale for eac' attribte)
It ma( be noted t'at man( of t'e !ro!erties of relations follow t'e fact t'at t'e bod( of a
relation is a mat'ematical set)
:): Inte#rit( Rles
T'e followin# are t'e inte#rit( rles to be satisfied b( an( relation)
S No Com!onent of t'e 1rimar( Ze( can be nll)
S T'e 4atabase mst not contain an( nmatc'ed Forei#n Ze( %ales) T'is is called t'e
referential inte#rit( rle)
K: Can t'e Forei#n Ze( acce!t nllsQ
A: Oes" if t'e a!!lication bsiness rle allows t'is)
8ow do we e$!lain t'is Q
Dnli-e t'e case of 1rimar( Ze(s" t'ere is no inte#rit( rle sa(in# t'at no com!onent of
t'e forei#n -e( can be nll) T'is can be lo#icall( e$!lained wit' t'e 'el! of t'e followin#
e$am!le:
Consider t'e relations Em!lo(ee and Accont as #i%en below)
Em!lo(ee
Em!] Em!Name Em!Cit( Em!Acc]
^5;5 S'e-'ar <omba( 5>;;;5
^5;> Ra/ 1ne 5>;;;>
^5;: S'arma Na#!r Nll
^5;H ?ani <'o!al 5>;;;:
Accont
ACC] O!en4ate <alAmt
5>;;;5 :;&A#&5669 F;;;
5>;;;> >6&Oct&5669 5>;;
5>;;;: ;5&Man&5666 :;;;
5>;;;H ;H&Mar&5666 F;;
Em!Acc] in Em!lo(ee relation is a forei#n -e( creatin# reference from Em!lo(ee to
Accont) 8ere" a Nll %ale in Em!Acc] attribte is lo#icall( !ossible if an Em!lo(ee
does not 'a%e a ban- accont) If t'e bsiness rles allow an em!lo(ee to e$ist in t'e
s(stem wit'ot o!enin# an accont" a Nll %ale can be allowed for Em!Acc] in
Em!lo(ee relation)
In t'e case e$am!le #i%en" Cst] in OrdYA# cannot acce!t Nll if t'e bsiness rle
insists t'at t'e Cstomer No) needs to be stored for e%er( order !laced)
T'e ne$t isse related to forei#n -e( reference is 'andlin# deletes G !dates of !arentQ
In t'e case e$am!le" can we delete t'e record wit' Cst] %ale ;;>" ;;: or ;;F Q
T'e defalt answer is NO" as lon# as t'ere is a forei#n -e( reference to t'ese records
from some ot'er table) 8ere" t'e records are referenced from t'e order records in
OrdYA# relation) 8ence Restrict t'e deletion of t'e !arent record)
4eletion can still be carried if we se t'e Cascade or Nllif( strate#ies)
Cascade: 4eleteGD!date all t'e references sccessi%el( or in a cascaded fas'ion and
finall( deleteG!date t'e !arent record) In t'e case e$am!le" Cstomer record wit'
Cst];;> can be deleted after deletin# order records wit' Ord] 5;5 and 5;H) <t t'ese
order records" in trn" can be deleted onl( after deletin# t'ose records wit' Ord] 5;5 and
5;H from OrdYItems relation)
Nllif(: D!date t'e referencin# to Nll and t'en deleteG!date t'e !arent record) In t'e
abo%e e$am!le of Em!lo(ee and Accont relations" an accont record ma( 'a%e to be
deleted if t'e accont is to be closed) For e$am!le" if Em!lo(ee Ra/ decides to close 'is
accont" Accont record wit' Acc] 5>;;;> 'as to be deleted) <t t'is deletion is not
!ossible as lon# as t'e Em!lo(ee record of Ra/ references it) 8ence t'e strate#( can be to
!date t'e Em!Acc] field in t'e em!lo(ee record of Ra/ to Nll and t'en delete t'e
Accont !arent record of 5>;;;>) After t'e deletion t'e data in t'e tables will be as
follows:
Em!lo(ee Em!] Em!Name Em!Cit( Em!Acc]
^5;5 S'e-'ar <omba( 5>;;;5
^5;> Ra/ 1ne 5>;;;> Nll
^5;: S'arma Na#!r Nll
^5;H ?ani <'o!al 5>;;;:
Accont
ACC] O!en4ate <alAmt
5>;;;5 :;&A#&5669 F;;;
5>;;;> >6&Oct&5669 5>;;
5>;;;: ;5&Man&5666 :;;;
5>;;;H ;H&Mar&5666 F;;
:)H Relational Al#ebra O!erators
+#%/: It incldes onl( e$am!les wit' dia#rams w'ic' canIt be co!ied 'ere) So !lease
refer t'e website_)
4. Structured 1uer" -anguage 2S1-3
H)5 SK. : An O%er%iew
T'e com!onents of SK. are
a) 4ata Mani!lation .an#a#e , Consists of SK. statements for o!eratin# on t'e data
(Insertin#" Modif(in#" 4eletin# and Retrie%in# 4ata) in tables w'ic' alread( e$ist)
b) 4ata 4efinition .an#a#e , Consists of SK. statements for definin# t'e sc'ema
(Creatin#" Modif(in# and 4ro!!in# tables" inde$es" %iews etc))
c) 4ata Control .an#a#e , Consists of SK. statements for !ro%idin# and re%o-in#
access !ermissions to sers
Tables sed:
OrdYA#Ord] Ord4ate Cst]
5;5 ;>&ADJ&6H ;;>
5;> 55&ADJ&6H ;;:
5;: >5&ADJ&6H ;;:
5;H >9&ADJ&6H ;;>
5;F :;&ADJ&6H ;;F
ItemsItem] 4escr 1rice
8W5 1ower S!!l( H;;;
8W> 5;5& Ze(board >;;;
8W: Mose 9;;
SW5 MS&4OS C); F;;;
SW> MS&Word C); 9;;;
CstomersCst] CstName Cit(
;;5 S'a' <omba(
;;> Srini%asan Madras
;;: J!ta 4el'i
;;H <aner/ee Calctta
;;F A!te <omba(
H)> 4M. , SE.ECT" INSERT" D14ATE and 4E.ETE statements)
T'e SE.ECT statement
Retrie%es rows from one or more tables accordin# to #i%en conditions)
Jeneral form:
SE.ECT W A.. ` 4ISTINCT X Uattribte (comma)listV
FROM Utable (comma)listV
W W8ERE Uconditional e$!ressionVX
W OR4ER <O W4ESCX Uattribte listV
W JROD1 <O Uattribte (comma)listVX
W 8A?INJ Uconditional e$!ressionVX
Ker( 5:
Some SE.ECT statements on t'e Case E$am!le
SE.ECT T U&&&&&&&&&&&&&&&&&
FROM items3
T &denotes all attribtes in t'e table

Reslt
Ker( >:
SE.ECT cst]"cstname
FROM cstomers3
Reslt
Ker( ::
SE.ECT 4ISTINCT item]
FROM ordYitems3
Reslt
Ker( H:
SE.ECT ord] 0Order 0" orddate 0Ordered On0 U&&&&
FROM ordYa#3
In t'e reslt set t'e colmn 'eadin#s will a!!ear as *Order+ and *Ordered On+ instead of
ord] and orddate)
Reslt
Ker( F:
SE.ECT item]" descr
FROM items
W8ERE !riceV>;;;3
Reslt
Ker( C:
SE.ECT cstname
FROM cstomers
W8ERE cit(UV7<omba(73
Reslt
Ker( =:
SE.ECT cstname
FROM cstomers
W8ERE D11ER(cit()UV7<OM<AO73
Reslt
Ker( 9:
SE.ECT T
FROM ordYa#
W8ERE orddate V 75F&ADJ&6H73 U&&&&&&&&&&&
Illstrates t'e se of 7date7 fields) In SK." a se!arate datat(!e (e#: date" datetime etc)) is
a%ailable to store data w'ic' is of t(!e date)
Reslt
Ker( 6:
SE.ECT T
FROM ordYitems
W8ERE 2t( <ETWEEN 5;; AN4 >;;3
Reslt
Ker( 5;:
SE.ECT cstname
FROM cstomers
W8ERE cit( IN (7<omba(7" 7Madras7)3 U&&&&&&&

T'e conditional e$!ression e%alates to TRDE for t'ose records for w'ic' t'e %ale of
cit( field is in t'e list (7<omba(" 7Madras7)
Reslt
Ker( 55:
SE.ECT cstname
FROM cstomers
W8ERE cstname .IZE 7SE7 3 U&&&&&&&&&&&&
.IZE 7SE7 & 7S7 followed b( Aero or more c'aracters
Reslt
Ker( 5>:
SE.ECT T
FROM ordYitems
W8ERE 2t(V5;; AN4 item] .IZE 7SWE73
Reslt
Ker( 5::
SE.ECT cstname
FROM cstomers
W8ERE cit([7<omba(7 OR cit([7Madras73
Reslt

Ker( 5H:
SE.ECT T
FROM cstomers
W8ERE cit([7<omba(7
OR4ER <O cstname3 U&&&&&&&&&&&&&&&&&&&&
Records in t'e reslt set is dis!la(ed in t'e ascendin# order of cstname
Reslt
Ker( 5F:
SE.ECT T
FROM ordYitems
OR4ER <O item]" 2t( 4ESC3 U&&&&&&&&&&&&&
4is!la( t'e reslt set in t'e ascendin# order of item]) If t'ere are more t'an one records
wit' t'e same item] " t'e( will be dis!la(ed in t'e descendin# order of 2t(
Reslt
Ker( 5C:
SE.ECT descr" !rice
OR4ER <O >
FROM items
OR4ER <O >3 U&&&&&&&&&&&&&&&&&&&&&&&&&&&&

OR4ER <O t'e >nd attribte (!rice) in t'e attribte list of t'e SE.ECT clase
Reslt
Ker( 5=:
SE.ECT ord]" ordYa#)cst]" cstname U&&&&&&&&&&&&&&&&
FROM ordYa#" cstomers
W8ERE cit([74el'i7
AN4 ordYa#)cst] [ cstomers)cst]3 U&&&&&&&&&&&&&&&&
SE.ECT statement im!lementin# MOIN o!eration)
MOIN condition
Reslt
Ker( 59:
SE.ECT ord]" cstomers)cst]" cit(
FROM ordYa#" cstomers
W8ERE ordYa#)cst] [ cstomers)cst]3
Reslt
Ker( 56:
SE.ECT ord]" cstomers)cst]" cit(
FROM ordYa#" cstomers
W8ERE ordYa#)cst] [ cstomers)cst] (\)3 U&&&&&&&&&&&

(\) indicates oter /oin) 8ere it is a ri#'t oter /oin as indicated b( t'e (\) after t'e ri#'t
side field)
Reslt
Nested SE.ECT statements
SK. allows nestin# of SE.ECT statements) In a nested SE.ECT statement t'e inner
SE.ECT is e%alated first and is re!laced b( its reslt to e%alate t'e oter SE.ECT
statement)
Ker( >;:
SE.ECT item]" descr" !rice U&&&&&&&&&&&&&&&&&&&&&&&&&&&
FROM items
W8ERE !rice V (SE.ECT A?J(!rice) FROM items)3 U&&&&&&
Oter SE.ECT statement

Inner SE.ECT statement
Reslt
Ker( >5:
SE.ECT cst]" cstname U&&&&&&&&&&&&&&&&&&
FROM cstomers
W8ERE cit( [ ( SE.ECT cit( FROM cstomers
W8ERE cstname[7S'a'7)3
8ere t'e oter SE.ECT is e%alated as
SE.ECT cst]" cstname
FROM cstomers
W8ERE cit( [ 0<OM<AO0


Reslt
Arit'metic E$!ressions
\
&
T
G
( )
Arit'metic fnctions are allowed in SE.ECT and W8ERE clases)
Ker( >>:
SE.ECT descr" !rice" !riceT;)5 0discont0
FROM items
W8ERE !rice V[ H;;;
OR4ER <O :3
Reslt
Ker( >::
SE.ECT descr
FROM items" ordYitems
W8ERE !riceT2t( V >F;;;;
and items)item] [ ordYitems)item]3
Reslt
Nmeric Fnctions
Ker( >H:
SE.ECT 2t(" RODN4(2t(G>";) 02t( s!!lied0
FROM ordYitems
W8ERE item][78W>73
Reslt
Ker( >F:
SE.ECT 2t(" TRDNC(2t(G>";) 02t( s!!lied0
FROM ordYitems
W8ERE item][78W>73
Reslt
E$am!les of Nmeric FnctionsMO4(n"m)
SKRT(n)
RODN4(n"m)
TRDNC(n"m)
7m7 indicates t'e nmber of di#its after decimal !oints in t'e reslt)
4ate Arit'emetic
4ate \ No) of da(s
4ate & No) of da(s
4ate , 4ate
Ker( >C:
SE.ECT ord]" orddate\5F 0S!!l( b(0
FROM ordYa#3
Reslt
4ate Fnctions
MONT8SY<ETWEEN(date5" date>)
A44YMONT8S(date" no) of mont's)
SOS4ATE
Retrns s(stem date)
Ker( >=:
SE.ECT ord]"
MONT8SY<ETWEEN(SOS4ATE"orddate)
FROM ordYa#3
Reslt
Ker( >9:
SE.ECT TOYC8AR(orddate"7 44GMMGOOOO7) U&&&
FROM ordYa#3 Con%erts t'e %ale of t'e date field orddate to c'aracter strin# of
t'e format 44GMMGOOOO
Reslt
Note:
44 & da( of mont' (5&:5)
4 & da( of wee- (5&=)
4AO & name of da(
MM & mont' (;5&5>)
MONT8 & name of mont'
MON & abbre%iated name of mont'
88:MI:SS & 'ors:mintes:seconds
fm & fill mode : s!!ress blan- !addin#

C'aracter E$!ressions @ Fnctions
`` & Concatenate o!erator
Ker( >6:
SE.ECT cstname `` 7 & 7 `` cit(
FROM cstomers3
Reslt
E$am!les of C'aracter Fnctions:
INITCA1(strin#)
D11ER(strin#)
.OWER(strin#)
SD<STR(strin#"start"no) of c'aracters)
Jro! Fnctions
Jro! fnctions are fnctions w'ic' act on t'e entire colmn of selected rows)
Ker( :;:
SE.ECT SDM(2t()" A?J(2t() U&&&&&&&&&&&&&&&
FROM ordYitems
W8ERE item][7SW573 SDM and A?J are e$am!les of Jro! Fnctions) T'e(
com!te t'e smGa%era#e of 2t( %ales of all rows w'ere item][7SW57)
Reslt
E$am!les of Jro! Fnctions:
SDM
A?J
CODNT
MA^
MIN
Ker( :5:
SE.ECT item]" SDM(2t()
FROM ordYitems
JROD1 <O item]3 U&&&&&&&&&&&&&&&&&&&&&&&&&

JROD1 <O clase sed to #ro! rows accordin# to t'e %ale of item] in t'e reslt) SDM
fnction acts indi%idall( on eac' #ro! of rows)
Reslt
Ker( :>:
SE.ECT item]" SDM(2t()
FROM ordYitems
JROD1 <O item]
8A?INJ SDM(2t()V5;;3 U&&&&&&&&&&&&&&&&&&

8A?INJ clase sed to a!!l( t'e condition to be a!!lied on t'e #ro!ed rows and
dis!la( t'e final reslt)
Reslt
Ker( :::
SE.ECT item]" SDM(2t()
FROM ordYitems
JROD1 <O item]
8A?INJ CODNT(T)V>3
Reslt
T'e INSERT statement
Inserts one or more t!les in a table)
Jeneral forms:
To insert a sin#le t!le
INSERT INTO Utable&nameV WUattribte (comma)listVX
?A.DES U%ale listV3
To insert mlti!le t!les
INSERT INTO Utable&nameV WUattribte (comma)listVX
SE.ECT W A.. ` 4ISTINCT X Uattribte (comma)listV
FROM Utable (comma)listVT
W W8ERE Uconditional e$!ressionVX3
T & list of e$istin# tables
Sam!le INSERT statements from t'e Case E$am!le
Ker( :H: Insert all %ales for a new row
INSERT INTO cstomers U&&&&&&&&&&&&&&&&&&&
?A.DES (;;C" 7Zris'nan7" 7Madras7)3

Inserts a sin#le row in Cstomers Table) Attribte list need not be mentioned if %ales are
#i%en for all attribtes in t'e t!le)

Ker( :F: Insert %ales of item] @ descr colmns for a new row
INSERT INTO items (item]" descr) U&&&&&&&&&&
?A.DES (78WH7" 75:>&4M1rinter7)3
Attribte list mentioned since %ales are not #i%en for all attribtes in t'e t!le)
8ere 1rice colmn for t'e newl( inserted t!le ta-es ND.. %ale)
Ker( :C: Inserts a new row w'ic' incldes a date field
INSERT INTO ordYa#
?A.DES(5;C" 7:5&ADJ&6H7" ;;F)3
Ker( :=: Inserts a new row wit' t'e date field bein# s!ecified in non 44&MON&OO
format
INSERT INTO ordYa#
?A.DES (5;C" TOY4ATE(7:5;96H7"744MMOO7)" ;;F)3
T'e D14ATE statement
D!dates %ales of one or more attribtes of one or more t!les in a table)
Jeneral form:
D14ATE Utable&nameV
SET Uattribte&5 [ %ale&5W" attribte&> [ %ale&>")))attribte&n [ %ale&nX
W W8ERE Uconditional e$!ressionVX3
Sam!le D14ATE statements from t'e Case E$am!le
Ker( :9: c'an#es !rice of itmem SW5 to C;;;
D14ATE items
SET !rice [ C;;;
W8ERE item] [7SW573
Ker( :6: C'an#es a wron#l( entered item] from 8W> to SW>
D14ATE ordYitems
SET item] [ 7SW>7
W8ERE ord][5;H AN4 item] [ 78W>73
T'e 4E.ETE statement
4eletes one or more t!les in a table accordin# to #i%en conditions
Jeneral form:
4E.ETE FROM Utable&nameV
W W8ERE Uconditional e$!ressionVX3
Sam!le 4E.ETE statements from t'e Case E$am!le
Ker( H;: 4eletes Cstomer record wit' Cstomer Nmber ;;H
4E.ETE FROM cstomers
W8ERE cst] [ ;;H3
4E.ETE FROM OrdYItems3 U&&&&&&&&&&&&&&&&&&&
4eletes all rows in OrdYItems Table) T'e table remains em!t( after t'e 4E.ETE
o!eration)
4<MS Corse Contents
1re% Ne$t
H): 44. , CREATE" A.TER" and 4RO1 statements)
44. statements are t'ose w'ic' are sed to create" modif( and dro! t'e definitions or
strctres of %arios tables" %iews" inde$es and ot'er elements of t'e 4<MS)
T'e CREATE TA<.E statement
Creates a new table)
Jeneral form:
CREATE TA<.E Utable&nameV
(Utable&element (comma)listVT)3
T & table element ma( be attribte wit' its data&t(!e and siAe or an( inte#rit( constraint on
attribtes)
Some CREATE TA<.E statements on t'e Case E$am!le
Ker(:
CREATE TA<.E cstomers
( cst] NDM<ER(C) NOT ND.."
cstname C8AR(:;) "
cit( C8AR(>;))3
& T'is 2er( Creates a table CDSTOMERS wit' : fields & cst]" cstname and cit() Cst]
cannot be nll
Ker(:
CREATE TA<.E ordYse! U&&&&&&&&&&&&&&&&&&&
AS SE.ECT T from ordYa#3
Creates a new table ordYse!" w'ic' 'as t'e same strctre of ordYa#) T'e data in
ordYa# is co!ied to t'e new table ordYse!)
& T'is 2er( Creates table OR4YSE1 as a c!( of OR4&ADJ) Co!ies strctre as well as
data)
Ker(:
CREATE TA<.E ordYse! U&&&&&&&&&&&&&&&&&&
AS SE.ECT T from ordYa#
W8ERE 5 [ >3
Creates a new table ordYse!" w'ic' 'as t'e same strctre of ordYa#) No data in
ordYa# is co!ied to t'e new table since t'ere is no row w'ic' satisfies t'e 7alwa(s false7
condition 5 [ >)
& T'is 2er( Creates table OR4YSE1 as a co!( of OR4YADJ" bt does not co!( an(
data as t'e W8ERE clase is ne%er satisfied)
T'e A.TER TA<.E statement
Alters t'e strctre of an e$istin# table)
Jeneral form:
A.TER TA<.E Utable&nameV
A44 ` MO4IFO (Utable&element (comma)list)3
E$am!les of A.TER TA<.E statement)
Ker(:
A.TER TA<.E cstomers
MO4IFO cstname C8AR(:F)3 U&&&&&&&&&&&&&

Modifies t'e data t(!eGsiAe of an attribte in t'e table
& T'is 2er( c'an#es t'e cstname field to a c'aracter field of len#t' :F) Dsed for
modif(in# field len#t's and attribtes)
Ker(:
A.TER TA<.E cstomers
A44 (!'one nmber(9)" U&&&&&&&&&&&&&&&&&&
creditYratin# c'ar(5))3 Adds two new attribtes to t'e Cstomers table) 8ere" for e$istin#
t!les (if an()" t'e new attribte will ta-e ND.. %ales since no 4EFAD.T %ale is
mentioned for t'e attribte)
& T'is 2er( adds two new fields & !'one @ creditYratin# to t'e cstomers table)
T'e 4RO1 TA<.E statement
4RO1S an e$istin# table)
Jeneral form:
4RO1 TA<.E Utable&nameV3
E$am!le:
Ker(:
4RO1 TA<.E ordYse!3
& T'e abo%e 2er( dro!s table OR4YSE1 from t'e database
Creatin# @ 4ro!!in# ?iews
A %iew is a %irtal relation created wit' attribtes from one or more base tables)
SE.ECT T FROM m(%iew53 at an( #i%en time will e%alate t'e %iew&definin# 2er( in
t'e CREATE ?IEW statement and dis!la( t'e reslt)
Ker(:
CREATE ?IEW m(%iew5
AS SE.ECT
ord]" orddate" ordYa#)cst]" cstname
FROM ordYa#" cstomers
W8ERE ordYa#)cst] [ cstomers)cst]3
& T'is 2er( defines a %iew consistin# of ord]" cst]" and cstname sin# a /oin of
OR4YADJ and CDSTOMERS tables)
Ker(:
CREATE ?IEW m(%iew> (ItemNo" Kantit()
AS SE.ECT item]" 2t(
FROM ordYitems3
& T'is 2er( defines a %iew wit' colmns item] and 2t( from t'e OR4YITEMS table" and
renames t'ese colmns as ItemNo) and Kantit( res!ecti%el()
Ker(:
CREATE ?IEW m(%iew:
AS SE.ECT item]" descr" !rice
FROM items
W8ERE !rice U 5;;;
WIT8 C8ECZ O1TION3 U&&&&&&&&&&&&&&&&&&&
WIT8 C8ECZ O1TION in a CREATE ?IEW statement indicates t'at INSERTs or
D14ATEs on t'e %iew will be re/ected if t'e( %iolate an( inte#rit( constraint im!lied b(
t'e %iew&definin# 2er()
& T'is 2er( defines t'e %iew as defined) WIT8 C8ECZ O1TION ensres t'at if t'is
%iew is sed for !dation" t'e !dated %ales do not case t'e row to fall otside t'e
%iew)
Ker(:
4RO1 ?IEW m(%iew53 U&&&& To dro! a %iew
& t'is 2er( dro!s t'e %iew MO?IEW5
Creatin# @ 4ro!!in# Inde$es
Ker(:
CREATE IN4E^ iYcit( U&&&&&&&&&&&&&&&&&&&&
ON cstomers (cit()3
Creates a new inde$ named iYcit() T'e new inde$ file(table) will 'a%e t'e %ales of cit(
colmn of Cstomers table
Ker(:
CREATE DNIKDE IN4E^ iYcstname U&&&&&&
ON cstomers (cstname)3
Creates an inde$ w'ic' allows onl( ni2e %ales for cstnames
Ker(:
CREATE IN4E^ iYcit(Ycstname U&&&&&&&&&
ON cstomers (cit(" cstname)3 Creates an inde$ based on two fields : cit( and
cstname
Ker(: 4RO1 IN4E^ iYcit(3 U&&&&&&&&&&&&&&&&&&&& 4ro!s inde$ iYcit(
H)H 4C. , JRANT and RE?OZE statements)
4C. statements are t'ose w'ic' are sed to control access !ermissions on t'e tables"
inde$es" %iews and ot'er elements of t'e 4<MS)
Jrantin# @ Re%o-in# 1ri%ile#es
Ker(:
JRANT A.. U&&&&&&&&&&&&&&&&&&
ON cstomers
TO as'raf3
Jrants all !ermissions on t'e table cstomers to t'e ser w'o lo#s in as 7as'raf7)
Ker(:
JRANT SE.ECT U&&&&&&&&&&&&&&
ON cstomers
TO snil3
Jrants SE.ECT !ermission on t'e table cstomers to t'e ser 7snil7) Dser 7snil7 does not
'a%e !ermission to insert" !date" delete or !erform an( ot'er o!eration on cstomers
table)

Ker(:
JRANT SE.ECT
ON cstomers
TO snil
WIT8 JRANT O1TION3 U&&&&&&&&&



Enables ser 7snil7 to #i%e SE.ECT !ermission on cstomers table to ot'er sers)
Ker(:
RE?OZE 4E.ETE U&&&&&&&&&&&&&
ON cstomers
FROM as'raf3
Ta-es awa( 4E.ETE !ermission on cstomers table from ser 7as'raf7)
5. 4eco$er" and &oncurrenc"
Reco%er( and Concrrenc( in a 4<MS are !art of t'e #eneral to!ic of transaction
mana#ement) 8ence we s'all be#in t'e discssion b( e$aminin# t'e fndamental notion
of a transaction)
F)5 Transaction
A transaction is a lo#ical nit of wor-)
Consider t'e followin# e$am!le:
T'e !rocedre for transferrin# an amont of Rs) 5;;G& from t'e accont of one cstomer
to anot'er is #i%en)

E^EC SK. W8ENE?ER SK.ERROR JOTO
DN4O
E^EC SK. D14ATE 4E1OSIT
SET <A.ANCE[<A.ANCE&5;;
W8ERE CDSTI4[fromYcst3
E^EC SK. D14ATE 4E1OSIT
SET <A.ANCE[<A.ANCE\5;;
W8ERE CDSTI4[toYcst:
E^EC SK. COMMIT3
JOTO FINIS8
DN4O:
E^EC SK. RO..<ACZ3
FINIS8:
RETDRN3
8ere" it 'as to be noted t'at t'e sin#le o!eration *amont transfer+ in%ol%es two database
!dates , !datin# t'e record of fromYcst and !datin# t'e record of toYcst) In
between t'ese two !dates t'e database is in an inconsistent (or incorrect in t'is e$am!le)
state) i)e)" if onl( one of t'e !dates is !erformed" one cannot sa( b( seein# t'e database
contents w'et'er t'e amont transfer o!eration 'as been done or not) 8ence to #arantee
database consistenc( it 'as to be ensred t'at eit'er bot' !dates are !erformed or none
are !erformed) If" after one !date and before t'e ne$t !date" somet'in# #oes wron# de
to !roblems li-e a s(stem cras'" an o%erflow error" or a %iolation of an inte#rit( constraint
etc)" t'en t'e first !date needs to be ndone)
T'is is tre wit' all transactions) An( transaction ta-es t'e database from one consistent
state to anot'er) It need not necessaril( !reser%e consistenc( of database at all
intermediate !oints) 8ence it is im!ortant to ensre t'at eit'er a transaction e$ectes in
its entiret( or is totall( cancelled) T'e set of !ro#rams w'ic' 'andles t'is forms t'e
transaction mana#er in t'e 4<MS) T'e transaction mana#er ses COMMIT and
RO..<ACZ o!erations for ensrin# atomicit( of transactions)
COMMIT , T'e COMMIT o!eration indicates sccessfl com!letion of a transaction
w'ic' means t'at t'e database is in a consistent state and all !dates made b( t'e
transaction can now be made !ermanent) If a transaction sccessfll( commits" t'en t'e
s(stem will #arantee t'at its !dates will be !ermanentl( installed in t'e database e%en
if t'e s(stem cras'es immediatel( after t'e COMMIT)
RO..<ACZ , T'e RO..<ACZ o!eration indicates t'at t'e transaction 'as been
nsccessfl w'ic' means t'at all !dates done b( t'e transaction till t'en need to be
ndone to brin# t'e database bac- to a consistent state) To 'el! ndoin# t'e !dates once
done" a s(stem lo# or /ornal is maintained b( t'e transaction mana#er) T'e before& and
after&ima#es of t'e !dated t!les are recorded in t'e lo#)
T'e !ro!erties of transaction can be smmarised as ACI4 !ro!erties & ACI4 standin# for
atomicit(" consistenc(" isolation and drabilit()
Atomicit(: A transaction is atomic) Eit'er all o!erations in t'e transaction 'a%e to be
!erformed or none s'old be !erformed)
Consistenc(: Transactions !reser%e database consistenc() i)e)" A transaction transforms a
consistent state of t'e database into anot'er wit'ot necessaril( !reser%in# consistenc( at
all intermediate !oints)
Isolation: Transactions are isolated from one anot'er) i)e)" A transaction7s !dates are
concealed from all ot'ers ntil it commits (or rolls bac-))
4rabilit(: Once a transaction commits" its !dates sr%i%e in t'e database e%en if t'ere
is a sbse2ent s(stem cras')
F)> Reco%er( from S(stem Failres
S(stem failres (also called soft cras'es) are t'ose failres li-e !ower ota#e w'ic' affect
all transactions in !ro#ress" bt do not !'(sicall( dama#e t'e database)
4rin# a s(stem failre" t'e contents of t'e main memor( are lost) T's t'e contents of
t'e database bffers w'ic' contain t'e !dates of transactions are lost) (Note:
Transactions do not directl( write on to t'e database) T'e !dates are written to database
bffers and" at re#lar inter%als" transferred to t'e database)) At restart" t'e s(stem 'as to
ensre t'at t'e ACI4 !ro!erties of transactions are maintained and t'e database remains
in a consistent state) To attain t'is" t'e strate#( to be followed for reco%er( at restart is as
follows:
Transactions w'ic' were in !ro#ress at t'e time of failre 'a%e to be ndone at t'e time
of restart) T'is is needed becase t'e !recise state of sc' a transaction w'ic' was acti%e
at t'e time of failre is no lon#er -nown and 'ence cannot be sccessfll( com!leted)
Transactions w'ic' 'ad com!leted !rior to t'e cras' bt cold not #et all t'eir !dates
transferred from t'e database bffers to t'e !'(sical database 'a%e to redone at t'e time
of restart)
T'is reco%er( !rocedre is carried ot wit' t'e 'el! of
S An online lo#file or /ornal , T'e lo#file maintains t'e before& and after&ima#es of t'e
t!les !dated drin# a transaction) T'is 'el!s in carr(in# ot t'e DN4O and RE4O
o!erations as re2ired) T(!ical entries made in t'e lo#file are :
Start of Transaction Mar-er
Transaction Identifier
Record Identifier
O!erations 1erformed
1re%ios ?ales of Modified 4ata (<efore&ima#e or Dndo .o#)
D!dated ?ales of Modified Records (After&ima#e or Redo .o#)
Commit G Rollbac- Transaction Mar-er
S Ta-in# a c'ec-!oint at s!ecific inter%als , T'is in%ol%es t'e followin# two o!erations:
a) !'(sicall( writin# t'e contents of t'e database bffers ot to t'e !'(sical database)
T's drin# a c'ec-!oint t'e !dates of all transactions" incldin# bot' acti%e and
committed transactions" will be written to t'e !'(sical database)
b)!'(sicall( writin# a s!ecial c'ec-!oint record to t'e !'(sical lo#) T'e c'ec-!oint
record 'as a list of all acti%e transactions at t'e time of ta-in# t'e c'ec-!oint)
F)F .oc-in#
.oc-in#: A soltion to !roblems arisin# de to concrrenc()
.oc-in# of records can be sed as a concrrenc( control tec'ni2e to !re%ent t'e abo%e
mentioned !roblems) A transaction ac2ires a loc- on a record if it does not want t'e
record %ales to be c'an#ed b( some ot'er transaction drin# a !eriod of time) T'e
transaction releases t'e loc- after t'is time)
.oc-s are of two t(!es
s'ared (S loc-)
and e$clsi%e (^ .oc-))
A transaction ac2ires a s'ared (read) loc- on a record w'en it wis'es to retrie%e or fetc'
t'e record)
An e$clsi%e (write) loc- is ac2ired on a record w'en a transaction wis'es to !date t'e
record) (8ere !date means INSERT" D14ATE or 4E.ETE))
F)C 4eadloc-s
.oc-in# can be sed to sol%e t'e !roblems of concrrenc() 8owe%er" loc-in# can also
introdce t'e !roblem of deadloc- as s'own in t'e e$am!le below)
4eadloc- is a sitation in w'ic' two or more transactions are in a simltaneos wait
state" eac' of t'em waitin# for one of t'e ot'ers to release a loc- before it can !roceed)
If a deadloc- occrs" t'e s(stem ma( detect it and brea- it) 4etectin# in%ol%es detectin# a
c(cle in t'e *Wait&For Jra!'+ (a #ra!' w'ic' s'ows 7w'o is waitin# for w'om7))
<rea-in# a deadloc- im!lies c'oosin# one of t'e deadloc-ed transactions as t'e %ictim
and rollin# it bac-" t'ereb( releasin# all its loc-s) T'is ma( allow some ot'er
transaction(s) to !roceed)
4eadloc- !re%ention can be done b( not allowin# an( c(clic&waits)
5. 1uer" #ptimi6ation
C)5 O%er%iew
W'en com!ared to ot'er database s(stems" 2er( o!timiAation is a stren#t' of t'e
relational s(stems) It can be said so since relational s(stems b( t'emsel%es do
o!timiAation to a lar#e e$tent nli-e t'e ot'er s(stems w'ic' lea%e o!timiAation to t'e
!ro#rammer) Atomatic o!timiAation done b( t'e relational s(stems will be mc' more
efficient t'an manal o!timiAation de to se%eral reasons li-e :
niformit( in o!timiAation across !ro#rams irres!ecti%e of t'e !ro#rammer7s e$!ertise in
o!timiAin# t'e !ro#rams)
s(stem7s abilit( to ma-e se of t'e -nowled#e of internal conditions (e#: %olme of data
at t'e time of 2er(in#) for o!timiAation) For t'e same 2er(" sc' conditions ma( be
different at different times of 2er(in#) (In a manal s(stem" t'is -nowled#e can be
tilised onl( if t'e 2er( is re&written eac' time" w'ic' is not !racticall( !ossible))
s(stem7s abilit( to e%alate lar#e nmber of alternati%es to find t'e most efficient 2er(
e%alation met'od)
In t'is c'a!ter we s'all loo- into t'e !rocess of atomatic 2er( o!timiAation done b( t'e
relational s(stems)
C)> An E$am!le of Ker( O!timiAation
.et s loo- at a 2er( bein# e%alated in two different wa(s to see t'e dramatic effect of
2er( o!timiAation)
Consider t'e followin# 2er()
Select OR44ATE" ITEM]" KTO
from OR4T<." OR4YITEMS
w'ere OR4T<.)OR4] [ OR4YITEMS)OR4]
and ITEM] [ 78W:73
Assm!tions:
T'ere are 5;; records in OR4T<.
T'ere are 5;";;; records in OR4YITEMS
T'ere are F; order items wit' item] 78W:7
Ker( E%alation , Met'od 5
T5 [ OR4T<. ^ OR4YITEMS
(1erform t'e 1rodct o!eration as t'e first ste! towards /oinin# t'e two tables)
& 5;;;; ^ 5;; t!le reads (5;;;;;; t!le reads &V #enerates 5;;;;;; t!les as
intermediate reslt)
& 5;;;;;; t!les written to dis- (Assmin# t'at 5;;;;;; t!les in t'e intermediate reslt
cannot be 'eld in t'e memor() 5;;;;;; t!le writes to a tem!orar( s!ace in t'e dis-))
T> [ OR4T<.)OR4] [ OR4YITEMS)OR4] @ ITEM] 78W:7(T5)
(A!!l( t'e two conditions in t'e 2er( on t'e intermediate reslt obtained after t'e first
ste!)
& 5;;;;;; t!les read into memor( (5;;;;;; t!le reads)
& F; selected (t'ose t!les satisf(in# bot' t'e conditions) F; 'eld in t'e memor( itself)
T: [ OR44ATE"ITEM]"KTO (T>)
(1ro/ection !erformed as t'e final ste!) No more t!le iGo s)
& F; t!les (final reslt)
Total no) of t!le iGo s [ 5;;;;;; reads \ 5;;;;;; writes \ 5;;;;;; reads
[ :;;;;;; t!le iGo s
Ker( E%alation , Met'od >
T5 [ ITEM][78W:7 (OR4YITEMS) (1erform t'e Select o!eration on OR4YITEMS as
t'e first ste!)
& 5;;;; t!le reads (5;;;; t!le reads from OR4YITEMS)
& F; t!les selected3 no dis- writes (F; t!les satisf( t'e condition in Select) No dis-
writes assmin# t'at t'e F; t!les formin# t'e intermediate reslt can be 'eld in t'e
memor()
T> [ OR4T<. MOIN T5
& 5;; t!le reads (5;; t!le reads from OR4T<.)
& resltin# relation wit' F; t!les
T: [ OR44ATE" ITEM]" KTO(T>)
(1ro/ection !erformed as t'e final ste!) No more t!le iGo s)
& F; t!les (final reslt)
Total no) of t!le iGo s [ 5;;;; reads \ 5;; reads
[ 5;5;; t!le iGo7s
Com!arison of t'e two Ker( E%alation Met'ods
5;"5;; t!le IGO7s (of Met'od >) %Gs :";;;";;; t!le IGO7s (of Met'od 5) B
T's b( se2encin# t'e o!erations differentl( a dramatic difference can be made in t'e
!erformance of 2eries)
8ere it needs to be noted t'at in t'e Met'od > of e%alation" t'e first o!eration to be
!erformed was a 7Select7 w'ic' filters ot F; t!les from t'e 5;";;; t!les in t'e
OR4YITEMS table) T's t'is o!eration cases elimination of 66F; t!les) T's
elimination in t'e initial ste!s wold 'el! o!timiAation)
Some more e$am!les: 5) select CITO" CODNT(T) from CDSTT<.
w'ere CITO B[ 7<OM<AO7
#ro! b( CITO3 %Gs select CITO" CODNT(T) from CDSTT<.
#ro! b( CITO
'a%in# CITO B[ 7<OM<AO73
>)
select T from OR4T<.
w'ere toYc'ar(OR44ATE"7dd&mm&((7)
[ 755&;9&6H73 %Gs select T from OR4T<.
w'ere OR44ATE [ toYdate(755&;9&6H7"
7dd&mm&((7)3
8ere t'e second %ersion is faster) In t'e first form of t'e 2er(" a fnction toYc'ar is
a!!lied on an attribte and 'ence needs to be e%alated for eac' t!le in t'e table) T'e
time for t'is e%alation will be t's !ro!ortional to t'e cardinalit( of t'e relation) In t'e
second form" a fnction toYdate is a!!lied on a constant and 'ence needs to be e%alated
/st once" irres!ecti%e of t'e cardinalit( of t'e relation) Moreo%er" if t'e attribte
OR44ATE is inde$ed" t'e inde$ will not be sed in t'e first case" since t'e attribte
a!!ears in an e$!ression and its %ale is not directl( sed)
C): T'e Ker( O!timiAation 1rocess
T'e ste!s of 2er( o!timiAation are e$!lained below)
a) Cast into some Internal Re!resentation , T'is ste! in%ol%es re!resentin# eac' SK.
2er( into some internal re!resentation w'ic' is more sitable for mac'ine mani!lation)
T'e internal form t(!icall( c'osen is a 2er( tree as s'own below)
Ker( Tree for t'e SE.ECT statement discssed abo%e:
b)Con%ert to Canonical Form , In t'is second ste!" t'e o!timiAer ma-es se of some
transformation laws or rles for se2encin# t'e internal o!erations in%ol%ed) Some
e$am!les are #i%en below)
(Note: In all t'ese e$am!les t'e second form will be more efficient irres!ecti%e of t'e
actal data %ales and !'(sical access !at's t'at e$ist in t'e stored database) )
Rle 5:
(A MOIN <) W8ERE restrictionYA AN4 restrictionY<
(A W8ERE restrictionYA) MOIN (< W8ERE restrictionY<)
Restrictions w'en a!!lied first" case eliminations and 'ence better !erformance)
Rle >:
(A W8ERE restrictionY5) W8ERE restrictionY>
A W8ERE restrictionY5 AN4 restrictionY>
Two restrictions a!!lied as a sin#le com!ond one instead a!!l(in# t'e two indi%idal
restrictions se!aratel()
Rle ::
(AW!ro/ectionY5X)W!ro/ectionY>X
AW!ro/ectionY>X
If t'ere is a se2ence of sccessi%e !ro/ections a!!lied on t'e same relation" all bt t'e
last one can be i#nored) i)e)" T'e entire o!eration is e2i%alent to a!!l(in# t'e last
!ro/ection alone)
Rle H:
(AW!ro/ectionX) W8ERE restriction
(A W8ERE restriction)W!ro/ectionX
Restrictions w'en a!!lied first" case eliminations and 'ence better !erformance)
Reference W5X #i%es more sc' #eneral transformation laws)
c)C'oose Candidate .ow&le%el 1rocedres , In t'is ste!" t'e o!timiAer decides 'ow to
e$ecte t'e transformed 2er() At t'is sta#e factors sc' as e$istence of inde$es or ot'er
access !at's" !'(sical clsterin# of records" distribtion of data %ales etc) are
considered)
T'e basic strate#( 'ere is to consider t'e 2er( e$!ression as a set of low&le%el
im!lementation !rocedres !redefined for eac' o!eration) For e#)" t'ere will be a set of
!rocedres for im!lementin# t'e restriction o!eration: one (sa(" !rocedre 7a7) for t'e case
w'ere t'e restriction attribte is inde$ed" one (sa(" !rocedre 7b7) w'ere t'e restriction
attribte is 'as'ed and so on)
Eac' sc' !rocedre 'as and associated cost measre indicatin# t'e cost" t(!icall( in
terms of dis- IGOs)
T'e o!timiAer c'ooses one or more candidate !rocedres for eac' low&le%el o!erations in
t'e 2er() T'e information abot t'e crrent state of t'e database (e$istence of inde$es"
crrent cardinalities etc)) w'ic' is a%ailable from t'e s(stem catalo# will be sed to ma-e
t'is c'oice of candidate !rocedres)
d)Jenerate Ker( 1lans and C'oose t'e C'ea!est , In t'is last ste!" 2er( !lans are
#enerated b( combinin# a set of candidate im!lementation !rocedres) T'is can be
e$!lained wit' t'e followin# e$am!le(A tri%ial one bt illstrati%e eno#'))
Assme t'at t'ere is a 2er( e$!ression com!risin# a restriction" a /oin and a !ro/ection)
Some e$am!les" of im!lementation !rocedres a%ailable for eac' of t'ese o!erations can
be assmed as #i%en in t'e table below)O!eration Condition E$istin#
Im!lementation 1rocedre
Restriction Restriction attribte is inde$ed a
Restriction Restriction attribte is 'as'edb
Restriction Restriction attribte is neit'er inde$ed nor 'as'ed c
Moin d
Moin e
1ro/ection f
1ro/ection #
Now t'e %arios 2er( !lans for t'e ori#inal 2er( e$!ression can be #enerated b(
ma-in# !ermtations of im!lementation !rocedres a%ailable for different o!erations)
T's t'e 2er( !lans can be
, adf
& ad#
, aef
, ae#
, bdf
)))
)))
It 'as to be noted t'at in realit(" t'e nmber of sc' 2er( !lans !ossible can be too man(
and 'ence #eneratin# all sc' !lans and t'en c'oosin# t'e c'ea!est will be e$!ensi%e b(
itself) 8ence a 'eristic redction of searc' s!ace rat'er t'an e$'asti%e searc' needs to
be done) Considerin# t'e abo%e e$am!le" one sc' 'eristic met'od can be as follows:
If t'e s(stem -nows t'at t'e restriction attribte is neit'er inde$ed nor 'as'ed" t'en t'e
2er( !lans in%ol%in# im!lementation !rocedre 7c 7 alone (and not 7a7 and 7b7) need to be
considered and t'e c'ea!est !lan can be c'osen from t'e redced set of 2er( !lans)
C)H Ker( O!timiAation in Oracle
Some of t'e 2er( o!timiAation measres sed in Oracle are t'e followin#:
,Inde$es nnecessar( for small tables) i)e)" if t'e siAe of t'e actal data record is not
mc' lar#er t'an t'e inde$ record" t'e searc' time in t'e inde$ table and t'e data table
will be com!arable) 8ence inde$es will not ma-e mc' difference in t'e !erformance of
2eries)
,Inde$esGclsters w'en retrie%in# less t'an >FE of rows) T'e o%er'ead of searc'in# in
t'e inde$ file will be more w'en retrie%in# more rows)
,Mlti!le colmn W8ERE clases
,e%alations casin# lar#est nmber of eliminations !erformed first
,MOIN&colmns s'old be inde$ed) MOIN colmns or Forei#n Ze( colmns ma( be
inde$ed since 2eries based on t'ese colmns can be e$!ected to be %er( fre2ent)
,Inde$ not sed in 2eries containin# ND.. G NOT ND..) Inde$ tables will not 'a%e
ND.. G NOT ND.. entries) 8ence need not searc' for t'ese in t'e inde$ table)

You might also like