Software Engineering Laboratory Department of Computer Science Graduate
コーディングパターンの あいまい検索の提案と実装 井上研究室 小笠原康貴 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
従来の検出結果 Buffered. Reader(); read(); close(); Buffered. Reader(); read. Line(); close(); Buffered. Reader(); close(); 最適な実装を判断したいが… • 類似する実装が混在 • 欲しい情報がうまく見つから ない可能性 • 全体において有力な実装が わからない 6 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
研究の方針 Buffered. Reader(); read(); close(); • 類似するパターンを別々に提 示し,それぞれの出現頻度を 10% 把握すれば,判断が容易 Buffered. Reader(); read. Line(); close(); 70% Buffered. Reader(); 20% コードブロックの分別を行う キーワード検索を提案し, 類似するパターンの分別を 行う close(); Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 7
検索対象の抽出 • 検索対象となるコードブロックの抽出を行う – 構文解析による抽出 Class class 1{ void method 1(){ ‥‥ } void method 2(){ ‥‥ } void method 3(){ ‥‥ } } コードブロックの集合 構文解析 10 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
検索結果の再利用 一致グループ keyword 1 検索 コードブロックの集合 不一致グループ 別の検索の 対象に利用 一致グループ keyword 2 検索 不一致グループ 12 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
コーディングパターンの分別方法 コーディングパターン内のキーワードが幾つかわかれば, それに類似するコーディングパターンを形成するコード ブロックを分別可能 keyword 1: 一致 keyword 2: 一致 keyword 3: 一致 { keyword 1: 一致 keyword 2: 不一致 keyword 3: 一致 { keyword 1; keyword 2; keyword 3; } keyword 3; 類似コーディングパターン } 13 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
提案手法の利用例 入力 ソースコード パターンA: 10個 word 1 word 2 word 3 Word 1 を含む? 50個 一致 Word 2 を含む? パターンを 形成する語 word 1 word 2 word 3 出力 本ツール Word 3 を含む? 35個 一致 10個 一致 35個 不一致 Word 3 を含む? パターンA パターンC 5個 不一致 パターンB: 5個 word 1 word 2 word 3 パターンC: 35個 word 1 word 2 word 3 14 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
検索方法 • 検索クエリとして,コーディングパターン例中に出現す るResult. Setクラスに関するメソッド呼び出しを利用 – – execute. Query() next() get. String() close() 16 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
- Slides: 18