* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download - W&L CS Web Application Server
Serializability wikipedia , lookup
Tandem Computers wikipedia , lookup
Microsoft Access wikipedia , lookup
Entity–attribute–value model wikipedia , lookup
Oracle Database wikipedia , lookup
Extensible Storage Engine wikipedia , lookup
Functional Database Model wikipedia , lookup
Navitaire Inc v Easyjet Airline Co. and BulletProof Technologies, Inc. wikipedia , lookup
Microsoft SQL Server wikipedia , lookup
Ingres (database) wikipedia , lookup
Concurrency control wikipedia , lookup
Open Database Connectivity wikipedia , lookup
Microsoft Jet Database Engine wikipedia , lookup
Versant Object Database wikipedia , lookup
Relational model wikipedia , lookup
Database model wikipedia , lookup
Using AOP to Ease Evolution Presented by David Shepherd (QLI & UD) Co-Authors: Thomas Roper (QLI) and Lori Pollock (UD) Motivation for Evolution in the Field Databases with Records Of Cars Making a Distributed Database Application Issue: Stale Data DB Data DB North Carolina Detective Delaware ? notify Data Clerk App. Detective App. Update car data Non-Trivial Data Mining DB Update Hawaii DMV 2 Desired Evolution Task Notification Scheme DMV App DB Server Who is interested in these records? Can a database support this functionality? DetectApp Interesting Update Return Results Send Primary Keys Query DB Return Results No 3 Software Evolution Problem Have Open-Source Software (OSS) App Need to Modify Application Adding Feature(s) Open Source Software X Additional Feature(s) Issues OSS evolves independently Injection of feature Maintenance of feature Potential Solutions OOP vs. Aspect-Oriented Programming (AOP) 4 New Version of OSS Available Overview of Evolution Process AOP Process Original Open Source Software 1 1 OOP Process Feature Feature Feature Original Open Source Software New Version OSS New Version OSS2 Augmented Open Source Software 2 2 Augmented New Version OSS Augmented New Version OSS2 5 Possible OOP Solution SQLQuery DbServer notifyObservers executeQuery openConnection parseQuery getQuery executes notifies commitQuery addObserver SQLQuery DBObserver Notifies listeners addVar Original OSS Code Add Code into method try{ // Evaluate the sql query Table result = sql_executor. execute(db_conn, query); query.notifyObservers(result); error = false; return t; } Original OSS Code Clear … Add Code into method Add methods public class SQLQuery implements Subject{ ... public void notifyObservers(Table result){ //Get the primary keys, table, etc. ResultInfo resultInfo =... //Get query info from the query QueryInfo queryInfo =... //update all ... } public SQLQuery(){ addObserver(DatabaseDistributedNotifier. getInstance()); ... New Feature Code Add interface Add implementation of interface Public interface DBObserver{ … … } Public class MckoiDBObserver implements DBObserver { … … } 6 An Outcome of OOP Solution 2 packages 3 classes Blue lines represent our feature’s implementation This represents one .java file Taller = Longer file *needs to be Crosscutting Concern (CCC) added here 7 Another Outcome of OOP Solution Tangling Statement level Method level 8 AOP Solution ObserverProtocol SQLQuery execute Pointcut SubjectChange Prepare Pointcut updateObserver SQLQuery Pointcut registration DBObserver update KeyPointcut Feature: Only loosely coupled with OriginalPointcut OSS Pointcut DBObserverProtocol Pointcut subjectChange Pointcut updateObserver Key Pointcut registration Declare Subject Original Code Base Declare Observer Feature 2: Observer concern modularized Feature Implementation 9 Finding Code Insertion Points A First Step in implementation (for both methods) Database Codebase 10 Finding Insertion Point – A Closer Look Statement “Select”’s evaluate method /** * Evaluates the select statement with the given Database context. */ public Table evaluate() throws DatabaseException { Which place is better? DatabaseQueryContext context = new DatabaseQueryContext(database); // Check the permissions for this user to select from the tables in the Snippet from JDBCDatabaseInterface’s execQuery method . . . // given plan. … checkUserSelectPermissions(context, user, plan); try { boolean error = true; try { Table t = plan.evaluate(context); error = false; return t; } // Evaluate the sql query. Table result = sql_executor.execute(database_connection, query); // Put the result in the result cache... This will lock this object // until it is removed from the result set cache. Returns an id that // uniquely identifies this result set in future communication. // NOTE: This locks the roots of the table so that its contents // may not be altered. result_set_info = new ResultSetInfo(query, result); result_id = addResultSet(result_set_info); 11 OOP Process – Find Insertion Point 1 Answer Co-Worker’s Insert in most likely Continue Cutting and Pasting 2 Test 3 – 4Fail 5 Code Question About Another Remove place ... Project We removed an extra statement Ponder, where was I? (what is my working set) Causing two errors 12 AOP Process – Find Insertion Point 1 Answer Co-Worker’s Set Pointcut toContinue Most Changing Pointcut . Change Pointcut 5 2 Test 3 – 4Fail Question About Another Likely Place . . Project Only working with one file: Easy to remember working set 13 New OSS Version Available AOP Process Original Open Source Software OOP Process Feature Feature Feature Original Open Source Software New Version OSS New Version OSS2 Augmented Open Source Software 2 2 Augmented New Version OSS Augmented New Version OSS2 14 OOP Solution another outcome 1. Find Feature Code Process with OOP 2. Extract Feature Code 3. Find new insertion points 4. Insert Feature code Database Codebase New Database Codebase 15 Evolution of Codebase: AOP Solution New Code Well-Modularized Separate from main code base AOP: At worst, realign pointcut references Refers to main code base Database Codebase New Database Codebase 16 Concluding Remarks - Lessons Learned AOP saves effort when adapting an open-source project Eases Initial Maintenance Task - Add New Feature Non-Invasive Change Maintaining Working Set Eases Evolution - Adapt to OSS Change Finding the Feature Only Re-Align Pointcuts Status Working Implementation Continue to use in ongoing industry research AOP is AOK! 17 18 Slide graveyard 19 AOP Process – Find Insertion Point Snippet from JDBCDatabaseInterface’s execQuery method . . . … try { // Evaluate the sql query. Table result = sql_executor.execute(database_connection, query); query.notification(result); error=false; // Put the result in the result cache... This will lock this object // until it is removed from the result set cache. Returns an id that // uniquely identifies this result set in future communication. // NOTE: This locks the roots of the table so that its contents // may not be altered. result_set_info = new ResultSetInfo(query, result); result_id = addResultSet(result_set_info); } … 20 21 com.mckoi.jfccontrols com.mckoi.database.sql com.mckoi.database.jdbc com.mckoi.store com.mckoicom.mckoi.database com.mckoi.database.control com.mckoi.debug com.mckoi.database.interpret com.mckoi.database.global com.mckoi.toolscom.mckoi.util com.mckoi.database.jdbcserver com.mckoi.database.procedure com.mckoi.database.regexbridge com.mckoi.runtime com.mckoi com.mckoi.database com.mckoi.database.control com.mckoi.database.global com.mckoi.database.interpret com.mckoi.database.jdbc com.mckoi.database.jdbcserver com.mckoi.database.procedure com.mckoi.database.regexbridge com.mckoi.database.sql com.mckoi.debugc om.mckoi.jfccontrols 22 Possible Solutions Can a database support this functionality? SQLQuery notifyObservers DbServer executeQuery openConnection parseQuery commitQuery … try{ // Evaluate the sql query Table result = sql_executor.execute(db_conn, query); query.notifyObservers(result); error = false; return t; } getQuery addObserver removerObserver SQLQuery addVar translateObjectType clear public class SQLQuery implements Subject{ ... public void notifyObservers(Table result){ //Get the primary keys, table, etc. from results ResultInfo resultInfo =... //Get query info from the query QueryInfo queryInfo =... for(Iterator e = observers.iterator(); e.hasNext(); ){ ((DBObserver)e.next()). update(resultInfo,queryInfo); } } … public SQLQuery(){ addObserver(DatabaseDistributedNotifier. getInstance()); ... } 23 Quantum Leap Innovations – Business Model Technology Differentiated Products & Services Pioneering Software Technologies Research Programs Gov’t Agencies Partners End Users What We Do We create pioneering technologies that are used by our partners to build innovative products and services. How We Do It We support our partners as a team member by providing our unique IP, software technologies and people. Tom, am I allowed to show this? It was from the Template.ppt in J:\Presentations. 24