An Examination of DSLs for Concisely Representing Model .ppt

上传人:terrorscript155 文档编号:378272 上传时间:2018-10-09 格式:PPT 页数:34 大小:591KB
下载 相关 举报
An Examination of DSLs for Concisely Representing Model .ppt_第1页
第1页 / 共34页
An Examination of DSLs for Concisely Representing Model .ppt_第2页
第2页 / 共34页
An Examination of DSLs for Concisely Representing Model .ppt_第3页
第3页 / 共34页
An Examination of DSLs for Concisely Representing Model .ppt_第4页
第4页 / 共34页
An Examination of DSLs for Concisely Representing Model .ppt_第5页
第5页 / 共34页
亲,该文档总共34页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

1、An Examination of DSLs for Concisely Representing Model Traversals and Transformations,Jeff Gray University of Alabama at Birmingham Gbor Karsai Vanderbilt University/ISISHICSS-36,This work is supported by the DARPA IXO, under the Program Composition for Embedded Systems (PCES) program, Contract Num

2、ber: F33615-00-C-1695Support for this project was also provided by Boeing.,Overview,Three DSLs in two different applications Applications: Tool integration and aspect-oriented domain modeling (AODM) Focus of DSLs: Generation of complex data structures from high-level specifications Synthesis of iter

3、ative processes Generation of API wrappers from high-level specs Quantitative description of generated code,Tool Integration,Tool Integration,MM,LRU,FR,FDE,Tool-X,LRU,VAR,Tool-Y,OBS,UNIT,MSG,ALR,Integrated Model,Integrated Model Server (IMS),AEFR,FMECA,ADVISE,GME,RELEX,Browser,COM,CORBA,ADO,ADO,Text

4、,Excel (csv),IMS,Tool Integration Framework (TIF),IMS models can be viewedin a web browser,New tools can access the IMSdirectly through the CMI,Legacy tools require a bi-directional tool adapter,The CMI is specified in CORBA IDL and definesrules and data structures for accessing the IMS,MS Repositor

5、y sits on top of an ODBC database; currently Access or SQL Server,CORBA,Tool Integration Framework (TIF),IMS models can be viewedin a web browser,New tools can access the IMSdirectly through the CMI,Legacy tools require a bi-directional tool adapter,The CMI is specified in CORBA IDL and definesrules

6、 and data structures for accessing the IMS,CORBA,Focus of this portion of the talk:,DSLs for representing tool models as stored in the CMI,DSLs for representing model translation as traversal/visitor specifications,Pieces of the Translation,Structure of the models: Objects to be traversed What are t

7、he possible paths for traversals? Traversal sequences: How to traverse? What are the desired paths for traversals? Visitors: Actions to be taken What to do? Phases of processing Multiple passes over the structure,Tool Specification (Structure),paradigm Foo; model Top_Model .part Component components

8、; model Component .part Entity_1 ent_1;part Entity_2 ent_2;part Component subComponents;rel Rel aRel entity Entity_1 . entity Entity_2 . relation Rel Entity_1 src 1Entity_2 dst *; ,Generation of Data Structures,paradigm RELEX; model RELEX_Model attr string Name; part RELEX_Object objects;part Failur

9、e_Mode failure_Modes;rel RELEX_Failure_Mode rel_FM; entity RELEX_Object attr string Name; attr string Part_Number;attr string User_Text;attr string Reference;attr double Failure_Rate; entity Failure_Mode attr string Failure_Mode; attr string Local_Effects; attr string Next_Effects;attr string End_Ef

10、fects; attr string Failure_Detection_Method; attr long Mode_Severity_Code;attr double Failure_Mode_Ratio; attr double Failure_Effect_Probability;attr double Failure_Rate; relation RELEX_Failure_Mode RELEX_Object Owner 1 Failure_Mode Failures *; ,int RELEX_Model_M:get_objects(vector ,Structured Speci

11、fication of Translators (Traversal/Visitor),visitor Visitor at Component. traverse.;at Entity_1.;at Entity_2.;at Rel.traverse.; ,traversal Traversal using Visitor from Top_Model - to components. ;from Component. to entity_1., entity_2., subComponents., rel.;from Rel. to src., dst. ; ,Generation of T

12、raversal/Visitors, from ComponentIMS:Component_M , void Traversal_T:traverse(GME_4_0:Component_M ,Achieved Goals - Tool Integration,Using a DSL, the underlying CORBA data structures and service calls that are needed to perform the model integration are hidden. Using a DSL, the often tedious and repe

13、titive code fragments that are needed for iteration and transformation can be more concisely/intuitively specified. Separation of concerns: Cleaner solution by separating semantic (translator) and syntactic (adapter) issues,Aspect-Oriented Domain Modeling,Please see October 2001 issue of Communicati

14、ons of the ACM,Model-Integrated Computing (MIC) with the Generic Modeling Environment (GME),Generic Modeling Environment (GME) is a domain-specific modeling toolGrew out of over 14 years of research on computer-based systems in aerospace, instrumentation, manufacturing and robotics.It can be utilize

15、d in many different domains by providing a meta-level paradigm description. Paradigm describes all of the entities of the domain, as well as valid relationshipsA modeler first loads the domain paradigm and then constructs new models in that domain,Available for download at http:/www.isis.vanderbilt.

16、edu,Please see November 2001 issue of IEEE Computer,Difficulties in Managing Constraints,A,B,c,d,e,1,2,3,B,c,d,e,1,2,4,F,B,c,d,e,1,2,3,4,Multiple Levels of Hierarchy,Replicated Structures,Context Sensitive,Change Maintenance?,Process of Using a Model Weaver,GME,Quantification Over Base Code (AOP),We

17、avers instrument code with advice,pointcut pubIntf(Object o): call(public * com.borland.*.*() ,after(Object o) throwing (Error e): pubIntf(o) log.write(o, e); ,Quantification Over a Domain Model (AODM),Apply AO Weaving concepts to Model-based systems Weavers Decorate Models with attributes & constra

18、ints Weavers compose new model constructs, select(p | p.name() = “Model*” ,Strategy1Strategy2Strategy3StrategyN,The Metaweaver Framework,Strategy Code Generator,XML Parser,Aspect Parser,Strategies (C+),Strategy Specifications,Specification Aspects,strategy ApplyConstraint(constraintName : string, ex

19、pression : string) addAtom(“OCLConstraint“, “Constraint“, constraintName).addAttribute(“Expression“, expression); strategy RemoveConstraint(constraintName : string) findAtom(constraintName).removeChild(); strategy ReplaceConstraint(constraintName : string, expression : string) RemoveConstraint(const

20、raintName);ApplyConstraint(constraintName, expression); ,XML (Model Hierarchy),Embedded Constraint Language,Included OCL Operators,Embedded Constraint Language (ECL),Traditional OCL has been strictly a declarative query language New uses require an imperative procedural style Addition of side effect

21、s into model Examples:addAtom(), findAtom()addAttribute(), findAttribute()removeNode() Support for recursion Chaining of strategies (procedure calls) Inlined C+ code,Generation of ECL, components.models(“)-select(c |c.id() = refID)-DetermineLaziness(); ,CComPtr mods=XMLParser:models(components,“); n

22、odeTypeVector selectVec1 = XMLParser:ConvertDomList(mods); nodeTypeVector selectVecTrue1 = new std:vector; vector:iterator itrSelect1; for(itrSelect1 = selectVec1-begin(); itrSelect1 != selectVec1-end(); itrSelect1+) nodeType selectNode1 = (*itrSelect1); nodeType c; c = selectNode1; CComBSTR id0 = X

23、MLParser:id(c); ClData varforward1(id0); ClData varforward2(refID); bool varforward3 = varforward1 = varforward2; if(varforward3) selectVecTrue1-push_back(*itrSelect1); vector:iterator itrCollCall1; for(itrCollCall1 = selectVecTrue1-begin(); itrCollCall1 != selectVecTrue1-end(); itrCollCall1+) Deter

24、mineLaziness:apply();,Achieved Goals - AODM,Using a DSL, the modeler is shielded from the details of the core XML Document Object Model (DOM) API calls. Using a DSL, the specification of the navigation within the domain models (while performing transformations) is raised to a higher level of abstrac

25、tion,Analysis of Generated Code,MSF to Generated Code,TVL to Generated Code,ECL to Generated Code,Concluding Remarks- Benefits of DSL use in these Two Projects,The tedious and mundane parts of writing a program are automated in the translation from the DSL to a traditional programming language. Repe

26、titive code sequences are generated automatically instead of the error-prone manual cut-and-paste method. The generation of such tedious code also has advantages in the maintenance phase of a projects lifecycle. Solutions can be constructed quickly because the programmer can more easily focus on the

27、 key abstractions. A DSL hides the underlying details of the solution space as implemented in a traditional programming language.,Concluding Quotes,Niklaus Wirth: We must recognize the strong and undeniable influence that our language exerts on our ways of thinking and, in fact, delimits the abstrac

28、t space in which we can formulate give form to our thoughts. George Polya: An important step in solving a problem is to choose the notation. It should be done carefully. The time we spend now on choosing the notation may be well repaid by the time we save later avoiding hesitation and confusion. Mor

29、eover, choosing the notation carefully, we have to think sharply of the elements of the problem which must be denoted. Thus, choosing a suitable notation may contribute essentially to understanding the problem. Ted Biggerstaff: The first order term in the success equation of reuse is the amount of d

30、omain-specific content and the second order term is the specific technology chosen in which to represent that content.,Additional Slides,Evaluating Tool Integration Solutions,How much time and effort does it cost to integrate a new tool? How scalable is the integration approach? How much expert know

31、ledge is needed to realize an integration solution? What is the coupling between the individual tools and the integration technology?,Development Effort,Translators can be written within a few man-days Average translator was 225 lines of traversal/visitor code Tool Adapter development depends on: Co

32、mplexity of tool Complexity of the tools data access mechanism (e.g., ADO, COM, comma separated values) Developer experience with previous Tool Adapters Our average development time for a bi-directional Tool Adapter is about 10 person-weeks,Lessons Learned,Successful integration of 5 tools Separation of concerns: Cleaner solution by separating semantic and syntactic issues Framework approach using software generators infrastructural elements tool-specific translators (componentized) traversal/visitor specification language,

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 教学课件 > 大学教育

copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
备案/许可证编号:苏ICP备17064731号-1