1. Preliminary Dissertation Proposal Exam Facilitating Maintenance and Evolution of Non-Functional Concerns (NFCs) in Modern Enterprise Applications Myoungkyu Song SW Innovations Lab, Dept. of Computer Science, Virginia Tech Committee Members Dr. Eli Tilevich, Chair Virginia Tech Dr. Stephen H. Edwards Virginia Tech Dr. Dennis G. Kafura Virginia Tech Dr. Barbara G. Ryder Virginia Tech Dr. Kwangkeun Yi Seoul National Univ., South Korea SW I-Lab April, 28 2011, 2225@KWII
3. Business Logic NFC Example: Persistence +Metadata (XML) public class ManagerBean extends javax.ejb.EntityBean { private Long orderId; private String status; public ManagerBean(){...} ... } <entity> <class name=“ManagerBean” table=“Manager”> <field name=“orderId” primary-key=“true”> <column name=“ORDERID”/> </field> <field name=“status”> <column name=“STATUS”/> </field> ... </entity> 3
4. Problem: Address maintenance and evolution challenges of implementing non-functional concerns (NFCs) declaratively Thesis statement: Domain-specific languages can facilitate the maintenance and evolution of NFC implementations in modern enterprise applications Dissertation Objective 4
5.
6.
7.
8. Pattern-Based Structural Expressions (PBSE) A novel metadata language based on queries against the main program; easier to program, understand, maintain, and reuse. The Structural Enhancement Rule (SER) language A DSL for documenting bytecode enhancements; enables source-level prog. understanding and debugging tools Reusing NFCs Across Languages An approach to reusing NFCs across languages through automated metadata translation Contributions 8
16. Business Logic Limitation of Enterprise Metadata 10 + Metadata (Java 5 Annotation) publicclassManagerEJB { public String getOrderId(){ return orderId; } public String getStatus(){ return status; } @Entity @Table(name="Manager") @Id @Column(name="orderId", primaryKey=true) @Column(name="status", primaryKey=false)
17. A PBSE Script Example 01 Metadata MyJPA<Package p> 02 Class c in p 03 Where (public *EJB) 04 c += @Table 05 @Table.name = (c.name =~ s/EJB$//) 06 Column<c> 07 08 Metadata Column<Class c> 09 Field f in c 10 Where (private * *) 11 Method m in c 12 Where((“get” + (f.name =~ s/^[a-z]/[A-Z]/)) == m.name) 13 m += @Column @Column.name = f.name 15 Where(public * get*Id ()) 16 @Column.primKey = true 17 m += @Id 18 MyJPA <"package1"> 11
27. Programmable Use OO and declarative query programming Understandable Encode relationship between program constructs and their metadata Maintainable Express explicit structural information Reusable Leverage naming conventions of framework dependent code Pattern-Based Structural Expressions 13
33. A SER Script Example 01 02 03 04 05 06 07 08 09 10 11 12 13 Program JDO Using SUPER_JDO_SER Begin EnhClass = OrgClass EnhClass.AddInterface (“javax.jdo.spi.PersistenceCapable”) Var PatternfieldP Begin modifiers= (“private” or “protected”) and not “static” End VarIterator fieldIter = OrgClass.Fields(fieldP) EnhClass.AddMethod(FieldSetReplacer(“jdoSet”, fieldIter)) EnhClass.AddMethod(FieldGetReplacer(“jdoGet”, fieldIter)) End 16
56. Leveraging SER for Maintenance SER Script SER Parser Enhanced Bytecode Source Code Enhancement Program Constructs Bytecode Processor Src. code Processor Original Source code Bytecode to Src. Map Symbol Table Original Source Code SER Interpreter Enhancement Information 20
57. Symbolic Debugger for Enhanced Bytecode A standard debugger : JDB The newly added methods The skip instruction Our symbolic debugger The changed method The reverse instruction 21
58.
59. Metadata Non-Functional Concerns Annotation @Table Confi- gure Security Testing C# Attributes [Author ( … Enterprise Application Fault Tolerance Persistence XML <column=… <field=…/> Functional Concerns Intermediate Representation (Bytecode) Source Code Compiler Emerging languages(ELs) cross-compiled to mainstream languages(MLs) NFCs, such as security, testing, and persistence implemented in target MLs NFCs specified through metadata EL unable to access ML’s NFC implementations EL programmers waste development effort reimplementing NFCs A novel approach reusing NFC implementations across languages by automatically translating metadata Research Plan 23
63. Step 1:Metadata Translation Framework 25 Program in Source Language Metadata in Source Language <<tag>> Program Cross- Compile Metadata Cross- Compile Program in Target Language 1...n Metadata in Target Language 1...n <<tag>>
70. Reuse NFCs of Testing: JUnit (Java Unit Testing Framework) & CppUnit (C++ Unit Testing Framework) Transparent Persistence: JDO (Java Data Objects) & ODB (ORM system for C++) Evaluation Plan 29
71. Reusing UnitTest Framework 30 The class to be tested publicclass IntegrateTest { var parm : double; var expt : double; var integrate : Integrate; defthis(parm : double, expt : double) { this.parm = parm; this.expt = expt; } publicdef testComputeArea() { val result = integrate.computeArea(0, this.parm); TUnit.assertEquals(this.expt, result); } publicstatic def data() { val parm = new Array[double](0..1*0..2); parm(0, 0) = 2; parm(0, 1) = 6.000000262757339; ...}} publicclass Integrate { staticdef computeArea(left:double, right:double) { return recEval(left, (left*left + 1.0) * left, right, (right*right + 1.0) * right, 0); } staticdef recEval(l:double,.. r:double,..) { // .. finish { async{expr1 = recEval(c, fc, r, fr, ar); }; expr2 = recEval(l, fl, c, fc, al); } return expr1 + expr2; }} The method to be tested Parameterizing
72. Reusing UnitTestFramework: PBSE Spec. 31 cont’d MetadataUnitTest<Package p> Class c in p Where(public class *Test) c += @RunWith @RunWith.value = "Parameterized" TestMethod<c> Metadata TestMethod<Class c> Method m in c Where (public def init ()) m += @Before Where (public def finish ()) m += @After Where (public def test* ()) m += @Test Where (public static def data ()) m += @Parameters UnitTest<“package1"> Parameterization
73. Reusing Transparent Persistence 32 publicclass Fmm3d{ def getDirectEnergy() : Double{ val model = new FmmModel(); val directEnergy = finish (SumReducer()){ ateach (p1 in locallyEssentialTrees) { varthisPlaceEnergy : Double = 0.0; for ([x1,y1,z1] in lowestLevelBoxes.dist(here)){ val box1 = lowestLevelBoxes(x1,y1,z1) as FmmLeafBox; for ([atomIndex1] in 0..(box1.atoms.size()-1)){ for (p in uList){ for ([otherBoxAtomIndex] in 0..(boxAtoms.size-1)){ thisPlaceEnergy += atom1.charge * atom2Packed.charge / atom1.centre.distance(atom2Packed.centre); }}} model.setModelId(id(box1.x,box1.y,box1.z)); model.setEnergy(thisPlaceEnergy); //... TP.setFmmModelObj(model); Long Comput- ation Part Transparently Persistent