180 likes | 338 Views
Discovering the Objectual Meaning of Foreign Keys in Enterprise Applications. Cristina Marinescu LOOSE Research Group Politehnica University of Timisoara, Romania. Risan, September 2007. What are Enterprise Applications?. Enterprise Applications(EA) [Fow03]
E N D
Discovering the Objectual Meaning of Foreign Keys in Enterprise Applications Cristina Marinescu LOOSE Research Group Politehnica University of Timisoara, Romania Risan, September 2007
What are Enterprise Applications? • Enterprise Applications(EA)[Fow03] • display, manipulation, storage of large & complex data • related to a business model • (automated) support of business process with that data • Characteristics • lots of persistent data • concurrent manipulation of data • lots of interface screens • Has 3 Layers: • Presentation ; Domain ; Data Source • Design Goals • Domain layer not affected by changes when... • user interface or persistency provider change • No mixing between persistency and application logic commands • hampers maintenance Discovering the Objectual Meaning of Foreign Keys in Enterprise Applications Risan, September 2007
DB Presentation Domain Data Source Business Logic Application Database Interaction User Application Interaction Layers of an Enterprise Applications • Object-Oriented Application • business logic in foreground • not much persistency involved • no clear separation of UI • Enterprise Application • Presentation layer • decoupling UI & business logic • two programming paradigms • object-oriented • relational • Data source layer • bridging btw. the two paradigms • Data Source Patterns • [Fow03, Noc03, Kel98, FMar02, AS06] Discovering the Objectual Meaning of Foreign Keys in Enterprise Applications Risan, September 2007
ClassSXX TableU TableN TableS ClassS Relations between Tables and Classes USED No Domain Class NOT USED . . . Object-Oriented Paradigm Relational Paradigm Discovering the Objectual Meaning of Foreign Keys in Enterprise Applications Risan, September 2007
Refined Semantics of Foreign Keys Discovering the Objectual Meaning of Foreign Keys in Enterprise Applications Risan, September 2007
Objectual Meaning of Foreign Keys • Benefits of the approach • Helps to refine the understanding of the database, leading to an easier maintenance and evolution of the database schema • Helps to better understand the key elements of the business model as these elements are the main constituents of the database schema Discovering the Objectual Meaning of Foreign Keys in Enterprise Applications Risan, September 2007
DATES: Supporting Design Analysis of Enterprise Systems • DATES • Design Analyses Tool For Enterprise Systems Discovering the Objectual Meaning of Foreign Keys in Enterprise Applications Risan, September 2007
Metamodel for Object-Oriented Applications • Metamodel • set of data structures • e.g. Package, Class, Attribute • data structures have fields • elementary • Class has a name • references to other related data structures • Class has attributes • Examples • MEMORIA • implemented in Java [Rat04] • FAMIX • implemented in Smaltalk [Tic01] Discovering the Objectual Meaning of Foreign Keys in Enterprise Applications Risan, September 2007
create table books ( ID int primary key, title varchar, author varchar, publisher varchar, year int) Database Example: Model Needs Source-Code and Database • class Book { • public String update(int id, String title, • String publisher) throws Exception { • ... • Connection con = ... ; //initializations • PreparedStatement updateStatement; • String update; • update = "UPDATE books SET title = ?, " + • "publisher = ? WHERE ID = ?"; • updateStatement = con.prepare(update); • updateStatement.setString(1, title); • updateStatement.setString(2, publisher); • updateStatement.setInt(3, id); • updateStatement.execute(); } • } Source Code Discovering the Objectual Meaning of Foreign Keys in Enterprise Applications Risan, September 2007
Metamodel for Enterprise Systems object-oriented model of code T1 T2 T3 T4 relational model of database Source Code Database interacts with extract extract ? interacts with Modeling the Structure of an Enterprise Application requires: 1. Object-Oriented Model (for source-code entities) 2. Relational Model (for database entities) 3. Connectors between the two models Discovering the Objectual Meaning of Foreign Keys in Enterprise Applications Risan, September 2007
Recovering the Meaning of Foreign Keys • 1 Detecting Relations between Tables and Source Code • Detect Data Keepers Classes • Find tables related to each Data Keeper • Find the Data Keepers for each table • 2 Detecting the Semantics of Foreign Key Relations Discovering the Objectual Meaning of Foreign Keys in Enterprise Applications Risan, September 2007
Detect Data Keepers Classes Class is formal parameter type in one or more public methods belonging to Data Source Layer Class is return type in one or more public methods belonging to Data Source Layer Class is local variable type in one or more public methods belonging to Data Source Layer Data Keeper Data Keepers-classes that store data from the database OR Discovering the Objectual Meaning of Foreign Keys in Enterprise Applications Risan, September 2007
Classes and Tables Related • Find tables related to each Data Keeper • Tables accessed from each data source layer method that either calls or is called by methods from the Data Keeper • Tables directly accessed from methods of the Data Keeper • Find the Data Keepers for each table • Based on the previous information Discovering the Objectual Meaning of Foreign Keys in Enterprise Applications Risan, September 2007
Detecting the Semantics of Foreign Keys Relations Discovering the Objectual Meaning of Foreign Keys in Enterprise Applications Risan, September 2007
Evaluation of the Approach • Case-Study Discovering the Objectual Meaning of Foreign Keys in Enterprise Applications Risan, September 2007
Findings in Payroll • Only D(Dependency) Relations found • each table involved in the classified constraint is used in the source code • there is at least a Data Keeper class associated to each table. • the data stored in each involved pair of tables is used together Discovering the Objectual Meaning of Foreign Keys in Enterprise Applications Risan, September 2007
Findings in CentraView • 41 A(Aggregation) Relations • 4 I(Inheritance) Relations • 7 D(Dependency) Relations Discovering the Objectual Meaning of Foreign Keys in Enterprise Applications Risan, September 2007
Discovering the Objectual Meaning of Foreign Keys in Enterprise Applications based on the paper accepted atWCRE 2007 - 14th Working Conference on Reverse Engineering, 2007 Cristina Marinescu LOOSE Research Group Politehnica University of Timisoara, Romania Risan, September 2007