软件体系结构

出版社:浙江大学出版社
出版日期:2008-12
ISBN:9787308054539
作者:邢剑宽,郑翔覃征
页数:337页

章节摘录

  (3)It is easy to implement grammar. It is similar to define the class of every node in the abstract grammar tree, and these classes are easy to write directly. Generally, they can be automatically generated by compiler or grammar analysis generat or.  In this part, we will describe the roles in the Boolean expression system. Generally speaking, there are five roles in this type of system. The first one is BooleanExpression.This role declares an abstract Evaluate operation, this interface is shared by all the nodes of the Boolean expression abstract gammar tree. The second role is TerminaIExpression (such as VariableExpression and Constant).This type of role implements the Evaluation operation in the BooleanExpression that arerelated to terminals, every terminal in the Boolean Expression needs an objectinstance of this class. The third role is NonterminaIExpression(such asAndExpression,Or Expression and NotExpression). Every rule in the Booleanexpression grammar needs an object instance of NonterminalExpression, and we must maintain object instance of Boolean Expression for every symbolin every rulein the Boolean expression grammar.We also need to implement the Evaluate operation for every NonterminaIExpression in the grammar. In the NonterminaIExpressionEvaluate operation, we must call the Evaluate operation for every symbol in the grammar. The fourth role is context (this is "the inner state of interpreter engine") It includes the global information besides the interpreter. The fifth role is client. Client will constructs a special Boolean expression's abstract grammar tree in the Boolean expression's definition,and this abstract grammar tree is composed by theinstance objects of TerminalExpression and NonterminalExpression. The client willalso call the Evaluate operation.  The collaboration relationship between these five roles can be simply describedas follows:At first, the client constructs a Boolean Expression, which is an abstractgrammar tree which is composed by instances of TerminaIExpression andNonterminalExpression. Then the client initiates the context and calls interpret operation.Then every NonterminalExpression defines the Evaluate operation of theaccording expression, and all the Evaluate operation of the expression forms thebasis of-recursive evaluation.At last, the Evaluate operation of every node uses the context to store and access the states of interpreter system.  In this and the following part, we will introduce the implementation methods ofBoolean expression evaluation system. When encountering the real implementationof Boolean expression, we have many details to deal with, and the process qualityof these details directly influences the whole system's performance. Theseproblems are mainly incarnated in the following aspects:The first problem is to construct the abstract grammar tree. The interpreterstyle does not specify how to construct an abstract grammar tree in detail, that is tosay, the interpreter style does not involve syntax analysis. But when we areconstructing an abstract grammar tree, we need to use a table-driven grammaranalysis program to finish this task; we can also use the recursive decline grammaranalysis program to construct the abstract grammar tree.  The second problem is how to define the Evaluate operation.In fact, Evaluateoperation does not need to be defined and implemented in the expression's classes.If we need to construct a new interpreter frequently, we can use the Visitor style indesign pattern theory, put the Evaluate operation in an independent "Visitor"object, this method may be better. For instance, a program design language has manyoperations on abstract gammar tree, such as type check, code optimization andcode generation, etc. A proper way is to use a visitor, so as to avoid defining thisoperation in every class.  The third problem is the shared terminals. In some grammars, many terminalsmay occur in the same sentences (such as true and false in-Boolean expressionevaluation system).In this case, it is better to share the copy of that symbol. Theterminal nodes usually do not store their positions in the grammar tree, in theprocess of evaluation, any context information they required is transferred by theirparent nodes. So, the inner state and outer state in the terminal node are explicitlydifferent. We can implement those using Flyweight design patterns.  In the implementation of Boolean expression evaluation system, we define twooperations in the Boolean expression. The first operation is Evaluate, which evaluatethe value of the specified Boolean expression in the context, and this context mustprovide 6'true" or "false" for every variable. The second operation is Replace,which replaces a variable with an expression so as to generate new Booleanexpression. The Replace operation makes the system not only finish the evaluationof Boolean expression, but also do the grammar analysis of the Boolean expression.Because of the manuscript length constraint, we will not describe theimplementation details of each subclass. The interpreter style has an important characteristic: we can use manyoperations to "interpret" the same sentence. Among the three operations we definedin the BooleanExpression, the Evaluate operation is the basic operation in theprocess of computing Boolean Expression. It interprets a Boolean expression andreturns a simple result. But in the above system, we do not only have the Evaluateoperation, the replacement and copy can also be treated as interpreter, and the onlydifference is the interpretation for the sentence.  ……

书籍目录

1 Introduction to Software Architecture1.1A Brief History of Software Development1.1.1 The Evolution of-Programming Language——-'Abstract Level1.1.2 The Evolution of Software Development- Concerns1.1.3 The Origin and Growth of Software Architecture1.2 Introduction to Software Architecture1.2.1 Basic Terminologjes1.2.2 Understanding IEEE 1471-20001.2.3 Views Used in Software Architecture1.2.4 Why We Need Software Architecture1.2.5 Where Is Software Architecture in Software Life Cycle1.3 SummaryReferences2 Architectural Styles and Patterns2.1 Fundamentals of Architectural Styles and Patterns2.2 Pipes Filters2.2.1 Style Description2.2.2 Study Case2.3 Object-oriented2.3.1 Style Description2.3.2 Study Case2.4 Event-driven2.4.1 Style Description2.4.2 Study Case2.5 Hierarchical Layer2.5.1 Style Description2.5.2 Study Case2.6 Data Sharing2.6.1 Style Description2.6.2 Study Case2.7 Virtual Machine2.7.1 Style Description2.7.2 Study Case2.8 Feedback Loop2.8.1 Style Description2.8.2 Study Case2.9 Comparison among Styles2.10 Integration of Heterogeneous Styles2.11 SummaryReferences3 Application and Analysis of Architectural Styles3.1 Introduction to SMCSP3.1.1 Program Background3.1.2 Technical Routes3.1.3 Function Design3.2 System Realization3.2.1 The Pattern Choice3.2.2 Interaction Mechanism3.2.3Realization of Mobile Collaboration3.2.4 Knowledge-based Design3.3 SummaryReferences4 Software Architecture Description4.1 Formal Description of Software Architecture4.1.1 Problems in Informal Description4.1.2 Why Are Formal Methods Necessary4.2 Architectural Description Language4.2.1 Introduction to ADL4.2.2 Comparing among Typical ADLs4.2.3 Describing Architectural Behaviors4.3 Study Case: WRIGHT System4.3.1 Description of Component and Connector4.3.2 Description of Configuration4.3.3 Description of Style4.3.CSP-Semantic Basis of Formal Behavior Description4.4FEAL:An Infrastructure to Construct ADLs4.4.1 Design Purpose4.4.2 F EC4.4.3 FEAL Structure4.4.4 FEAL Mapper4.4.5 Examples of FEAL Application4.5 Summary……5 Design Strategies in Architecture Level6 Software Architecture IDE7 Evaluating Software Architecture8 Flexible Software Architecture9 A Vision on Software ArchitectureIndex

作者简介

软件体系结构(英文版),ISBN:9787308054539,作者:覃征、邢剑宽、郑翔

图书封面


 软件体系结构下载



发布书评

 
 


 

外国儿童文学,篆刻,百科,生物科学,科普,初中通用,育儿亲子,美容护肤PDF图书下载,。 零度图书网 

零度图书网 @ 2024