V. Vranić — AspectJ Paradigm Model — GCSE 2001 AspectJ Paradigm Model A Basis for Multi-Paradigm Design for AspectJ Valentino Vranić Department of Computer Science and Engineering Faculty of Electrical Engineering and Information Technology Slovak University of Technology in Bratislava
V. Vranić — AspectJ Paradigm Model — GCSE Presentation Overview Multi-paradigm design Feature modeling Multi-paradigm design with feature modeling AspectJ paradigm model Transformational analysis An example: Text editing buffers Conclusions
V. Vranić — AspectJ Paradigm Model — GCSE Multi-Paradigm Design (MPD) MPD for C++ (J. O. Coplien) Programming paradigms: –Large-scale paradigms –Small-scale paradigms Scope, commonality, variability, and relationship (SCVR) analysis Transformational analysis
V. Vranić — AspectJ Paradigm Model — GCSE Family table (from solution domain SCVR analysis) Transformational Analysis in MPD Parameters of VariationMeaningDomainBindingDefault BindingCommonalityVariabilityInstantiationLanguage Mechanism P1 Generalization of P1 (values P1 can take) (default value for P1) … Variability tables (from application domain SCVR analysis) Domain D1 (main commonality of D1) …
V. Vranić — AspectJ Paradigm Model — GCSE Feature Modeling A conceptual modeling technique Feature diagrams –directed trees with edge decorations –root = concept, other nodes = features –common and variable features –variation points Other information –Semantic description –Rationale –Constraints –Default dependency rules –Binding mode –Instantiation
V. Vranić — AspectJ Paradigm Model — GCSE MPD with Feature Modeling Feature models instead of tables and informal description Both feature modeling and SCVR analysis are based on commonalities and variabilities SCVR analysis and feature modeling: –scope concept –commonality common feature –variability variable feature –relationship feature diagrams hierarchy
V. Vranić — AspectJ Paradigm Model — GCSE Family table MPD and MPD with Feature Modeling Parameters of VariationMeaningDomainBindingDefault variation point semantic description, rationale alternative features binding mode default dependency rules Variability table Domain D1 (main commonality of D1 concept) BindingCommonalityVariabilityInstantiationLanguage Mechanism common feature binding mode variable feature additional information concept
V. Vranić — AspectJ Paradigm Model — GCSE AspectJ Paradigm Model
V. Vranić — AspectJ Paradigm Model — GCSE AspectJ Paradigm Model: Class Paradigm
V. Vranić — AspectJ Paradigm Model — GCSE AspectJ Paradigm Model: Aspect Paradigm
V. Vranić — AspectJ Paradigm Model — GCSE Transformational Analysis Prerequisites: –Solution domain feature model –Application domain feature model Matching of application domain feature model nodes with the solution domain feature model nodes –Points to the paradigms to be used for application domain structures –Two nodes match if they conceptually represent the same thing
V. Vranić — AspectJ Paradigm Model — GCSE Matching the Nodes 1. Select a node F from the application domain feature model 2. Try to match F’s children with the children of some node P that represents a paradigm in the solution domain feature model 3. If a match has been found for all of the F’s children, then F matches with P 4. A paradigm that represented by P should be used to implement feature F
V. Vranić — AspectJ Paradigm Model — GCSE The Process of Transformational Analysis Find the matching for all of the nodes in the application domain feature model Try to match the application domain nodes with the paradigms of “higher order” — the paradigms based on other paradigms (inheritance and overloading in AspectJ) Translate the results of the transformational analysis into the code: –directly –through a specific design method pointed to by MPD
V. Vranić — AspectJ Paradigm Model — GCSE An Example: Text Editing Buffers Represent a state of a file being edited Employ different working set management schemes Use different character sets Load and save the contents into a file Maintain a record of the number of lines and characters, cursor position, etc.
V. Vranić — AspectJ Paradigm Model — GCSE
V. Vranić — AspectJ Paradigm Model — GCSE
V. Vranić — AspectJ Paradigm Model — GCSE read status name contents File write status name contents
V. Vranić — AspectJ Paradigm Model — GCSE
V. Vranić — AspectJ Paradigm Model — GCSE
V. Vranić — AspectJ Paradigm Model — GCSE
V. Vranić — AspectJ Paradigm Model — GCSE
V. Vranić — AspectJ Paradigm Model — GCSE
V. Vranić — AspectJ Paradigm Model — GCSE
V. Vranić — AspectJ Paradigm Model — GCSE
V. Vranić — AspectJ Paradigm Model — GCSE whole file Working Set Management DC whole page LRU fixed …
V. Vranić — AspectJ Paradigm Model — GCSE
V. Vranić — AspectJ Paradigm Model — GCSE Feature diagrams alone do not fully determine the code skeleton What other sources are there? Variability dependency graphs Other information in feature model
V. Vranić — AspectJ Paradigm Model — GCSE Variability Dependency Graph Text Editing Buffer FileCharacter Set Debugging Code Working Set Management
V. Vranić — AspectJ Paradigm Model — GCSE class TextBuffer { public: yield(...) {...}; replace(...) {...}; loadFile(...) {...}; saveFile(...) {...}; private: int numLines, numChars, curPosition;... } class WholeFileTextBuffer extends TextBuffer { public: WholeFileTextBuffer(File f, CharacterSet c) {...}; yield(...) {...}; replace(...) {...};... }...
V. Vranić — AspectJ Paradigm Model — GCSE class File { public: Status readFile(String name, TextBuffer buff) {...} Status writeFile(String name, TextBuffer buff) {...}... } class UnixFile extends File {... }... aspect DebuggingCode {... } aspect WorkingSetDebug extends DebuggingCode {... } aspect WholeFileDebug extends WorkingSetDebug {... }...
V. Vranić — AspectJ Paradigm Model — GCSE Conclusions A new representation for the solution and application domain in MPD –Based on feature modeling –Involves a new transformational analysis AspectJ paradigm model Further research: –Noting of the transformational analysis results –Incorporating the MPD’s negative variability tables and variability dependency graphs –Relationship between the MPD and generative programming