Upload
blackberry
View
146
Download
0
Embed Size (px)
Citation preview
1
An Empirical Study on the Practice of Maintaining Object-Relational Mapping
Code in Java Systems
Mohamed Nasser, Parminder Flora
Tse-Hsun(Peter) Chen Ahmed E. HassanWeiyi Shang Jinqiu Yang Michael W. Godfrey
2
Databases are essential in modern large-scale software systems
Database
3
Object-Relational Mapping (ORM) eliminates the gap between objects and SQL
Database
• Less boilerplate code • Object-DB translations are done automatically
JavaClasses
Benefits over raw SQLs
ORM
Much less code and shorter development time
ORM provides another layer of abstraction
4
ORM
Database mapping code@Table(name = “user”)
Performance configurationquery.cache()
ORM query codeUser u = q.getSingleResult();
5
ORM is not a silver bullet
Using ORM comes with some hidden costs…
We have been working on helping developers improve ORM code for the past few years
Developers are often not aware of database access
Wow! I don’t need to worry
about DB code!
ORM code with performance anti-patterns
6
Bad system performance
The performance impact can be SIGNIFICANT (ICSE 2014)!
ORM is hard to configure
7
Hundreds of ORM performance-related
configuration
Un-optimal ORM configuration is common and causes significantly performance
problem (TSE 2016)!
Bad system Performance if
configured incorrectly
Studying maintenance activities of Java ORM code
8
Expect: ORM-related changes are localized
Expect: Frequently tuning configurations
Expect: Tooling support due to ORM
popularity
Studied Java systems
Large open-source e-commence system Enterprise system
9
Portal Content management system
Studying maintenance activities of Java ORM code
10
Expect: ORM-related changes are localized
Expect: Frequently tuning configurations
Expect: Tooling support due to ORM
popularity
Lack of bug detection tool support for Java ORM
11
Coverity PMD Google error-prone
Facebook InferFindBugs
More than 67% of Java developers use ORM, but there is limited tooling support (ICSE SEIP 2016)
Studying maintenance activities of Java ORM code
12
Expect: ORM-related changes are localized
Expect: Frequently tuning configurations
Expect: Tooling support due to ORM
popularity
No! There is limited tooling
support
Studying maintenance activities of Java ORM code
13
Expect: ORM-related changes are localized
Expect: Frequently tuning configurations
Expect: Tooling support due to ORM
popularity
No! There is limited tooling
support
ORM configurations are rarely tuned
14
Most ORM code changes are related to ORM queries (35%) and ORM database mapping code (55%)
ORM performance configurations are rarely tuned (less than 10%)
Studying maintenance activities of Java ORM code
15
Expect: ORM-related changes are localized
Expect: Frequently tuning configurations
Expect: Tooling support due to ORM
popularity
No! There is limited tooling
support
No! ORM configurations
are rarely tuned
Studying maintenance activities of Java ORM code
16
Expect: ORM-related changes are localized
Expect: Frequently tuning configurations
Expect: Tooling support due to ORM
popularity
No! There is limited tooling
support
No! ORM configurations
are rarely tuned
ORM code changes are more scattered
17
Series10
2
4
6
8
10
12
14
ORMnon-ORM
Med
ian
mod
ified
file
s in
a co
mm
it
Such high change scatteredness may be caused by ORM’s inability to completely
abstract DB accesses
Studying maintenance activities of Java ORM code
18
Expect: ORM-related changes are localized
Expect: Frequently tuning configurations
Expect: Tooling support due to ORM
popularity
No! There is limited tooling
support
No! ORM configurations
are rarely tuned
No! ORM code changes are
more scattered
19
20
21
22
23
24
25
26
27
Tse-Hsun (Peter) Chen [email protected]