65
1 © 2009 IBM Corporation A Model Driven Reverse Engineering framework for extracting business rules out of a Java application Valerio Cosentino - IBM, AtlanMod, INRIA & EMN, Nantes - [email protected] Jordi Cabot - AtlanMod, INRIA & EMN, Nantes - [email protected] Patrick Albert – IBM - [email protected] Philippe Bauquel – IBM - [email protected] Jacques Perronnet – IBM - [email protected] RuleML 2012, Montpellier, France – 29 August

A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

Embed Size (px)

Citation preview

Page 1: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

1

© 2009 IBM Corporation

A Model Driven Reverse Engineering framework for extracting business

rules out of a Java application

Valerio Cosentino - IBM, AtlanMod, INRIA & EMN, Nantes - [email protected] Cabot - AtlanMod, INRIA & EMN, Nantes - [email protected] Albert – IBM - [email protected] Bauquel – IBM - [email protected] Perronnet – IBM - [email protected]

RuleML 2012, Montpellier, France – 29 August

Page 2: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

2 © 2009 IBM Corporation

Outline

Introduction– Context & problem– Example– Business rule extraction process

Framework overview– Model discovery– Variable classification– Business rule identification– Business rule representation

Conclusion & Future work

Page 3: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

3 © 2009 IBM Corporation

Introduction - context & problem

Context: every organization needs to periodically reevaluate and evolve its company policies enforced in its Information System (IS) by means of a set of business rules

Page 4: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

4 © 2009 IBM Corporation

Introduction - context & problem

Context: every organization needs to periodically reevaluate and evolve its company policies enforced in its Information System (IS) by means of a set of business rules

Business rule: – « Relevant action aiming at constraining some precise aspect of a

business »– Key component for ISs

Page 5: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

5 © 2009 IBM Corporation

Introduction - context & problem

Context: every organization needs to periodically reevaluate and evolve its company policies enforced in its Information System (IS) by means of a set of business rules

Business rule: – « Relevant action aiming at constraining some precise aspect of a

business »– Key component for ISs

Problem: policies and rules must be aligned at all time, but in most of ISs business rules are scattered among the source code.

Page 6: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

6 © 2009 IBM Corporation

Introduction - context & problem

Context: every organization needs to periodically reevaluate and evolve its company policies enforced in its Information System (IS) by means of a set of business rules

Business rule: – « Relevant action aiming at constraining some precise aspect of a

business »– Key component for ISs

Problem: policies and rules must be aligned at all time, but in most of ISs business rules are scattered among the source code.

Hard to find the business rules within the IS even for small application

Page 7: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

7 © 2009 IBM Corporation

Introduction - context & problem

Context: every organization needs to periodically reevaluate and evolve its company policies enforced in its Information System (IS) by means of a set of business rules

Business rule: – « Relevant action aiming at constraining some precise aspect of a

business »– Key component for ISs

Problem: policies and rules must be aligned at all time, but in most of ISs business rules are scattered among the source code.

Hard to find the business rules within the IS even for small applicationHard to evolve (quickly and safely) company policies

Page 8: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

8 © 2009 IBM Corporation

Introduction - example

Page 9: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

9 © 2009 IBM Corporation

Introduction - example

Page 10: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

10 © 2009 IBM Corporation

Introduction - example

Rules modeling the application: – Hunters:

Never die Hunt animals

– Rabbits & Birds: Can die by being eaten by foxes, hunted by hunters, of

starvation, old age or overcrowding Can breed when they reach their breeding age Eat grass

– Foxes: Can die by being eaten by hunters, of starvation, old age or

overcrowding Can breed when they reach their breeding age Eat rabbits and birds

Page 11: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

11 © 2009 IBM Corporation

Introduction - example

Rules modeling the application: – Hunters:

Never die Hunt animals

– Rabbits & Birds: Can die by being eaten by foxes, hunted by hunters, of

starvation, old age or overcrowding Can breed when they reach their breeding age Eat grass

– Foxes: Can die by being eaten by hunters, of starvation, old age or

overcrowding Can breed when they reach their breeding age Eat rabbits and birds

Page 12: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

12 © 2009 IBM Corporation

Introduction – example

Page 13: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

13 © 2009 IBM Corporation

Introduction - example

Page 14: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

14 © 2009 IBM Corporation

Introduction - example

Page 15: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

15 © 2009 IBM Corporation

Introduction - example

Page 16: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

16 © 2009 IBM Corporation

Introduction - business rule extraction process

Business rule extraction (BREX) process: – Allows extracting business rules out of an IS, isolating the code

segments which are directly related to business– Three major activities:

Variable Classification → finds variables related to domain/business concepts and hintining at BRs

Business rule identification → collects chunks of code related to the variables identified in the previous step

Business rule representation → presents the extracted BRs by means of artifacts (graphs, textual representations, …)

Page 17: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

17 © 2009 IBM Corporation

Introduction - business rule extraction process

Business rule extraction (BREX) process: – Allows extracting business rules out of an IS, isolating the code

segments which are directly related to business– Three major activities:

Variable Classification → finds variables related to domain/business concepts and hintining at BRs

Business rule identification → collects chunks of code related to the variables identified in the previous step

Business rule representation → presents the extracted BRs by means of artifacts (graphs, textual representations, …)

Model Driven Engineering techniques:– Abstract & homogeneous representation– Modular solving process– Non-intrusive solution

Page 18: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

18 © 2009 IBM Corporation

Framework overview - model discovery

A new operation (Model Discovery) is added to the BRE process to move the problem from a grammarware technological space to the modelware one.– Input: source code– Output: platform specific model (PSM)

Page 19: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

19 © 2009 IBM Corporation

Framework overview - variable classification

Variables Classification identifies the domain variables together with their containing classes – Input: PSM– Output: model containing all domain's classes and their inner

variables

Page 20: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

20 © 2009 IBM Corporation

Framework overview - variable classification

Page 21: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

21 © 2009 IBM Corporation

Framework overview - variable classification

Page 22: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

22 © 2009 IBM Corporation

Framework overview - variable classification

Page 23: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

23 © 2009 IBM Corporation

Framework overview - variable classification

Page 24: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

24 © 2009 IBM Corporation

Framework overview - variable classification

Page 25: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

25 © 2009 IBM Corporation

Framework overview - variable classification

Page 26: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

26 © 2009 IBM Corporation

Framework overview - variable classification - metamodel

For each class in a group, its variables are classified in:– Single-access: class attributes occurring at most once on the left

side of an assignment– Multi-access: class attributes occurring more than once on the left

side of an assignment– Potentials: variables declarated in methods and occurring on the left

side of an assignment

Page 27: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

27 © 2009 IBM Corporation

Framework overview - variable classification - metamodel

For each class in a group, its variables are classified in:– Single-access: class attributes occurring at most once on the left

side of an assignment– Multi-access: class attributes occurring more than once on the left

side of an assignment– Potentials: variables declarated in methods and occurring on the left

side of an assignment

– Traceability: relates the classified variables to the source code

Page 28: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

28 © 2009 IBM Corporation

Framework overview - business rule identification

Page 29: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

29 © 2009 IBM Corporation

Framework overview - business rule identification

Domain model extraction:– Input: PSM, the domain variables model– Output:

Model conforming to the Business Object Model/Vocabulary [BOM/VOC] metamodel of IBM WebSphere ILOG Jrules

– Extracts method signatures and class attributes from the classes containing the domain variables identified in the variables classification step

– Provides a default vocabulary for these entities to be reused in the description of the business rules

– The user can tune the process and define its verbalization

Page 30: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

30 © 2009 IBM Corporation

Framework overview - business rule identification

Domain model extraction:

Page 31: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

31 © 2009 IBM Corporation

Framework overview - business rule identification

Slicing operation:– Input: PSM, a variable i contained in the domain variables model– Output:

PSM enriched with annotations (PSMA) on all the statements, variable declarations and methods relevant for i

Page 32: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

32 © 2009 IBM Corporation

Framework overview - business rule identification

Slicing operation:– Input: PSM, a variable i contained in the domain variables model– Output:

PSM enriched with annotations (PSMA) on all the statements, variable declarations and methods relevant for i (ex: alive)

Page 33: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

33 © 2009 IBM Corporation

Framework overview - business rule identification

Slicing operation:– Input: PSM, a variable i contained in the domain variables model– Output:

PSM enriched with annotations (PSMA) on all the statements, variable declarations and methods relevant for i

Page 34: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

34 © 2009 IBM Corporation

Framework overview - business rule identification

Slicing operation:– Input: PSM, a variable i contained in the domain variables model– Output:

PSM enriched with annotations (PSMA) on all the statements, variable declarations and methods relevant for i

Page 35: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

35 © 2009 IBM Corporation

Framework overview - business rule identification

Slicing operation:– Input: PSM, a variable i contained in the domain variables model– Output:

PSM enriched with annotations (PSMA) on all the statements, variable declarations and methods relevant for i

Page 36: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

36 © 2009 IBM Corporation

Framework overview - business rule identification

Slicing operation:– Input: PSM, a variable i contained in the domain variables model– Output:

PSM enriched with annotations (PSMA) on all the statements, variable declarations and methods relevant for i

Page 37: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

37 © 2009 IBM Corporation

Framework overview - business rule identification

Slicing operation:– Input: PSM, a variable i contained in the domain variables model– Output:

PSM enriched with annotations (PSMA) on all the statements, variable declarations and methods relevant for i

Page 38: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

38 © 2009 IBM Corporation

Framework overview - business rule identification

Slicing operation:– Input: PSM, a variable i contained in the domain variables model– Output:

PSM enriched with annotations (PSMA) on all the statements, variable declarations and methods relevant for i

Page 39: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

39 © 2009 IBM Corporation

Framework overview - business rule identification

Slicing operation:– Input: PSM, a variable i contained in the domain variables model– Output:

PSM enriched with annotations (PSMA) on all the statements, variable declarations and methods relevant for i

Page 40: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

40 © 2009 IBM Corporation

Framework overview - business rule identification

Page 41: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

41 © 2009 IBM Corporation

Framework overview - business rule identification

Page 42: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

42 © 2009 IBM Corporation

Framework overview - business rule identification

Page 43: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

43 © 2009 IBM Corporation

Framework overview - business rule identification

Page 44: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

44 © 2009 IBM Corporation

Framework overview - business rule identification

Page 45: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

45 © 2009 IBM Corporation

Framework overview - business rule identification

Page 46: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

46 © 2009 IBM Corporation

Framework overview - business rule identification

Page 47: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

47 © 2009 IBM Corporation

Framework overview - business rule identification

Page 48: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

48 © 2009 IBM Corporation

Framework overview - business rule identification

Page 49: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

49 © 2009 IBM Corporation

Framework overview - business rule identification

Page 50: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

50 © 2009 IBM Corporation

Framework overview - business rule identification

Page 51: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

51 © 2009 IBM Corporation

Framework overview - business rule identification

Page 52: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

52 © 2009 IBM Corporation

Framework overview - business rule identification

Page 53: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

53 © 2009 IBM Corporation

Framework overview - business rule identification

Business rules model extraction:

Page 54: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

54 © 2009 IBM Corporation

Framework overview - business rule identification

Business rules model extraction:– Input: Domain model and PSM enriched with annotations (PSMA) on

all the statements, variable declarations and methods relevant for i– Output:

Business rule model for the variable i

– PSMA contains information of classes outside the business domain. The domain model is used to exclude them

Page 55: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

55 © 2009 IBM Corporation

Framework overview - business rule identification

Classes related to the variable alive:

Page 56: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

56 © 2009 IBM Corporation

Framework overview - business rule identification

Classes outside the domain:

Page 57: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

57 © 2009 IBM Corporation

Framework overview - business rule identification

Classes inside the domain:

Page 58: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

58 © 2009 IBM Corporation

Framework overview - business rule identification

Intersection with the domain classes:

Page 59: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

59 © 2009 IBM Corporation

Framework overview - business rule identification - metamodel

Page 60: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

60 © 2009 IBM Corporation

Framework overview - business rule identification - metamodel

Page 61: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

61 © 2009 IBM Corporation

Framework overview

Business rules representation:

Business rules representation provides human-understandable artifacts (text and graph) for the extracted BRs.– Input: domain model (optional), business rule model-i– Output: text or graph

Page 62: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

62 © 2009 IBM Corporation

Framework overview

Text:

Page 63: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

63 © 2009 IBM Corporation

Framework overview

Graph:

Page 64: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

64 © 2009 IBM Corporation

Conclusion & Future work

MDE benefits:– Non-intrusive approach– Modular framework– Internal/external representation of BRs– Traceability

Test on a real use case:– IBM Rational Programming Patterns :

> 5000 classes, 476 system variables Variable classification step improved with new heuristics Optimization of the slicing operation

Future works:– Extend the framework to other languages– Identify BRs in the other layers composing an application

– Rational Programming Patterns :

Page 65: A Model Driven Reverse Engineering framework for extracting business rules out of a Java application

65 © 2009 IBM Corporation

Questions