Download presentation
Presentation is loading. Please wait.
Published byLaura Lane Modified over 9 years ago
1
ANU comp2110 Software Design lecture 10 COMP2110 Software Design in 2004 lecture 10 Software Architecture 2 of 2 design lecture 5 of 6 Goal of this small course module: a descriptive understanding (not detailed application of a big library of examples). 1.Some existing software architectures: 1.batch and pipeline 2.client-server and broker – see the notes 3.layers – see the notes
2
ANU comp2110 Software Design lecture 10 Software Architecture – in general The decomposition of the design into groups of abstract modules (clusters of classes) modules are concepts, with names account management, playing field, characters potential for generality and reuse in other projects playing field, alarm control, selection list coherence and coupling stronger/more relationships between classes inside the module boundary than going in and out through the boundary
3
ANU comp2110 Software Design lecture 10 Elements of software architecture description of elements from which software systems are built interactions between those elements patterns that guide their composition constraints on those patterns In general, a system is defined in terms of a collection of components interactions between those components
4
ANU comp2110 Software Design lecture 10 Existing software architectures ( just a few ) dataflow systems batch sequential pipes and filters call-and-return systems main program and subroutines hierarchical layers independent components communicating systems Model View Controller example 1: lex,parse,generate notes 2: layers notes 3: broker example 2: MVC
5
ANU comp2110 Software Design lecture 10 Example 1: Lexical analysis, parsing, identification (1) a widespread class of problems require processing relatively complex sequences of character input by lexical analysis parsing identification of words (identifiers) examples: programming languages – for pretty print, syntax- sensitive editing, compilation, interpreting HTML, XML: for many kinds of further processing: rendering, editing
6
ANU comp2110 Software Design lecture 10 scan + parse + identify: batch architecture (2) Batch processing uses the schema: divide the processing into a number of processing stages that can be done in sequence. process all of the input in a batch as a whole through process 1, to produce a batch of intermediate data stage 1 process all of the intermediate data stage 1 through process 2... to produce a batch of intermediate data stage 2 in general process data stage i through process stage i+1 to produce data stage i+1
7
ANU comp2110 Software Design lecture 10 batch architecture input data stage 1 data stage 2 process 1 process 2process 3 character sequence lexical scan token sequence parse abstract syntax tree identify data stage 3 AST with tagged meanings
8
ANU comp2110 Software Design lecture 10 Stage 1 – lexical scan STARTTAG "p“ ATTR "color“ ATTRVAL "black“ ATTR "font“ ATTRVAL "Times“ DATA "This is it “ STARTTAG "pre“ DATA " no more code!“ COMMENT " but then...“ DATA " no more“ ENDTAG "pre“ DATA "that was it” ENDTAG "p" output sequence of tokens <p color="black“ font="Times“ This is it no more code! no more that was it lexical analysis input HTML source
9
ANU comp2110 Software Design lecture 10 Stage 2 – parse STARTTAG "p“ ATTR "color“ ATTRVAL "black“ ATTR "font“ ATTRVAL "Times“ DATA "This is it “ STARTTAG "pre“ DATA " no more code!“ COMMENT " but then...“ DATA " no more“ ENDTAG "pre“ DATA "that was it” ENDTAG "p" input sequence of tokens parse ATTRVAL "black“ ATTR "color“ ATTRVAL "Times“ ATTR "font“ ATTRIBSEQ 2 DATA "This is it“ DATA " no more code! “ COMMENT " but then...“ DATA " no more“ ELEMENT "pre" 3 DATA "that was it“ ELEMENT "p" 4 phrase structure (syntax tree) (this is a syntax tree, in postfix notation: indentation added for human reader)
10
ANU comp2110 Software Design lecture 10 Pipeline architecture in a pipeline, the processes produce the same input and output as the batch processes but as sequences, not as complete batches The processes operate incrementally: later processes can start before the earlier ones have finished. the batch architecture is a limiting case of the pipeline
11
ANU comp2110 Software Design lecture 10 pipeline architecture input data stage 1 data stage 2 process 1 process 2process 3 character sequence lexical scan token sequence parse abstract syntax tree identify data stage 3 AST with tagged meanings
12
ANU comp2110 Software Design lecture 10 pipeline ctd the processes are not always in lock step: the scanner will need to consume a variable number of characters for each token the parser may need to consume several tokens before it can produce any parse tree the architectures can be mixed: e.g in WebView lexical scanner-> parser Pipeline -> renderer Batch
13
ANU comp2110 Software Design lecture 10 batch vs pipeline performance: space (batch: big) and time responsiveness: pipeline has fast first output may need whole structure to apply variety of last stage processes – suggests batch at the last may need overview across whole of input pipeline may be too complex to program
14
ANU comp2110 Software Design lecture 10 batch vs pipeline performance: space (batch: big) and time responsiveness: pipeline has fast first output may need whole structure to apply variety of last stage processes – suggests batch at the last may need overview across whole of input pipeline may be too complex to program
15
ANU comp2110 Software Design lecture 10 example 2: Model-View-Controller Architecture Recall the example of a spreadsheet program Model - the core application part underlying data, functional core of application registers dependent views and controllers notifies views and controllers when data changes View - the graphical part of the interface creates its controllers displays information (about the model) to the user updates itself when notified that the model changes retrieves data (gets state) from the model Controller - the decision-making part accepts user inputs and other events translates events into service requests for the model or display requests for the view (from comp2100 notes and JMT book)
16
ANU comp2110 Software Design lecture 10 Using an existing architecture in a high-level design How to document the use of an architecture in a high level design: name the architectural model you use e.g. Model View Controller name which modules play which roles e.g. the Model is module CentralControlStates the View is module UserInterfaceManager the Controller is the ControlLogicManager module state any major differences from the architecture
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.