software maintenance support by extracting links and models
TRANSCRIPT
Software Maintenance Support by Extracting Links and Models
Hiro - Hironori Washizaki
Waseda University Twitter: @Hiro_Washi [email protected]
http://www.washi.cs.waseda.ac.jp/
Thanks to: Ryosuke, Kazuki, Yuta and other collaborators!
Latece Seminar, Nov 11, 2015 @ UQAM, Montreal
• Assoc. Prof., Head, Global Software Engineering Laboratory, Waseda University
• Visiting Assoc. Prof., National Institute of Informatics
• Visiting Prof., Ecole Polytechnique de Montreal
• Convenor, ISO/IEC SC7/WG20
• Chair, IEEE CS Japan Chapter
• Chair, SEMAT Japan Chapter 2
Hironori Washizaki
Waseda University Global Software Engineering Lab.
• SE research in global development era – Analysis and reuse
– Quality assurance
– Agile and patterns
– SE education
• 5 professors
• 15+ partners
• 25 students (5 from China, Indonesia, Afganistan) 3
Software maintenance matters!
60–90% of total costs
4
B. Lientz and E. Swanson, Software Maintenance Management. Reading, Ma.: Addison-Wesley, 1980.
J. Conejero, E. Figueiredo, A. Garcia, J. Hernández and E. Jurado, "On the Relationship of Concern
Metrics and Requirements Maintainability,” Information and Software Technology, vol.54, no.2, 2012.
How can we support?
6
Requirements
Design
Program
source
code
Tracing artifacts Tracing artifacts
Log-based interactive recovery [CAiSE’15]
Transitive recovery [ICSME’15 ERA]
Ryosuke Tsuchiya, Hironori Washizaki, Yoshiaki Fukazawa, Keishi Oshima, and Ryota Mibe,“Interactive Recovery of Requirements
Traceability Links Using User Feedback and Configuration Management Logs,” 27th International Conference on Advanced
Information Systems Engineering (CAiSE 2015)
Kazuki Nishikawa, Hironori Washizaki, Yoshiaki Fukazawa, Keishi Ohshima, Ryota Mibe, “Recovering Transitive Traceability Links
among Software Artifacts,” 31st IEEE International Conference on Software Maintenance and Evolution (ICSME 2015), ERA Track
Traceability links?
• Relationships among software artifacts
• Key to ensure consistency among artifacts [Antoniol‘00]
7 G. Antoniol, B. Caprile, A. Potrich and P. Tonella, "Design-Code Traceability for Object-Oriented Systems," Annals of
Software Engineering, vol. 9, no. 1-4, pp. 35-58, 2000
Requirement Source code
Run automated
test
Run basic test
Add tests
Automate.c X
Basic.c X
TestDB.c X
TestRun.c X X
Facts of traceability links • Rarely established explicitly [Lucia’12] • Most of existing recovery techniques employing
Information Retrieval (IR) approaches such as TF/IDF and Vector Space Model (VSM)
8
A. De Lucia, et al., "Information Retrieval Methods for Automated Traceability Recovery," in Software and Systems
Traceability, 1st ed., J. Cleland-Huang, O. Gotel and A. Zisman, Ed. New York: Springer, p. 71-98, 2012.
Automated test
Automated.c MyMem.c
Initialization Requirement
基本テスト Basic.c
NG OK
Interactive recovery utilizing call relationships
Rank Requirement Code file Score Recommended Correct
1 Recover link
2 Recover link
3 Recover link
・・・ ・・・
9
Recover link
・・・
LinkPresenter.java ・・・
LinkRecover.java
ScoreCalc.java
・・・
Call
Ryosuke Tsuchiya, Hironori Washizaki, Yoshiaki Fukazawa, Keishi Oshima, and Ryota Mibe,“Interactive Recovery of Requirements
Traceability Links Using User Feedback and Configuration Management Logs,” 27th International Conference on Advanced
Information Systems Engineering (CAiSE 2015)
Interactive recovery utilizing call relationships
Rank Requirement Code file Score Recommended Correct
1 Recover link LinkRecover.java 0.98 not yet
2 Recover link LinkPresenter.java 0.65 not yet
3 Recover link ScoreCalc.java 0.30 not yet
・・・ ・・・ ・・・ ・・・
10
Recover link
・・・
LinkPresenter.java ・・・
LinkRecover.java
ScoreCalc.java
・・・
☑
Call
☑
Ryosuke Tsuchiya, Hironori Washizaki, Yoshiaki Fukazawa, Keishi Oshima, and Ryota Mibe,“Interactive Recovery of Requirements
Traceability Links Using User Feedback and Configuration Management Logs,” 27th International Conference on Advanced
Information Systems Engineering (CAiSE 2015)
Interactive recovery utilizing call relationships
Rank Requirement Code file Score Recommended Correct
1 Recover link LinkRecover.java 0.98 not yet
2 Recover link ScoreCalc.java 0.30 Recommended
3 Recover link LinkPresenter.java 0.65 not yet
・・・ ・・・ ・・・ ・・・
11
Recover link
・・・
LinkPresenter.java ・・・
LinkRecover.java
ScoreCalc.java
・・・
☑
Call
☑
Ryosuke Tsuchiya, Hironori Washizaki, Yoshiaki Fukazawa, Keishi Oshima, and Ryota Mibe,“Interactive Recovery of Requirements
Traceability Links Using User Feedback and Configuration Management Logs,” 27th International Conference on Advanced
Information Systems Engineering (CAiSE 2015)
Automated test
Log-based recovery
12
Automated test
automate・・ ・・XML・・・ ・test・・・・・・
Requirement automate
XML
test
automate
XML
Keywords
High TF-IDF value Proper noun
Filtered by experts
automate
XML
Revision: 137 Author: anilsaharan Date: 2011/8/20 9:35:13 Message: Changes for fixing XML tag issue ---- Modified : /trunk/CUnit/Sources/Tool/Process.c
Process.c
・・・
Ryosuke Tsuchiya, Hironori Washizaki, Yoshiaki Fukazawa, Keishi Oshima, and Ryota Mibe,“Interactive Recovery of Requirements
Traceability Links Using User Feedback and Configuration Management Logs,” 27th International Conference on Advanced
Information Systems Engineering (CAiSE 2015)
Experiment: Japanese enterprise system
• 80,000 LOC, 192 requirements, 694 Java code files, 7090 revisions in Subversion
• 726 known links as correct answer
13 Ryosuke Tsuchiya, Hironori Washizaki, Yoshiaki Fukazawa, Keishi Oshima, and Ryota Mibe,“Interactive Recovery of Requirements
Traceability Links Using User Feedback and Configuration Management Logs,” 27th International Conference on Advanced
Information Systems Engineering (CAiSE 2015)
Transitive recovery
14
Code Design Test ScoreC1 Da Tx 0.16C1 Da Ty 0.14C1 Db Tx 0.03
• Vector Space Model (VSM) for basic recovery
Source code Design Test case
Code Design SimilarityC1 Da 0.4C2 Db 0.3
Design Test SimilarityDa Tx 0.40Da Ty 0.35Db Tx 0.10
Kazuki Nishikawa, Hironori Washizaki, Yoshiaki Fukazawa, Keishi Ohshima, Ryota Mibe, “Recovering Transitive Traceability Links
among Software Artifacts,” 31st IEEE International Conference on Software Maintenance and Evolution (ICSME 2015), ERA Track
Experiment: EasyClinic
• Target link: 47 Java code ⇔ 63 test docs
• Supportive artifacts: 20 design docs or 30 use cases
• Effectiveness varies with supportive artifacts
15 Kazuki Nishikawa, Hironori Washizaki, Yoshiaki Fukazawa, Keishi Ohshima, Ryota Mibe, “Recovering Transitive Traceability Links
among Software Artifacts,” 31st IEEE International Conference on Software Maintenance and Evolution (ICSME 2015), ERA Track
How can we support?
16
Requirements
Design
Program
source
code
Yuta Maezawa, Kazuki Nishiura, Hironori Washizaki, Shinichi Honiden, “Validating Ajax Applications Using a Delay-Based Mutation
Technique,” 29th IEEE/ACM International Conference on Automated Software Engineering (ASE 2014)
Yuta Maezawa, Hironori Washizaki, Yoshinori Tanabe and Shinichi Honiden, “Automated Verification of Pattern-based Interaction
Invariants in Ajax Applications,” 28th IEEE/ACM International Conference on Automated Software Engineering (ASE2013)
How can we support?
17
Requirements
Design
Program
source
code
Reversing model
Detecting problems Detecting problems
Ajax model extraction and verification
[ASE’13][ASE’14]
Yuta Maezawa, Kazuki Nishiura, Hironori Washizaki, Shinichi Honiden, “Validating Ajax Applications Using a Delay-Based Mutation
Technique,” 29th IEEE/ACM International Conference on Automated Software Engineering (ASE 2014)
Yuta Maezawa, Hironori Washizaki, Yoshinori Tanabe and Shinichi Honiden, “Automated Verification of Pattern-based Interaction
Invariants in Ajax Applications,” 28th IEEE/ACM International Conference on Automated Software Engineering (ASE2013)
18
window.onload = setEventHandler;
function setEventHandler() {
$(“reg_type”).onchange = calcPrice;
・・・ $(“reg_addcart”).onclick = addCart;
};
function calcPrice() { ・・・ }; function addCart() {
if(isValidInput()) {
reqRunTrans();
} else {
alert(“Invalid user inputs”);
}
};
function reqRunTrans() {
new Ajax.Request(“runTrans.php”, {
method: “GET”, parameters: getParams(),
onSuccess: succeeded });
};
function succeeded() { disableAll();
jumpToConfirm();
}; Yuta Maezawa, Hironori Washizaki, Yoshinori Tanabe and Shinichi Honiden, “Automated Verification of Pattern-based Interaction
Invariants in Ajax Applications,” 28th IEEE/ACM International Conference on Automated Software Engineering (ASE2013)
19
Extracted finite state machine
Yuta Maezawa, Hironori Washizaki, Yoshinori Tanabe and Shinichi Honiden, “Automated Verification of Pattern-based Interaction
Invariants in Ajax Applications,” 28th IEEE/ACM International Conference on Automated Software Engineering (ASE2013)
• #70 programming and usability patterns
• Potential faults: might not be revealed by testing
Ajax (Asynchronous JavaScript + XML) Design Patterns [Mahamoff’06]
20
[Mahamoff’06] M. Mahamoff, “Ajax Design Patterns”, O’Reilly Media Inc., 2006.
E.g. User Action “Prevent multiple
calls of specific user event handler”
Yuta Maezawa, Hironori Washizaki, Yoshinori Tanabe and Shinichi Honiden, “Automated Verification of Pattern-based Interaction
Invariants in Ajax Applications,” 28th IEEE/ACM International Conference on Automated Software Engineering (ASE2013)
Duplicate order
21
Verifying invariants of specified pattern
Yuta Maezawa, Hironori Washizaki, Yoshinori Tanabe and Shinichi Honiden, “Automated Verification of Pattern-based Interaction
Invariants in Ajax Applications,” 28th IEEE/ACM International Conference on Automated Software Engineering (ASE2013)
22
window.onload = setEventHandler;
function setEventHandler() {
$(“reg_type”).onchange = calcPrice;
・・・ $(“reg_addcart”).onclick = addCart;
};
function calcPrice() { ・・・ }; function addCart() {
if(isValidInput()) {
$(“addCart”).disabled = true;
reqRunTrans();
} else {
alert(“Invalid user inputs”);
$(“addCart”).disabled = false;
}
};
function reqRunTrans() {
new Ajax.Request(“runTrans.php”, {
method: “GET”, parameters: getParams(),
onSuccess: succeeded }); };
function succeeded() { disableAll();
jumpToConfirm(); }; Yuta Maezawa, Hironori Washizaki, Yoshinori Tanabe and Shinichi Honiden, “Automated Verification of Pattern-based Interaction
Invariants in Ajax Applications,” 28th IEEE/ACM International Conference on Automated Software Engineering (ASE2013)
• Developers are concerned with interactions[Duhl’03]
• Interaction = event + callback
• Rules are necessary for distinguishing interaction-related code fragments
Interaction-based state machine extraction
23
………………………………
………………………………
………………………………
………………………………
…………………………….…
………………………………
……………………………
function addCart() {… ………………………………
……………………..……
………………………………………
………………………………………
$(“addcart”).disabled=true; ………………………………………
………………………………………
……………………………………
…………
…………
…………
………………………………
………………………..……
………………………………
………………………………
………………………………
………………………………
………………………………
………………………………
………………………………
………………………………
…………………………
……………………………………………
……………………………………………
function setEventHandler() {
$(“addcart”).onclick=addCart; ……………………………………………
……………………………………………
……………………………………………
……………………………………………
……………………………………………
onclick
setEventHandler
ev
addCart
…disabled…
[c]
[!c]
[Duhl’03] J.Duhl, “White Paper: Rich Internet Applications”, IDC Technical Report’ 03.
Yuta Maezawa, Hironori Washizaki, Yoshinori Tanabe and Shinichi Honiden, “Automated Verification of Pattern-based Interaction
Invariants in Ajax Applications,” 28th IEEE/ACM International Conference on Automated Software Engineering (ASE2013)
Verification on Promela with LTL
24
Self interaction
User Server
active proctype App () {…}
App model
active proctype Interaction () {…}
Interaction model Faulty execution paths
Verification formulas (LTL)
Pattern Negative property
User Action <>(App_state == PreventFunc && App_event == UserEvent )
Yuta Maezawa, Hironori Washizaki, Yoshinori Tanabe and Shinichi Honiden, “Automated Verification of Pattern-based Interaction
Invariants in Ajax Applications,” 28th IEEE/ACM International Conference on Automated Software Engineering (ASE2013)
• Problem: Potential faults might not cause actual errors
• Assumption: Unexpected network latency make potential faults executable.
• Solution: Delay-based mutation and testing
Delay-based mutation
25
<button onclick=“handleClick()” /> ・・・ <script src=“handleClick.js” />
new DelayedRequest(3000).applyFunction( $.get , “myscript.php”, { name: “ABC” }, function(data) { alert(“Response is ” + data); } );
Synchronous delay Asynchronous delay
Original code
S1
S2 S3
Late response reveals!
Assumes immediate response
Yuta Maezawa, Kazuki Nishiura, Hironori Washizaki, Shinichi Honiden, “Validating Ajax Applications Using a Delay-Based Mutation
Technique,” 29th IEEE/ACM International Conference on Automated Software Engineering (ASE 2014)
Case Study: industrial services
26
Subject JS
[LOC] #States #Trans.
#Invariants verified
#Potential faults
#Delay- Dependent
faults
2020 Marketing
2,468 15 547 4 1 1
ECD China 880 32 508 3 2 1
Easy Serviced Apartments
3,523 34 602 3 1 1
Undefined function call
Login failed with correct
username and password
Yuta Maezawa, Kazuki Nishiura, Hironori Washizaki, Shinichi Honiden, “Validating Ajax Applications Using a Delay-Based Mutation
Technique,” 29th IEEE/ACM International Conference on Automated Software Engineering (ASE 2014)
Summary
27
Reversing model
Tracing artifacts
Detecting problems Detecting problems
Tracing artifacts
Log-based interactive recovery [CAiSE’15]
Transitive recovery [ICSME’15 ERA]
Ajax model extraction and verification [ASE’13]
Ajax delay-based mutation [ASE’14]
28
Feb 24-26 (due Dec 4)
asianplop.org
Mar 15 (due Dec)(TBD)
ppap.soccerlab.polymtl.ca
Mar 11 (due Jan 8)
samuraicoding.info
Mar 13-18 (due Sep 2016)
aster.or.jp/conference/icst2017/
10th IEEE International Conference on Software Testing, Verification and Validation
IPSJ International AI Programming Contest