Escolar Documentos
Profissional Documentos
Cultura Documentos
:1 CASETOOLS
Introduction:
CharacteristicsofCASE:
Some of the characteristics of case tools that make it better than customized
developmentare;
Itisagraphicorientedtool.
Itsupportsdecompositionofprocess.
SometypicalCASEtoolsare:
Unified Modeling Language Data
modelingtools,and
Sourcecodegenerationtools
IntroductiontoUML(UnifiedModelingLanguage):
TheUMLisalanguageforspecifying,constructing,visualizing,anddocumentingthe
softwaresystemanditscomponents.TheUMLisagraphicallanguagewithsetsofrulesand
semantics.TherulesandsemanticsofamodelareexpressedinEnglishinaformknownas
OCL(ObjectConstraintLanguage).OCLusessimplelogicforspecifyingthepropertiesofa
system.TheUMLisnotintendedtobeavisualprogramminglanguage.Howeverithasa
muchclosermappingtoobjectorientedprogramminglanguages,sothatthebestofbothcan
beobtained.TheUMLismuchsimplerthanothermethodsprecedingit.UMLisappropriate
formodelingsystems,rangingfromenterpriseinformationsystemtodistributedwebbased
application and even to real time embedded system. It is a very expensive language
addressingallviewsneededtodevelopandthentodisplaysystemeventhoughunderstandto
use.LearningtoapplyUMLeffectivelystartsformingaconceptualmodeoflanguageswhich
requireslearning.
Threemajorlanguageelements:
UMLbasicbuildingblocks
Rulesthatdictatehowthisbuildingblocksputtogether
1
SomecommonmechanismthatapplythroughoutthelanguageThe
primarygoalsinthedesignofUMLare:
1. Providesusersreadytouse,expressivevisualmodelinglanguageas
wellsotheycandevelopandexchangemeaningfulmodels.
2. Provideextensibilityandspecializationmechanismstoextendthecore
concepts.
3. Beindependentofparticularprogramminglanguagesanddevelopment
processes.
4. Provideformalbasisforunderstandingthemodelinglanguage.
5. EncouragethegrowthoftheOOtoolsmarket.
6. Supporthigherleveldevelopmentconcepts.
7. Integratebestpracticesandmethodologies.
Everycomplexsystemisbestapproachedthroughasmallsetofnearlyindependent
viewsofamodel.Everymodelcanbeexpressedatdifferentlevelsoffidelity.Thebest
modelsareconnectedtoreality.TheUMLdefinesninegraphicaldiagrams:
1. Classdiagram
2. Usecasediagram
3. Behaviordiagram
3.1. Interactiondiagram
3.1.1. sequencediagram
3.1.2. collaborationdiagram
3.2. statechartdiagram
3.3. activitydiagram
4. Implementationdiagram
4.1 componentdiagram
4.2 deploymentdiagram
1. UMLclassdiagram:
2.Usecasediagram:
Thefunctionalityofasystemcanbedescribedinanumberofdifferentusecases,
eachofwhichrepresentsaspecificflowofeventsinasystem.Itisagraphofactors,asetof
usecasesenclosedinaboundary,communication,associationsbetweentheactorsandthe
usecases,andgeneralizationamongtheusecases.
3.Behaviordiagram:
Itisadynamicmodelunlikealltheothersmentionedbefore.Theobjectsofanobject
orientedsystemarenotstaticandarenoteasilyunderstoodbystaticdiagrams.Thebehavior
oftheclasssinstance(anobject)isrepresentedinthisdiagram.Every
2
usecaseofthesystemhasanassociatedbehaviordiagramthatindicatesthebehaviorof
the object. In conjunction with the usecase diagram we may provide a script or
interaction diagram to show a time line of events. It consists of sequence and
collaborationdiagrams.
4.Interactiondiagram
Itisthecombinationofsequenceandcollaborationdiagram.Itisusedtodepict
theflowofeventsinthesystemoveratimeline.Theinteractiondiagramisadynamic
modelwhichshowshowthesystembehavesduringdynamicexecution.
5.Statechartdiagram:
Itconsistsofstate,eventsandactivities.Statediagramsareafamiliartechniqueto
describethebehaviorofasystem.Theydescribeallofthepossiblestatesthataparticular
objectcangetintoandhowtheobject'sstatechangesasaresultofeventsthatreachthe
object.InmostOOtechniques,statediagramsaredrawnforasingleclasstoshowthe
lifetimebehaviorofasingleobject.
6.Activitydiagram:
Itshowsorganizationandtheirdependenceamongthesetofcomponents.These
diagramsareparticularlyusefulinconnectionwithworkflowandindescribingbehavior
thathasalotofparallelprocessing.Anactivityisastateofdoingsomething:eithera
realworldprocess,ortheexecutionofasoftwareroutine.
7.Implementationdiagram:
Itshowstheimplementationphaseofthesystemsdevelopment,suchasthesource
codestructureandtheruntimeimplementationstructure.Thesearerelativelysimplehigh
leveldiagramscomparedtotheothersseensofar.Theyareoftwosubdiagrams,the
componentdiagramandthedeploymentdiagram.
8.Componentdiagram:
These are organizational parts of a UML model. These are boxes to which a
modelcanbedecomposed.Theyshowthestructureofthecodeitself.Theymodelthe
physicalcomponentssuchassourcecode,userinterfaceinadesign.Itissimilartothe
conceptofpackages.
9.Deploymentdiagram:
Thedeploymentdiagramshowsthestructureoftheruntimesystem.Itshowsthe
configurationofruntimeprocessingelementsandthesoftwarecomponentsthatlivein
them. They are usually used in conjunction with deployment diagrams to show how
physicalmodulesofcodearedistributedonthesystem.
3
Notationelements:
TheseareexplanatorypartsofUMLmodel.Theyareboxeswhichmayapplyto
describeandremarkaboutanyelementinthemodel.Theyprovidetheinformationfor
understandingthenecessarydetailsofthediagrams.
RelationsintheUML:
ThesearefourkindsofrelationshipsusedinanUMLdiagram,theyare:
Dependency
Association
Generalization
Realization
Dependency:
Association:
Generalization:
Itisaspecializedrelationshipinwhichthespecializedelementsaresubstitutable
forobjectofthegeneralizedelement.Graphicallyitisasolidlinewithhollowarrowhead
parent.
Realization:
Itisasemanticrelationbetweenclassifiers.Graphicallyitisrepresentedasacross
betweengeneralizationanddependencyrelationship.
WhereUMLcanbeused:
UMLisnotlimitedtomodelingsoftware.Infactitisexpressivetomodelnon
softwaresuchastoshowinstructureandbehaviorofhealthcasesystemandtodesignthe
hardwareofthesystem.
4
ConceptualmodelbeUML:
UMLyouneedtoformtheconceptualmodelofUML.Thisrequiresthreemajor
elements:
UMLbasicbuildingblocks.
Rulesthatdictatehowthisbuildingblocksareputtogether.
Somecommonmechanismthatapplythroughoutthelanguage.
Onceyouhavegraspedtheseideas,youmaybeabletoread.UMLcreatesomebasic
ones. As you gain more experience in applying conceptual model using more advanced
featuresofthislanguage.
BuildingblocksoftheUML:
ThevocabularyofUMLencompassesthesekindsofbuildingblocks.
UseCASEdefinition:
Description:
Ausecaseisasetofscenariostiedtogetherbyacommonusergoal.Ausecaseisa
behavioraldiagramthatshowsasetofusecaseactionsandtheirrelationships.
Purpose:
Thepurposeofusecaseisloginandexchangemessagesbetweensenderandreceiver
(Emailclient).
Mainflow:
First,thesendergiveshisidandentershislogin.Now,heentersthemessagetothe
receiverid.
Alternateflow:
Iftheusernameandidbythesenderorreceiverisnotvalid,theadministratorwillnot
allowenteringandInvalidpasswordmessageisdisplayed.
Precondition:
ApersonhastoregisterhimselftoobtainaloginID.
Postcondition:
Theuserisnotallowedtoenterifthepasswordorusernameisnotvalid.
5
Classdiagram:
Description:
Aclassdiagramdescribesthetypeofobjectsinsystemandvariouskindsof
relationshipsthatexistsamongthem.
Class diagrams and collaboration diagrams are alternate representations of
objectmodels.
Duringanalysis,weuseclassdiagramtoshowrolesandresponsibilitiesofentities
thatprovideemailclientsystembehaviorsdesign.Weusetocapturethestructureofclasses
thatformtheemailclientsystemarchitecture.
Theclassesusedinsystemare:
1. user
2. login
3. s
4. ds
Aclassdiagramisrepresentedas:
<<Classname>>
<<Attribute1>>
<<Attributen>>
<<Operation()>>
Relationshipused:
Achangeinoneelementaffectstheother
Generalization:
Itisakindofrelationship
Statechart:
Description:
Thestatechartdiagrammadethedynamicbehaviorofindividualclasses.
Statechartshowsthesequencesofstatesthatanobjectgoesthrougheventsandstate
transitions.
Astatechartcontainsonestatestartandmultipleendstates.
6
Theimportantobjectivesare:
Decision:
Itrepresentsaspecificlocationstatechartdiagramwheretheworkflowmay
branchbaseduponguardconditions.
Synchronization:
Itgivesasimultaneousworkflowinastatechartdiagram.Theyvisuallydefine
forksandjointsrepresentingparallelworkflow.
Forksandjoins:
Aforkconstructisusedtomodelasingleflowofcontrol.
Everyworkmustbefollowedbyacorrespondingjoin.
Jointshavetwoormoreflowthatunitintoasingleflow.
State:
Astateisaconditionorsituationduringalifeofanobjectinwhichitsatisfies
conditionorwaitsforsomeevents.
Transition:
Itisarelationshipbetweentwoactivitiesandbetweenstatesandactivities.
Startstate:
Endstate:
Itisafinalorterminalstate.
Activitydiagram
Description:
Activitydiagramprovidesawaytomodeltheworkflowofadevelopment
process.Wecanalsomodelthiscodespecificinformationsuchasclassoperation
usingactivity diagram. Activity diagrams can model different types ofdiagrams.
Therearevarioustoolsinvolvedintheactivitydiagram.
Activity:
Anactivityrepresentstheperformanceofataskonduty.Itmayalsorepresent
7
theexecutionofastatementinaprocedure.
8
Decision:
Adecisionrepresentsacondition onsituationduringthelifeofanobject,
whichitsatisfiessomeconditionorwaitsforanevent.
Startstate:
Objectflow:
Anobjectonanactivitydiagramrepresentstherelationshipbetweenactivity
andobjectthatcreatesorusesit.
Synchronization:
Itenablesustoseeasimultaneousworkflowinanactivity.
Endstate:
Anendstaterepresentsafinalorterminalstateonanactivitydiagramorstate
chartdiagram.
Sequencediagram:
Description:
Thesequencediagramfortheemailclientsystemconsistsofthefollowing
objectives:
Object:
Anobjecthasstate,behaviorandidentity.Anobjectisnotbasedisreferredto
asaninstance.
Thevariousobjectsinemailclientsystemare:
User
Website
Login
Groups
9
Messageicon:
Amessageiconrepresentsthecommunicationbetweenobjectsindicatingthatan
actionwillfollow.Themessageiconisthehorizontalsolidarrowconnectinglifelines
together.
Collaborationdiagram:
Description:
Collaborationdiagramandsequencediagramsarealternaterepresentationsofan
interaction.Acollaborationdiagramisaninteractiondiagramthatshowstheorderof
messages that implement an operation or a transaction. Collaboration diagram is an
interactiondiagramthatshowstheorderofmessagesthatimplementanoperationora
transaction.Collaborationdiagramshowsobjects,theirlinksandtheirmessages.They
canalsocontainsimpleclassinstancesandclassutilityinstances.
During,analysisindicatesthesemanticsoftheprimaryandsecondaryinteractions.
Design,showsthesemanticsofmechanismsinthelogicaldesignofsystem.
Togglingbetweenthesequenceandcollaborationdiagrams
Whenweworkineitherasequenceorcollaborationdiagram,itispossibleto
viewthecorrespondingdiagrambypressingF5key.
10
EX.NO.:1 ATMSYSTEM
Aim:
TocreateasystemtoperformBankATMtransaction
Problemstatement:
Thissystemisbuildforthebankclientandthemanager.
Thebankclientmustbeabletodepositandwithdrawamountfromhis/her
accountsusingtheATMmachine.Eachtransactionmustberecordedandthe
clientmustbeabletoreviewalltransactionsperformedinhis/heraccount.
Recordedtransactionsmustincludethedate,time,transactiontype,amount
andaccountbalanceafterthetransaction.
ThebankmanagermustbeabletoviewtheATMmachinestatusthatisthe
totalbalanceoftheATMmachine,todayswithdrawal,todaysbalanceand
thelimitationsofthemachine.
Thebankclient isprovidedbyloginverification. Ifitisvalidhe/shewill
access their account otherwise an appropriate message is displayed to the
client.
USECASEdiagram:
TheATMtransactionusecasesinoursystemare:
1. Login
2. Withdraw
3. Ministatement
4. ATMmachinestatus
5. Deposit
Actorsinvolved:
1. User
2. Bankmanager
USECASEname:Login
Theuserentersausernameandpassword.Ifitisvalid,theusersaccountbecomes
available.Ifitisinvalid,anappropriatemessageisdisplayedtotheuser.
11
USECASEname:Withdraw
Theusertriestowithdrawanamountfromhisorhercheckingaccount.Theamountis
lessthanorequaltothecheckingaccountsbalance,thetransactionisperformedandthe
availableinformationisdisplayed.Thesystemcreatesarecordofthetransactionandthe
displayconfirmationmessageisdisplayedtotheclient.
USECASEname:Ministatement
Thebankuserrequestsahistoryoftransactionsforacheckingaccount.Thesystem
displaysthetransactionhistoryforthecheckingaccount.Thetransactionhistoryconsistsof
amount,date,transactiontypeandbalanceoftheparticularaccount.
USECASEname:ATMmachinestatus
Thebankmanagerentersausernameandpassword.Ifitisvalid,thebankmanager
accessesthemachinestatus.Ifitisinvalid,anappropriatemessageisdisplayedtotheuser.
USECASEname:Deposit
Thebankuserrequeststhesystemtodepositmoneytoanaccount.Theuseraccesses
theaccountforwhichadepositisgoingtobemadeandenterstheamount.Thesystem
creates a record of the transaction and an appropriate confirmation message (display
confirmation)isdisplayedtotheclient.Thetransactionmustincludethedate,type,amount
andaccountbalanceafterthetransaction.
12
UsecasediagramforATMsystem
13
Classdiagram
TheATMsystemclassdiagramconsistsoffourclasses:
1. Userclass
2. ATMmachinestatus
3. Account
4. Transaction
1) Userclass:
It consists of four attributes and two operations. The attributes are user name,
password,addressandDOB.Theoperationsofthisclassareread(),display()andwrite().
2)ATMmachinestatus:
TheattributesofthisclassareATMbalance,todayswithdrawal,todaysbalance,
and limitations. The operations are login verification (), ATM status () and display
confirmation().
3)Account:
Theattributesareaccountno.andbalanceandtheoperationsarewithdraw(),deposit
()anddisplayavailability().
4)Transaction:
Theattributesofthisclassareaccountno,transactiontype,data,amount,balanceand
theoperationsareministatement()andcreatetransaction().
14
ClassdiagramforATMsystem
15
Sequencediagram:
AsequencediagramrepresentsthesequenceandinteractionsofagivenUSECASE
orscenario.Sequencediagramscancapturemostoftheinformationaboutthesystem.Most
objecttoobjectinteractionsandoperationsareconsideredeventsandeventsincludesignals,
inputs,decisions,interrupts,transitionsandactionstoorfromusersorexternaldevices.
Aneventalsoisconsideredtobeanyactionbyanobjectthatsendsinformation.The
eventlinerepresentsamessagesentfromoneobjecttoanother,inwhichtheformobjectis
requestinganoperationbeperformedbythetoobject.
Thetoobjectperformstheoperationusingamethodthattheclasscontains.
Itisalsorepresentedbytheorderinwhichthingsoccurandhowtheobjectsinthe
systemsendmessagetooneanother.
The sequence diagram for each USECASE that exists when a user withdraws,
deposits,needsinformationaboutATMmachinestatusandaccountaredrowned.
16
Sequenceandcollaborationdiagramfordepositprocess
ThediagramsshowtheentiredepositprocessinanATMsystem.Theuserhasto
logintotheATMmachineanddeposittheamountofmoneyasrequiredbytheuser.Theuser
maywishtogetaministatementandascreenaboutthedetailsofthetransaction.
17
Sequenceandcollaborationdiagramforlogin
ThediagramsshowtheprocessofloginbytheusertotheATMsystem.Theuserhas
toenterhisdetails.Thedetailsenteredareverifiedbythesystemandtheuserisapprovedif
thedetailsmatch,otherwiseanappropriateerrormessageisdisplayed.
18
Sequenceandcollaborationdiagramforcheckingmachinestatus
TheAdministratoroftheATMsystemhastomaintainthedetailsabouttheATM,Hehasto
checkifthereisenoughmoneyintheATMandiftheATMisfunctionalwithoutmajor
errors.Forthis,hemaychecktheATMmachinestatusoccasionally.Theprocessisshownin
theabovediagrams.
19
Sequenceandcollaborationdiagramforprintingministatement
Afteratransactioniscarriedoutsuccessfully,theusermustgetaministatementtotellhim
hisaccountsdetailssuchasbalanceandtransactionnumber.Thisprocessisdepictedinthe
abovediagrams.
20
Sequenceandcollaborationdiagramforwithdrawprocess
21
Theusercanmakewithdrawmoneyfromhisaccount.Theprocessisdepictedinthe
diagramsabove.Theuserhastologintothesystemusinghisusernameandpassword,which
areverifiedbythesystem.Aftersuccessfulverification,theusercanchoosetheamountof
moneyhewantstowithdrawfromhisaccount.Theamountspecifiedbytheuserischecked
bythesystemtomakesurethereisenoughbalanceinhisaccounttocarryoutthetransaction.
After the transaction is carried out the resulting amount is displayed and the details are
updatedtothedatabase.
22
TABLES:
ACCOUNTTABLE
act_table
acctno bal
111 1380
888 8000
TRANSACTIONTABLE
tran_table
acctno t-date t-type t-amt t-bal
111 9/5/2009 wd 50 950
111 9/5/2009 wd 40 910
111 9/5/2009 wd 100 1010
111 9/5/2009 wd 30 980
111 9/5/2009 deposit 400 1380
USERTABLE
user_table
Username password acctno
Aaa bbb 111
Ram 666 888
CODING:
ACCOUNTCLASS:
OptionExplicit
PrivateacctnoAsString
PrivatebalAsInteger
PublicNewPropertyAsatm_mc
PublicNewProperty2AsNewtransaction
DimdbAsDatabase
DimrsAsRecordset
23
PublicSubwithdraw(amountAsInteger)
Setdb=OpenDatabase("C:\Jaga\atm.mdb")
Setrs=db.OpenRecordset("act_table")
rs.MoveFirst
DoWhileNotrs.EOF
Ifrs(0).Value=Trim(Form1.Label1.Caption)ThenIf
rs(1).Value>amountThen
rs.Edit
rs(0).Value=Trim(Form1.Label1.Caption)
rs(1).Value=rs(1).Valueamountrs.Update
MsgBoxrs(1).Value
CallNewProperty2.update_transaction(rs(0).Value,"wd",amount,
rs(1).Value)
Calldisplay_availability(1)
ExitDo
Else
Calldisplay_availability(0)
EndIf
EndIf
rs.MoveNext
Loop
rs.Close
db.Close
EndSub
PublicSubdeposit(amountAsInteger)
Setdb=OpenDatabase("C:\Jaga\atm.mdb")
Setrs=db.OpenRecordset("act_table")
rs.MoveFirst
DoWhileNotrs.EOF
Ifrs(0).Value=Trim(Form1.Label1.Caption)Then
rs.Edit
rs(1).Value=rs(1).Value+amount
rs.Update
CallNewProperty2.update_transaction(rs(0).Value,"deposit",amount,
rs(1).Value)
ExitDo
24
EndIf
rs.MoveNext
Looprs.Close
db.Close
EndSub
PublicSubdisplay_availability(flagAsInteger)
Ifflag=1Then
MsgBox"success"
Else
MsgBox"notavailable"
EndIf
EndSub
ATMCLASS:
OptionExplicit
Privatet_balAsInteger
Privatet_withAsInteger
PublicNewPropertyAsaccount
DimdbAsDatabase
DimrsAsRecordset
PublicSublogin_verify(usernameAsString,passwordAsString)
MsgBox"inside"
Setdb=OpenDatabase("C:\Jaga\atm.mdb")Set
rs=db.OpenRecordset("user_table")
rs.MoveFirst
DoWhileNotrs.EOF
Ifrs(0).Value=usernameThenIf
rs(1).Value=passwordThen
MsgBoxrs(0).Value
Form1.Label1.Caption=rs(2).Value
Form1.Hide
Form2.Show
ExitDo
EndIfEnd
Ifrs.MoveNext
Loop
EndSub
25
PublicSubcheck_mc_status()
EndSub
PublicSubdisplay_confirmation(flagAsInteger)
EndSub
TRANSACTIONCLASS:
OptionExplicit
Privatet_dateAsVariant
Privatet_typeAsVariant
Privatet_amtAsVariant
Privatet_balAsVariant
PublicNewPropertyAsaccount
DimdbAsDatabase
DimrsAsRecordset
PublicSubministatement(actnoAsString)
EndSub
PublicSubupdate_transaction(actnoAsString,ttypeAsString,amountAsInteger,bal
AsInteger)
Setdb=OpenDatabase("C:\Jaga\atm.mdb")Set
rs=db.OpenRecordset("tran_table")'adding
withdrawdetailintransactiontable
rs.AddNew
'MsgBoxDate
rs(0).Value=actno
rs(1).Value=DateIf
ttype="wd"Then
rs(2).Value="wd"
Else
rs(2).Value="deposit"
EndIf
rs(3).Value=amount
rs(4).Value=bal
rs.Update
'endofupdatingtransactiontable
26
rs.Close
27
db.Close
EndSub
PublicSubdisplay()
EndSub
PrivateSublogincmd_Click()
Dimlog1Asatm_mcSet
log1=Newatm_mc
MsgBox"hi"
Calllog1.login_verify(Trim(Text1.Text),Trim(Text2.Text))
EndSub
28
PrivateSubCommand1_Click()
DimactAsaccount
DimtnAstransaction
Setact=Newaccount
Settn=Newtransaction
IfOption1.Value=TrueThen
MsgBox"withdraw"
Callact.withdraw(Trim(Text1.Text))
Else
IfOption2.Value=TrueThen
MsgBox"deposit"
Callact.deposit(Trim(Text1.Text))
Else
IfOption3.Value=TrueThen
MsgBox"mini"
Calltn.ministatement(Form1.Label1.Caption)
EndIf
EndIf
EndIf
EndSub
RESULT:
29
ThusthesystemforATMiscreatedandexecuted.Theoutputisverified.
30