You are on page 1of 67

ArchitectureDesign&

SequenceDiagram
Week7
Announcement Reminder
Announcement
MidtermI:
Midterm I:
1:00 1:50pmWednesday23rd March
Ch.1,2,3and26.5
Hour1,6,7and19(pp.331 335)
Multiplechoice
Agenda (Lecture)
Agenda(Lecture)
Architecturedesign
Architecture design
Sequencediagram
Agenda (Lab)
Agenda(Lab)
Create
Createausecase
a use caselevel
level(function
(functionlevel)
level)sequence
sequence
diagram(LabAssignment#7)foryourgroupproject.
Quizzes(hours9)
Q ( )
Weeklyprogressreport
Submittheprogressreportandsequencediagramby
Submit the progress report and sequence diagram by
theendoftheWednesdaylabsession.
Team Lab Assignment #7
TeamLabAssignment#7
Create
Createausecase
a use caselevel
level(function
(functionlevel)
level)sequence
sequence
diagram(LabAssignment#7)foryourgroupproject.
Duedate
Theendofthe3/9labsession
Topics covered
Topicscovered
Architecturaldesigndecisions
Architectural design decisions
Architecturalviews
Architectural patterns
Architecturalpatterns
Applicationarchitectures
Software architecture
Softwarearchitecture
The
Thedesignprocessforidentifyingthesub
design process for identifying the subsystems
systems
makingupasystemandtheframeworkforsub
systemcontrolandcommunicationisarchitectural
design.
Theoutputofthisdesignprocessisadescriptionof
the softwarearchitecture.
Architectural design
Architecturaldesign
An
Anearlystageofthesystemdesignprocess.
early stage of the system design process.
Representsthelinkbetweenspecificationanddesign
p
processes.
Oftencarriedoutinparallelwithsomespecification
activities.
Itinvolvesidentifyingmajorsystemcomponentsand
theircommunications.
Thearchitectureofapackingrobot
controlsystem
l
Architectural abstraction
Architecturalabstraction
Architecture
Architectureinthesmallisconcernedwiththe
in the small is concerned with the
architectureofindividualprograms.Atthislevel,we
areconcernedwiththewaythatanindividual
programisdecomposedintocomponents.
Architectureinthelargeisconcernedwiththe
architectureofcomplexenterprisesystemsthat
includeothersystems,programs,andprogram
components These enterprise systems are
components.Theseenterprisesystemsare
distributedoverdifferentcomputers,whichmaybe
owned and managed by different companies.
ownedandmanagedbydifferentcompanies.
Advantages of explicit architecture
Advantagesofexplicitarchitecture
Stakeholdercommunication
Architecturemaybeusedasafocusofdiscussionby
systemstakeholders.
Systemanalysis
S t l i
Meansthatanalysisofwhetherthesystemcanmeetits
nonfunctionalrequirementsispossible.
q p
Largescalereuse
Thearchitecturemaybereusableacrossarangeof
systems
Productlinearchitecturesmaybedeveloped.
Architectural representations
Architecturalrepresentations
Simple,informalblockdiagramsshowingentitiesand
p , g g
relationshipsarethemostfrequentlyusedmethod
fordocumentingsoftwarearchitectures.
Butthesehavebeencriticizedbecausetheylack
h h b db h l k
semantics,donotshowthetypesofrelationships
between entities nor the visible properties of entities
betweenentitiesnorthevisiblepropertiesofentities
inthearchitecture.
Dependsontheuseofarchitecturalmodels.The
requirementsformodelsemanticsdependsonhow
themodelsareused.
Box and line diagrams
Boxandlinediagrams
Very
Veryabstract
abstract theydonotshowthenatureof
they do not show the nature of
componentrelationshipsnortheexternallyvisible
propertiesofthesubsystems.
However,usefulforcommunicationwith
stakeholdersandforprojectplanning.
Use of architectural models
Useofarchitecturalmodels
Asawayoffacilitatingdiscussionaboutthesystem
y g y
design
Ahighlevelarchitecturalviewofasystemisusefulfor
communication with system stakeholders and project planning
communicationwithsystemstakeholdersandprojectplanning
becauseitisnotclutteredwithdetail.Stakeholderscanrelateto
itandunderstandanabstractviewofthesystem.Theycanthen
discussthesystemasawholewithoutbeingconfusedbydetail.
Asawayofdocumentinganarchitecturethathasbeen
designed
The
Theaimhereistoproduceacompletesystemmodelthatshows
aim here is to produce a complete system model that shows
thedifferentcomponentsinasystem,theirinterfacesandtheir
connections.
Architectural design decisions
Architecturaldesigndecisions
Architectural
Architecturaldesignisacreativeprocesssothe
design is a creative process so the
processdiffersdependingonthetypeofsystem
beingdeveloped.
However,anumberofcommondecisionsspanall
designprocessesandthesedecisionsaffectthenon
functionalcharacteristicsofthesystem.
Architectural design decisions
Architecturaldesigndecisions
Isthereagenericapplicationarchitecturethatcanbeused?
g pp
Howwillthesystembedistributed?
Whatarchitecturalstylesareappropriate?
Whatapproachwillbeusedtostructurethesystem?
Howwillthesystembedecomposedintomodules?
Whatcontrolstrategyshouldbeused?
Howwillthearchitecturaldesignbeevaluated?
How should the architecture be documented?
Howshouldthearchitecturebedocumented?
Architecture reuse
Architecturereuse
Systems
Systemsinthesamedomainoftenhavesimilar
in the same domain often have similar
architecturesthatreflectdomainconcepts.
Applicationproductlinesarebuiltaroundacore
pp p
architecturewithvariantsthatsatisfyparticular
customerrequirements.
Thearchitectureofasystemmaybedesigned
aroundoneofmorearchitecturalpatternsorstyles.
Thesecapturetheessenceofanarchitectureandcanbe
instantiatedindifferentways.
Discussedlaterinthislecture.
Discussed later in this lecture
Architectureandsystemcharacteristics
y
Performance
Localizecriticaloperationsandminimizecommunications.Uselarge
ratherthanfinegraincomponents.
Securityy
Usealayeredarchitecturewithcriticalassetsintheinnerlayers.
Safety
Localizesafetycriticalfeaturesinasmallnumberofsubsystems.
Localize safety critical features in a small number of sub systems
Availability
Includeredundantcomponentsandmechanismsforfaulttolerance.
Maintainability
Usefinegrain,replaceablecomponents.
Architectural views
Architecturalviews
Whatviewsorperspectivesareusefulwhendesigning
a e s o pe spec es a e use u e des g g
anddocumentingasystemsarchitecture?
Whatnotationsshouldbeusedfordescribing
architecturalmodels?
Eacharchitecturalmodelonlyshowsoneviewor
perspectiveofthesystem.
ti f th t
Itmightshowhowasystemisdecomposedintomodules,how
theruntimeprocessesinteractorthedifferentwaysinwhich
systemcomponentsaredistributedacrossanetwork.Forboth
designanddocumentation,youusuallyneedtopresentmultiple
viewsofthesoftwarearchitecture.
4+1viewmodelofsoftware
architecture
h
Alogicalview,whichshowsthekeyabstractionsin
g , y
thesystemasobjectsorobjectclasses.
Aprocessview,whichshowshow,atruntime,the
systemiscomposedofinteractingprocesses.
d f
Adevelopmentview,whichshowshowthesoftware
is decomposed for development
isdecomposedfordevelopment.
Aphysicalview,whichshowsthesystemhardware
p
andhowsoftwarecomponentsaredistributedacross
theprocessorsinthesystem.
Relatedusingusecasesorscenarios(+1)
Architectural patterns
Architecturalpatterns
Patterns
Patternsareameansofrepresenting,sharingand
are a means of representing, sharing and
reusingknowledge.
Anarchitecturalpatternisastylizeddescriptionof
p y p
gooddesignpractice,whichhasbeentriedand
testedindifferentenvironments.
Patternsshouldincludeinformationaboutwhen
theyareandwhenthearenotuseful.
Patternsmayberepresentedusingtabularand
graphicaldescriptions.
TheModelViewController(MVC)
pattern
Name MVC (Model-View-Controller)

Description Separates presentation and interaction from the system data. The system is
structured into three logical components that interact with each other. The
Model component manages the system data and associated operations on
that data. The View component
p defines and managesg how the data is
presented to the user. The Controller component manages user interaction
(e.g., key presses, mouse clicks, etc.) and passes these interactions to the
View and the Model. See Figure 6.3.
Example Figure 6.4 shows the architecture of a web-based application system
organized using the MVC pattern.
When used Used when there are multiple ways to view and interact with data. Also used
when the future requirements for interaction and presentation of data are
unknown.
Advantages Allows the data to change independently of its representation and vice versa.
versa
Supports presentation of the same data in different ways with changes made
in one representation shown in all of them.
Disadvantages Can involve additional code and code complexity when the data model and
interactions are simple.
p
TheorganizationoftheModelView
Controller
ll
Webapplicationarchitectureusingthe
MVCpattern
Layered architecture
Layeredarchitecture
Usedtomodeltheinterfacingofsubsystems.
g y
Organisesthesystemintoasetoflayers(orabstract
machines)eachofwhichprovideasetofservices.
Supportstheincrementaldevelopmentofsubsystemsin
differentlayers.Whenalayerinterfacechanges,onlythe
j y
adjacentlayerisaffected.
However,oftenartificialtostructuresystemsinthisway.
The Layered architecture pattern
TheLayeredarchitecturepattern
Name Layered architecture

Description Organizes the system into layers with related functionality


associated with each layer. A layer provides services to the layer
above it so the lowest-level layers represent core services that
are likely to be used throughout the system. See Figure 6.6.
Example A layered model of a system for sharing copyright documents
held in different libraries, as shown in Figure 6.7.
When used Used when building new facilities on top of existing systems;
when the development is spread across several teams with each
team responsibility for a layer of functionality; when there is a
requirement for multi-level security.
Advantages Allows replacement of entire layers so long as the interface is
maintained. Redundant facilities (e.g., authentication) can be
provided in each layer to increase the dependability of the
system.
system
Disadvantages In practice, providing a clean separation between layers is often
difficult and a high-level layer may have to interact directly with
lower-level layers rather than through the layer immediately
below it. Performance can be a problem because of multiple
levels of interpretation of a service request as it is processed at
each layer.
A generic layered architecture
Agenericlayeredarchitecture
The architecture of the LIBSYS system
ThearchitectureoftheLIBSYSsystem
Key points
Keypoints
Asoftwarearchitectureisadescriptionofhowa
softwaresystemisorganized.
ft t i i d
Architecturaldesigndecisionsincludedecisionsonthe
typeofapplication,thedistributionofthesystem,the
architecturalstylestobeused.
Architecturesmaybedocumentedfromseveraldifferent
perspectivesorviewssuch
p p asaconceptualview,alogical
p , g
view,aprocessview,andadevelopmentview.
Architecturalpatternsareameansofreusingknowledge
about generic system architectures. They describe the
aboutgenericsystemarchitectures.Theydescribethe
architecture,explainwhenitmaybeusedanddescribe
itsadvantagesanddisadvantages.
Repository architecture
Repositoryarchitecture
Subsystemsmustexchangedata.Thismaybedone
y g y
intwoways:
Shareddataisheldinacentraldatabaseorrepositoryand
may be accessed by all sub systems;
maybeaccessedbyallsubsystems;
Eachsubsystemmaintainsitsowndatabaseandpasses
dataexplicitlytoothersubsystems.
Whenlargeamountsofdataaretobeshared,the
repositorymodelofsharingismostcommonlyused
a this is an efficient data sharing mechanism
athisisanefficientdatasharingmechanism.
The Repository pattern
TheRepositorypattern
Name Repository

Description All data in a system is managed in a central repository that is


accessible to all system components. Components do not
interact directly, only through the repository.
Example Figure 6.9 is an example of an IDE where the components use
a repository of system design information. Each software tool
generates information which is then available for use by other
tools.
When used You should use this pattern when you have a system in which
large volumes of information are generated that has to be
stored for a long g time. You mayy also use it in data-driven
systems where the inclusion of data in the repository triggers
an action or tool.
Advantages Components can be independentthey do not need to know
of the existence of other components. Changes made by one
component can be propagated to all components.
components All data can
be managed consistently (e.g., backups done at the same
time) as it is all in one place.
Disadvantages The repository is a single point of failure so problems in the
repository affect the whole system. May be inefficiencies in
organizing all communication through the repository.
Distributing the repository across several computers may be
difficult.
A repository architecture for an IDE
ArepositoryarchitectureforanIDE
Clientserver
Client server architecture
Distributedsystemmodelwhichshowshowdataand
y
processingisdistributedacrossarangeof
components.
Canbeimplementedonasinglecomputer.
C b i l d i l
Setofstandaloneserverswhichprovidespecific
services such as printing data management etc
servicessuchasprinting,datamanagement,etc.
Setofclientswhichcallontheseservices.
Networkwhichallowsclientstoaccessservers.
Network which allows clients to access servers.
The Clientserver
TheClient serverpattern
pattern
Name Client-server

Description In a clientserver architecture, the functionality of the system is


organized into services, with each service delivered from a
separate server. Clients are users of these services and access
servers to make use of them.
Example Figure 6.11
6 11 is an example of a film and video/DVD library organized
as a clientserver system.
When used Used when data in a shared database has to be accessed from a
range of locations. Because servers can be replicated, may also be
used when the load on a system is variable.
Advantages The principal advantage of this model is that servers can be
distributed across a network. General functionality (e.g., a printing
service) can be available to all clients and does not need to be
implemented by all services.
Disadvantages Each service is a single point of failure so susceptible to denial of
service attacks or server failure. Performance may be unpredictable
because it depends on the network as well as the system. May be
management problems if servers are owned by different
organizations.
Aclientserverarchitectureforafilm
lb
library
Pipe and filter architecture
Pipeandfilterarchitecture
Functionaltransformationsprocesstheirinputsto
p p
produceoutputs.
Maybereferredtoasapipeandfiltermodel(asin
UNIXshell).
h ll)
Variantsofthisapproachareverycommon.When
transformations are sequential this is a batch
transformationsaresequential,thisisabatch
sequentialmodelwhichisextensivelyusedindata
processingsystems.
Notreallysuitableforinteractivesystems.
The pipe and filter pattern
Thepipeandfilterpattern
Name Pipe and filter

Description The processing of the data in a system is organized so that each


processing component (filter) is discrete and carries out one type of
data transformation. The data flows (as in a pipe) from one component
to another for processing.
Example Figure 6.13
6 13 is an example of a pipe and filter system used for
processing invoices.
When used Commonly used in data processing applications (both batch- and
transaction-based) where inputs are processed in separate stages to
generate related outputs.
Advantages Easy to understand and supports transformation reuse. Workflow style
matches the structure of many business processes. Evolution by
adding transformations is straightforward. Can be implemented as
either a sequential or concurrent system.
Disadvantages The format for data transfer has to be agreed upon between
communicating transformations. Each transformation must parse its
input and unparse its output to the agreed form. This increases system
overhead and may mean that it is impossible to reuse functional
transformations that use incompatible data structures.
Anexampleofthepipeandfilter
architecture
h
Application architectures
Applicationarchitectures
Applicationsystemsaredesignedtomeetan
pp y g
organizationalneed.
Asbusinesseshavemuchincommon,their
applicationsystemsalsotendtohaveacommon
l l d h
architecturethatreflectstheapplication
requirements.
Ageneric applicationarchitectureisanarchitecture
foratypeofsoftwaresystemthatmaybeconfigured
andadaptedtocreateasystemthatmeetsspecific
requirements.
Use of application architectures
Useofapplicationarchitectures
Asastartingpointforarchitecturaldesign.
gp g
Asadesignchecklist.
y g g p
Asawayoforganisingtheworkofthedevelopment
team.
Asameansofassessingcomponentsforreuse.
Asavocabularyfortalkingaboutapplicationtypes.
Examples of application types
Examplesofapplicationtypes
Dataprocessingapplications
Datadrivenapplicationsthatprocessdatainbatcheswithout
explicituserinterventionduringtheprocessing.
Transactionprocessingapplications
p g pp
Datacentredapplicationsthatprocessuserrequestsand
updateinformationinasystemdatabase.
Eventprocessingsystems
p g y
Applicationswheresystemactionsdependoninterpreting
eventsfromthesystemsenvironment.
Languageprocessingsystems
g g p g y
Applicationswheretheusersintentionsarespecifiedina
formallanguagethatisprocessedandinterpretedbythe
system.
Application type examples
Applicationtypeexamples
Focushereisontransactionprocessingandlanguageprocessing
systems.
Transactionprocessingsystems
EEcommerce
commercesystems;
systems;
Reservationsystems.
Languageprocessingsystems
Compilers;
Commandinterpreters.
Transaction processing systems
Transactionprocessingsystems
Processuserrequestsforinformationfroma
q
databaseorrequeststoupdatethedatabase.
Fromauserperspectiveatransactionis:
Anycoherentsequenceofoperationsthatsatisfiesagoal;
Forexample findthetimesofflightsfromLondonto
Paris.
Usersmakeasynchronousrequestsforservicewhich
arethenprocessedbyatransactionmanager.
Thestructureoftransactionprocessing
applications
l
ThesoftwarearchitectureofanATM
system
Information systems architecture
Informationsystemsarchitecture
Informationsystemshaveagenericarchitecturethat
y g
canbeorganizedasalayeredarchitecture.
Thesearetransactionbasedsystemsasinteraction
withthesesystemsgenerallyinvolvesdatabase
h h ll l d b
transactions.
Layersinclude:
Layers include:
Theuserinterface
Usercommunications
Informationretrieval
Systemdatabase
Layeredinformationsystem
architecture
h
The architecture of the MHCPMS
ThearchitectureoftheMHC PMS
Webbased
Web basedinformationsystems
information systems
Informationandresourcemanagementsystemsarenow
usuallywebbasedsystemswheretheuserinterfacesare
implementedusingawebbrowser.
Forexample,ecommercesystemsareInternetbased
p , y
resourcemanagementsystemsthatacceptelectronic
ordersforgoodsorservicesandthenarrangedeliveryof
thesegoodsorservicestothecustomer.
g
Inanecommercesystem,theapplicationspecificlayer
includesadditionalfunctionalitysupportingashopping
cart in which users can place a number of items in
cartinwhichuserscanplaceanumberofitemsin
separatetransactions,thenpayforthemalltogetherina
singletransaction.
Server implementation
Serverimplementation
These
Thesesystemsareoftenimplementedasmulti
systems are often implemented as multitier
tier
clientserver/architectures(discussedinChapter18)
Thewebserverisresponsibleforallusercommunications,
withtheuserinterfaceimplementedusingawebbrowser;
Theapplicationserverisresponsibleforimplementing
application specific logic as well as information storage
applicationspecificlogicaswellasinformationstorage
andretrievalrequests;
Thedatabaseservermovesinformationtoandfromthe
databaseandhandlestransactionmanagement.
Language processing systems
Languageprocessingsystems
Acceptanaturalorartificiallanguageasinputandgenerate
p g g p g
someotherrepresentationofthatlanguage.
Mayincludeaninterpretertoactontheinstructionsinthe
language that is being processed
languagethatisbeingprocessed.
Usedinsituationswheretheeasiestwaytosolveaproblemisto
describeanalgorithmordescribethesystemdata
Metacasetoolsprocesstooldescriptions,methodrules,etcand
generatetools.
Thearchitectureofalanguage
processingsystem
Compiler components
Compilercomponents
A
Alexicalanalyzer,whichtakesinputlanguagetokens
lexical analyzer, which takes input language tokens
andconvertsthemtoaninternalform.
Asymboltable,whichholdsinformationaboutthe
y ,
namesofentities(variables,classnames,object
names,etc.)usedinthetextthatisbeingtranslated.
Asyntaxanalyzer,whichchecksthesyntaxofthe
languagebeingtranslated.
Asyntaxtree,whichisaninternalstructure
representingtheprogrambeingcompiled.
Compiler components
Compilercomponents
A
Asemanticanalyzerthatusesinformationfromthe
semantic analyzer that uses information from the
syntaxtreeandthesymboltabletocheckthe
semanticcorrectnessoftheinputlanguagetext.
Acodegeneratorthatwalksthesyntaxtreeand
generatesabstractmachinecode.
A pipe and filter compiler architecture
Apipeandfiltercompilerarchitecture
Arepositoryarchitecturefora
languageprocessingsystem
Key points
Keypoints
Modelsofapplicationsystemsarchitectureshelpus
understandandcompareapplications,validate
applicationsystemdesignsandassesslargescale
componentsforreuse.
Transactionprocessingsystemsareinteractivesystems
thatallowinformationinadatabasetoberemotely
accessedandmodifiedbyanumberofusers.
y
Languageprocessingsystemsareusedtotranslatetexts
fromonelanguageintoanotherandtocarryoutthe
instructions specified in the input language. They include
instructionsspecifiedintheinputlanguage.Theyinclude
atranslatorandanabstractmachinethatexecutesthe
generatedlanguage.
Use Case Realization
UseCaseRealization
More
Moredetailsareaddedtoeachusecase,including
details are added to each use case, including
descriptionsoftheobjectsinvolvedincarryingout
theusecase.
Theprocessofextendingandrefiningusecasesis
calledusecaserealization.
Thenumberofsequencediagramsisequaltothe
thatofusecases.
Use Case Realization
UseCaseRealization
An
Aninteractiondiagram(sequencediagramor
interaction diagram (sequence diagram or
communicationdiagram)depictstherealizationofa
specificscenariooftheusecase.
Theprimarycontributionofusecaserealizationisto
helpdeveloperstomakeacompleteclassdiagram,in
particularlybyidentifyingobjectsthatcollaborate
andmessages(thatbecomemethodsorfunctions
for classes) and assigning them to specific classes
forclasses)andassigningthemtospecificclasses.
ProcessforDeveloping
SequenceDiagrams
Identifyanddecidetheobjectsthatcollaborate
Identify and decide the objects that collaborate
Identifyanddecidemessagesbetweenobjects
Messages
Methodscalls(synchronous)
Return(reply)signal
( p y) g
Sendingasignal(asynchronous)
Creatinganobject
Destroyinganobject
Sequence Diagram Topics
SequenceDiagramTopics
Topics
Objects,lifeline,focusofcontrol/activation,messages,
stateinvariants,combinedfragments,guardconditions,
interactionoperators(alternatives,options,break,parallel,
critical,assertion,loop),interactionoccurrences,
decompositions,continuations,parallel,sequence,etc.
p , ,p , q ,
ATM System
Startup

Operator Shutdown

Session

Customer
Invalid PIN
include

extend

Login Transaction
include
Bank

Withdrawal Deposit Transfer Inquiry


Money Log

CashDispenser EnvelopeAcceptor NetworkToBank

CustomerConsole OperatorPanel

ATMController
CardReader ReceiptPrinter
p Receipt
p

Card
Ca d Session
Sess o Transaction
a sact o

Withdrawal Deposit Transfer Inquiry

Account
SD ATMSystemStartup
SD ATM System Startup
sd System Startup

:OperatorPanel :ATMController :CashDispenser :NetworkToBank

access
switchon()

Operator
performStartup()

getInitialCash()

initialCash(iCash)
setInitialCash(iCash)

reply

openConnection()

reply
confirmation
sd System Shutdown

:OperatorPanel :ATM Controller :NetworkToBank

access
switchOff()

Operator
performShutdown()

closeConnection()

reply
reply
sd Session

:CardReader :ATMController :CustomerConsole

cardInserted()
:Session

<<create>>
User
performSession()

readCard()

sendCardInfo()

readPIN()

sendPIN()

OPT [while customer wants to perform transactions]


:Transaction

<<create>>

p
performTransaction()
()

doAgain()

[No further transaction]

ejectCard()

You might also like