concern-based cohesion as change proneness indicator: an initial empirical study
TRANSCRIPT
![Page 1: Concern-Based Cohesion as Change Proneness Indicator: An Initial Empirical Study](https://reader030.vdocument.in/reader030/viewer/2022032615/55a346481a28abce1f8b463e/html5/thumbnails/1.jpg)
Software Engineering Lab – UFBA
Salvador-Bahia-Brazil - http://les.dcc.ufba.br
Concern-Based Cohesion as
Change Proneness Indicator:
An Initial Empirical Study
1
Bruno C. da [email protected]
Cláudio Sant’[email protected]
Christina [email protected]
Federal
University of
Bahia
(UFBA)
![Page 2: Concern-Based Cohesion as Change Proneness Indicator: An Initial Empirical Study](https://reader030.vdocument.in/reader030/viewer/2022032615/55a346481a28abce1f8b463e/html5/thumbnails/2.jpg)
Software Engineering Lab – UFBA
Salvador-Bahia-Brazil - http://les.dcc.ufba.br
RQ: Is cohesion useful for prediction of
module change proneness?
High cohesive few changes?
Low cohesive several changes?
Structure-based cohesion metrics
For instance, Lack of Cohesion in Methods (LCOM)
Fail to capture the semantic notion of module’s
cohesion
And may not be a good indicator of change
proneness
2
![Page 3: Concern-Based Cohesion as Change Proneness Indicator: An Initial Empirical Study](https://reader030.vdocument.in/reader030/viewer/2022032615/55a346481a28abce1f8b463e/html5/thumbnails/3.jpg)
Software Engineering Lab – UFBA
Salvador-Bahia-Brazil - http://les.dcc.ufba.br
LCC (Lack of Concern-based
Cohesion)
An alternative cohesion metric
Centered on counting the number of concerns a module
implements
May capture better the semantic notion of module’s cohesion
It is part of a growing body of relevant work focusing on concern-
driven measurement
3
Concerns
Code
concern 1 concern 2 concern 3
![Page 4: Concern-Based Cohesion as Change Proneness Indicator: An Initial Empirical Study](https://reader030.vdocument.in/reader030/viewer/2022032615/55a346481a28abce1f8b463e/html5/thumbnails/4.jpg)
Software Engineering Lab – UFBA
Salvador-Bahia-Brazil - http://les.dcc.ufba.br
This Work
An initial empirical assessment of the
correlation between LCC and change
proneness
Secondary goal:
LCOM vs. change proneness
LCC vs. efferent coupling
LCOM vs. efferent coupling
4
![Page 5: Concern-Based Cohesion as Change Proneness Indicator: An Initial Empirical Study](https://reader030.vdocument.in/reader030/viewer/2022032615/55a346481a28abce1f8b463e/html5/thumbnails/5.jpg)
Software Engineering Lab – UFBA
Salvador-Bahia-Brazil - http://les.dcc.ufba.br
Empirical Study
5
V1 V2 V3…
Vn
Classes
Version HistoryLCC
LCOM
CBO
… … … …
# of versions each
class changed (NCh)
![Page 6: Concern-Based Cohesion as Change Proneness Indicator: An Initial Empirical Study](https://reader030.vdocument.in/reader030/viewer/2022032615/55a346481a28abce1f8b463e/html5/thumbnails/6.jpg)
Software Engineering Lab – UFBA
Salvador-Bahia-Brazil - http://les.dcc.ufba.br
Empirical Study
6
Two target systems:Mobile Media (MM) – 6 versions
Health Watcher (HW) – 8 versions
and
Spearman correlation method for
measurements of both systems
![Page 7: Concern-Based Cohesion as Change Proneness Indicator: An Initial Empirical Study](https://reader030.vdocument.in/reader030/viewer/2022032615/55a346481a28abce1f8b463e/html5/thumbnails/7.jpg)
Software Engineering Lab – UFBA
Salvador-Bahia-Brazil - http://les.dcc.ufba.br
Empirical Study – Correlation Tests
Cohesion vs. Changes
Concern-based cohesion vs. Changes (LCC vs. NCh)
7
NCh LCOM CBO LCC
Correlation
Coefficient
1 .564*
.618** .295
Sig. (2-tailed) . .012 .001 .162
Correlation
Coefficient.564
* 1 .488* .154
Sig. (2-tailed) .012 . .034 .530
Correlation
Coefficient.618
**.488
* 1 .504*
Sig. (2-tailed) .001 .034 . .012
Correlation
Coefficient
.295 .154 .504* 1
Sig. (2-tailed) .162 .530 .012 .
**. Correlation is significant at the 0.01 level (2-tailed).
*. Correlation is significant at the 0.05 level (2-tailed).
NCh
LCOM
CBO
LCC
NCh LCOM CBO LCC
Correlation
Coefficient
1 .086 .646**
,518**
Sig. (2-tailed) . .584 .000 .000
Correlation
Coefficient
.086 1 -,264 -,307*
Sig. (2-tailed) .584 . .087 .045
Correlation
Coefficient.646
** -,264 1 .694**
Sig. (2-tailed) .000 .087 . .000
Correlation
Coefficient.518
**-,307
*.694
** 1
Sig. (2-tailed) .000 .045 .000 .
**. Correlation is significant at the 0.01 level (2-tailed).
*. Correlation is significant at the 0.05 level (2-tailed).
NCh
LCOM
CBO
LCC
Mobile Media Health Watcher
No significance
levelStrong correlation
![Page 8: Concern-Based Cohesion as Change Proneness Indicator: An Initial Empirical Study](https://reader030.vdocument.in/reader030/viewer/2022032615/55a346481a28abce1f8b463e/html5/thumbnails/8.jpg)
Software Engineering Lab – UFBA
Salvador-Bahia-Brazil - http://les.dcc.ufba.br
Empirical Study – Correlation Tests
Cohesion vs. Changes
Structure-based cohesion vs. Changes (LCOM vs. NCh)
8
NCh LCOM CBO LCC
Correlation
Coefficient
1 .564*
.618** .295
Sig. (2-tailed) . .012 .001 .162
Correlation
Coefficient.564
* 1 .488* .154
Sig. (2-tailed) .012 . .034 .530
Correlation
Coefficient.618
**.488
* 1 .504*
Sig. (2-tailed) .001 .034 . .012
Correlation
Coefficient
.295 .154 .504* 1
Sig. (2-tailed) .162 .530 .012 .
**. Correlation is significant at the 0.01 level (2-tailed).
*. Correlation is significant at the 0.05 level (2-tailed).
NCh
LCOM
CBO
LCC
NCh LCOM CBO LCC
Correlation
Coefficient
1 .086 .646**
,518**
Sig. (2-tailed) . .584 .000 .000
Correlation
Coefficient
.086 1 -,264 -,307*
Sig. (2-tailed) .584 . .087 .045
Correlation
Coefficient.646
** -,264 1 .694**
Sig. (2-tailed) .000 .087 . .000
Correlation
Coefficient.518
**-,307
*.694
** 1
Sig. (2-tailed) .000 .045 .000 .
**. Correlation is significant at the 0.01 level (2-tailed).
*. Correlation is significant at the 0.05 level (2-tailed).
NCh
LCOM
CBO
LCC
Mobile Media Health Watcher
Strong correlation No significance
level
![Page 9: Concern-Based Cohesion as Change Proneness Indicator: An Initial Empirical Study](https://reader030.vdocument.in/reader030/viewer/2022032615/55a346481a28abce1f8b463e/html5/thumbnails/9.jpg)
Software Engineering Lab – UFBA
Salvador-Bahia-Brazil - http://les.dcc.ufba.br
Empirical Study – Correlation Tests
Cohesion vs. Coupling
Concern-based cohesion vs. Coupling (LCC vs. CBO)
9
NCh LCOM CBO LCC
Correlation
Coefficient
1 .564*
.618** .295
Sig. (2-tailed) . .012 .001 .162
Correlation
Coefficient.564
* 1 .488* .154
Sig. (2-tailed) .012 . .034 .530
Correlation
Coefficient.618
**.488
* 1 .504*
Sig. (2-tailed) .001 .034 . .012
Correlation
Coefficient
.295 .154 .504* 1
Sig. (2-tailed) .162 .530 .012 .
**. Correlation is significant at the 0.01 level (2-tailed).
*. Correlation is significant at the 0.05 level (2-tailed).
NCh
LCOM
CBO
LCC
NCh LCOM CBO LCC
Correlation
Coefficient
1 .086 .646**
,518**
Sig. (2-tailed) . .584 .000 .000
Correlation
Coefficient
.086 1 -,264 -,307*
Sig. (2-tailed) .584 . .087 .045
Correlation
Coefficient.646
** -,264 1 .694**
Sig. (2-tailed) .000 .087 . .000
Correlation
Coefficient.518
**-,307
*.694
** 1
Sig. (2-tailed) .000 .045 .000 .
**. Correlation is significant at the 0.01 level (2-tailed).
*. Correlation is significant at the 0.05 level (2-tailed).
NCh
LCOM
CBO
LCC
Mobile Media Health Watcher
Strong correlation Strong correlation
![Page 10: Concern-Based Cohesion as Change Proneness Indicator: An Initial Empirical Study](https://reader030.vdocument.in/reader030/viewer/2022032615/55a346481a28abce1f8b463e/html5/thumbnails/10.jpg)
Software Engineering Lab – UFBA
Salvador-Bahia-Brazil - http://les.dcc.ufba.br
Empirical Study – Correlation Tests
Cohesion vs. Coupling
Structure-based cohesion vs. Coupling (LCOM vs. CBO)
10
NCh LCOM CBO LCC
Correlation
Coefficient
1 .564*
.618** .295
Sig. (2-tailed) . .012 .001 .162
Correlation
Coefficient.564
* 1 .488* .154
Sig. (2-tailed) .012 . .034 .530
Correlation
Coefficient.618
**.488
* 1 .504*
Sig. (2-tailed) .001 .034 . .012
Correlation
Coefficient
.295 .154 .504* 1
Sig. (2-tailed) .162 .530 .012 .
**. Correlation is significant at the 0.01 level (2-tailed).
*. Correlation is significant at the 0.05 level (2-tailed).
NCh
LCOM
CBO
LCC
NCh LCOM CBO LCC
Correlation
Coefficient
1 .086 .646**
,518**
Sig. (2-tailed) . .584 .000 .000
Correlation
Coefficient
.086 1 -,264 -,307*
Sig. (2-tailed) .584 . .087 .045
Correlation
Coefficient.646
** -,264 1 .694**
Sig. (2-tailed) .000 .087 . .000
Correlation
Coefficient.518
**-,307
*.694
** 1
Sig. (2-tailed) .000 .045 .000 .
**. Correlation is significant at the 0.01 level (2-tailed).
*. Correlation is significant at the 0.05 level (2-tailed).
NCh
LCOM
CBO
LCC
Mobile Media Health Watcher
Moderate correlation No significance
level
![Page 11: Concern-Based Cohesion as Change Proneness Indicator: An Initial Empirical Study](https://reader030.vdocument.in/reader030/viewer/2022032615/55a346481a28abce1f8b463e/html5/thumbnails/11.jpg)
Software Engineering Lab – UFBA
Salvador-Bahia-Brazil - http://les.dcc.ufba.br
Empirical Study - Discussion
Low LCC and several changes
Fake Low-LCC classes (due to concerns which were
not mapped)
Correlation was affected by the quality of
concern-to-code mapping
Classes partially mapped
Existence of unmapped or “unknown” concerns
11
![Page 12: Concern-Based Cohesion as Change Proneness Indicator: An Initial Empirical Study](https://reader030.vdocument.in/reader030/viewer/2022032615/55a346481a28abce1f8b463e/html5/thumbnails/12.jpg)
Software Engineering Lab – UFBA
Salvador-Bahia-Brazil - http://les.dcc.ufba.br
Final Remarks
The study was constrained by:
the quality of the concern-to-code mapping
the small size of the involved systems
the small number of considered versions
Future work:
(Semi) automated techniques for concern-to-code mapping
Replicate the study with larger systems with a higher number of
releases
12
Although the constraints, we consider that our findings
showed that LCC is worth to be further investigated
![Page 13: Concern-Based Cohesion as Change Proneness Indicator: An Initial Empirical Study](https://reader030.vdocument.in/reader030/viewer/2022032615/55a346481a28abce1f8b463e/html5/thumbnails/13.jpg)
Software Engineering Lab – UFBA
Salvador-Bahia-Brazil - http://les.dcc.ufba.br
Bruno C. da [email protected]
Cláudio Sant’[email protected]
Christina [email protected]
13
Concern-Based Cohesion as
Change Proneness Indicator:
An Initial Empirical Study
Thank you!
![Page 14: Concern-Based Cohesion as Change Proneness Indicator: An Initial Empirical Study](https://reader030.vdocument.in/reader030/viewer/2022032615/55a346481a28abce1f8b463e/html5/thumbnails/14.jpg)
Software Engineering Lab – UFBA
Salvador-Bahia-Brazil - http://les.dcc.ufba.br
Bruno C. da [email protected]
Cláudio Sant’[email protected]
Christina [email protected]
14
Concern-Based Cohesion as
Change Proneness Indicator:
An Initial Empirical Study
Backup slides
![Page 15: Concern-Based Cohesion as Change Proneness Indicator: An Initial Empirical Study](https://reader030.vdocument.in/reader030/viewer/2022032615/55a346481a28abce1f8b463e/html5/thumbnails/15.jpg)
Software Engineering Lab – UFBA
Salvador-Bahia-Brazil - http://les.dcc.ufba.br 15
The PhotoViewScreen class in the Mobile
Media System
V1 V2 V3 V4 V5 V6
LCOM = 0 However, it revealed to be a change prone class
Changes over 3 versions, totalizing 8 operation-related changes
and 4 field-related changes
Changes Changes Changes
![Page 16: Concern-Based Cohesion as Change Proneness Indicator: An Initial Empirical Study](https://reader030.vdocument.in/reader030/viewer/2022032615/55a346481a28abce1f8b463e/html5/thumbnails/16.jpg)
Software Engineering Lab – UFBA
Salvador-Bahia-Brazil - http://les.dcc.ufba.br 16
V1 V2 V3 V4 V5 V6
LCOM = 0
LCC = 4 (in a total of 5
mapped concerns in the system)
LCC as a better indicator of change proneness
Changes over 3 versions, totalizing 8 operation-related changes
and 4 field-related changes
Changes Changes Changes
The PhotoViewScreen class in the Mobile
Media System
![Page 17: Concern-Based Cohesion as Change Proneness Indicator: An Initial Empirical Study](https://reader030.vdocument.in/reader030/viewer/2022032615/55a346481a28abce1f8b463e/html5/thumbnails/17.jpg)
Software Engineering Lab – UFBA
Salvador-Bahia-Brazil - http://les.dcc.ufba.br
Empirical Study - Discussion
High LCC and no changes
The case of 6 classes for exception handling in MM
For instance: ImageNotFoundException and
InvalidPhotoAlbumNameException
LCC = 3 (in a total of 5) and no changes from V1 to V6
Concerns: Persistence, Exception Handling and Photo
Reasons:
There was no change directly related to Persistence and
Exception Handling concerns
In V6, they should have been changed. But programmers forgot
or decided not to do that.
17
![Page 18: Concern-Based Cohesion as Change Proneness Indicator: An Initial Empirical Study](https://reader030.vdocument.in/reader030/viewer/2022032615/55a346481a28abce1f8b463e/html5/thumbnails/18.jpg)
Software Engineering Lab – UFBA
Salvador-Bahia-Brazil - http://les.dcc.ufba.br
Empirical Study - Discussion
Low LCC and several changes
The case of PhotoListScreen class in MM
Only 1 concern mapped to this class in V1
LCC = 1 (Photo concern)
However, this class was modified in thee versions (V2, V3
and V6),
Totalizing 6 operation-related changes and 8 field-related
changes
Changes occurred by different concerns which were not
mapped to this class (e.g. the Screen concern)
This class should have had a higher LCC value
18
![Page 19: Concern-Based Cohesion as Change Proneness Indicator: An Initial Empirical Study](https://reader030.vdocument.in/reader030/viewer/2022032615/55a346481a28abce1f8b463e/html5/thumbnails/19.jpg)
Software Engineering Lab – UFBA
Salvador-Bahia-Brazil - http://les.dcc.ufba.br
Empirical Study - Discussion
Imprecise concern-to-code mapping
Classes with code fragments not assigned to any of
the considered concerns
Or classes with LCC = 0 (no concerns mapped to
them), but they changed due to modifications by
unmapped or “unknown” concerns
A real problem
Time-consuming, subjective and error-prone activity
It lacks tool-support for a precise (semi) automatically
mapping
19
![Page 20: Concern-Based Cohesion as Change Proneness Indicator: An Initial Empirical Study](https://reader030.vdocument.in/reader030/viewer/2022032615/55a346481a28abce1f8b463e/html5/thumbnails/20.jpg)
Software Engineering Lab – UFBA
Salvador-Bahia-Brazil - http://les.dcc.ufba.br
Empirical Study - Discussion
Negative correlation between LCC and LCOM
HW system: negative moderate correlation
(coefficient -.307)
Reasons:
Classes with high LCC and low LCOM
The motivating example showed at the beginning
And others, such as the HealthWactherFacade class
LCC = 4 (Top LCC in HW version 1) and LCOM = 0
Classes with low LCC and high LCOM
FoodComplaint class (LCOM = 78 and LCC = 0)
Low LCC due to the problem of imprecise concern-to-code
mapping
High LCOM due to many fields and “getters” and “setters”
20
![Page 21: Concern-Based Cohesion as Change Proneness Indicator: An Initial Empirical Study](https://reader030.vdocument.in/reader030/viewer/2022032615/55a346481a28abce1f8b463e/html5/thumbnails/21.jpg)
Software Engineering Lab – UFBA
Salvador-Bahia-Brazil - http://les.dcc.ufba.br
Metrics for Changes
NCh (Number of Changes)
Counts the number of versions each class has
changed
Others:
NCh-Oper (Number of operation-related changes)
NCh-Field (Number of field-related changes)
We started using them, but they were discarded
The effect of using them was pretty much the same in our
study
21