90 likes | 210 Views
A Declarative Meta-Programming Approach to Framework Documentation. Tom Tourw é & Tom Mens {tom.tourwe,tom.mens}@vub.ac.be Programming Technology Lab Vrije Universiteit Brussel. Motivation. Framework Documentation Often non-existent Outdated, due to constant evolution
E N D
A Declarative Meta-Programming Approach to Framework Documentation Tom Tourwé & Tom Mens {tom.tourwe,tom.mens}@vub.ac.be Programming Technology Lab Vrije Universiteit Brussel
Motivation • Framework Documentation • Often non-existent • Outdated, due to constant evolution • Not integrated in the development process Problems for evolution & instantiation of the framework! Tom Tourwé
Proposed Solution • Use declarative meta programming (DMP) • To document a framework’s design accurately and concisely • By means of design patterns used in the framework • Use the available information actively • Check completeness/correctness of the documentation w.r.t. the source code Concrete DMP Environment used: SOUL Tom Tourwé
Why DMP? • Declarative • Represent knowledge in a straightforward and concise way • Powerful reasoning capabilities • Infer extra information from available information • Tight Integration • Of SOUL with the development environment • Allows to consult the source code Tom Tourwé
Documenting the Design Tom Tourwé
Documenting the Design dpRole([instance],[role],[source code artifact]) dpRole(astVisitor,abstractElement,ScExpression). dpRole(astVisitor,concreteElement,ScConsExpression). dpRole(astVisitor,concreteElement,ScBlockExpression). ... dpRole(astVisitor,acceptMethod,nodeDo:). dpRole(astVisitor,abstractVisitor,AbstractASTEnumerator). dpRole(astVisitor,concreteVisitor,SchemeToSmalltalkConverter). dpRole(astVisitor,visitMethod,doConsExpression:). dpRole(astVisitor,visitMethod,doBlockExpression:). ... dpRelation(astVisitor,<ScConsExpression,doConsExpression:>). dpRelation(astVisitor,<ScBlockExpression,doBlockExpression:>). Tom Tourwé
Consult documentation Consult implementation Documenting the Design • Rather verbose • Use full power of DMP instead dpRole(astVisitor,abstractElement,ScExpression). … dpRole(?instance,concreteElement,?concreteElement) if dpInstance(?instance,visitorDP), dpRole(?instance,abstractElement,?root), hierarchy(abstractElement,?concreteElement), concreteClass(?concreteElement). Tom Tourwé
Checking Completeness • Describe “required” roles • By means of logic facts • Check documentation for their presence • By means of logic rules • Report missing roles requiredRole(visitorDP,abstractElement). requiredRole(visitorDP,abstractVisitor). requiredRole(visitorDP,acceptMethod). checkPatternInstance(?pattern, ?instance, ?role) if requiredRole(?pattern,?role), not(dpRole(?instance,?role)) Tom Tourwé
Consult documentation Check implementation Checking Consistency • Identify appropriate design constraints • Implement them by means of logic rules • Report conflicts & suggest possible actions patternConstraint(visitorDP,?instance, noAcceptMethod(?concreteElement,?acceptSelector)) if dpRole(?instance,acceptMethod,?acceptSelector), dpRole(?instance,concreteElement,?concreteElement), not(classImplements(?concreteElement,?acceptSelector)) Tom Tourwé