27.03.2014 Views

SEKE 2012 Proceedings - Knowledge Systems Institute

SEKE 2012 Proceedings - Knowledge Systems Institute

SEKE 2012 Proceedings - Knowledge Systems Institute

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

contains broadcast of Subject to Observer nor event notification<br />

or data observation. Thus, in fact, DPRE identifies 7 instances,<br />

and only 2 of which is TP, so the precision is 28.6%.<br />

TABLE II.<br />

OBSERVER INSTANCES IDENTIFIED BY JDP-DETECTOR<br />

Subject/Observer Event Object Manual<br />

1 Figure/FigureChangeListener FigureChangeEvent T<br />

2 StandardDrawing/<br />

StandardDrawingView<br />

3 StandardDrawingView/<br />

AbstractTool<br />

4 StandardDrawing/<br />

FigureChangeEventMulticaster<br />

DrawingChangeEvent<br />

MouseEvent<br />

FigureChangeEvent<br />

We download N. Tsantalis's tool DPD 4.5 [5], and recognize<br />

3 Observer instances (StandardDrawing/Drawing-<br />

ChangeListener, StandardDrawingView/Painter, Standard-<br />

DrawingView/Figure) with it. The first one of their instances is<br />

the same as instance 2 of Table II. The other two instances is<br />

not included in our result. The second one of their instances is<br />

excluded by structure analysis of JDP-Detector. For the third<br />

instance, Notify method of StandardDrawingView passes its<br />

parameter instead of its fields to Update methods of Figure.<br />

The dependence path of the data transfer process is included in<br />

the SDG calculated by JDP-Detector, but is neglected by JDP-<br />

Detector.<br />

Based on the comparison, we conclude that except for some<br />

defects in implementation of JDP-Detector, our approach is<br />

effective in revealing the data flow of the Observer pattern, and<br />

it identifies an instance (item 3 in Table II) that is not identified<br />

by DPD and DPRE.<br />

D. Time Consumption of the Identification Process<br />

Our experiment environment is as following: Intel<br />

Core(TM)2 Quad CPU Q8400 @ 2.66GHz processor, 3GB<br />

RAM, Windows XP operation system. Identification of Adapter,<br />

Strategy, State, and Observer instances in JHotDraw 5.1 by<br />

JDP-Detector uses 5.217s, 1.793s, 7.39s and 14.082s, respectively.<br />

VI. CONCLUSION<br />

In this paper, we propose an a pproach to identify design<br />

pattern instances in source codes using dependency information.<br />

Our approach improves the recognition precision (especially in<br />

distinguishing State instances from Strategy instances), and<br />

identifies the variables playing roles in design patterns that<br />

cannot be identified by existing approaches.<br />

Compared with the approaches using method call sequences,<br />

our approach reflects the effect of method call but has less<br />

constraint to the method call sequence, and is somewhat more<br />

flexible.<br />

T<br />

T<br />

F<br />

Using data flow information, we can describe the characteristics<br />

of design patterns more detailed, which brings high identification<br />

precision, but may sometimes seems too strict. And<br />

furthermore, our approach can only identify design patterns<br />

that has obvious data flow characteristics.<br />

REFERENCES<br />

[1] E. Gamma, H. Richard, R. Johnson, and J, Vlissides, Design Patterns:<br />

Elements of Reusable Object-Oriented Software. Boston: Addison-<br />

Wesley Longman, 1995.<br />

[2] X. Zhou, J. Q ian, L. Chen, and B. Xu, "Identification of centrally<br />

managed aggregations in design patterns using shape analysis,". Journal<br />

of Software, Vol.21, No. 11, pp. 2725−2737, November 2010.<br />

[3] A. V. Aho, M. S. Lam, R. Sethi and J. D. Ullman, Compilers: Principles,<br />

Techniques and Tools, 2nd ed., Addison-Wesley Longman Publishing<br />

Co., Inc., Boston, MA, 2007.<br />

[4] R. Vallee-Rai, L. Hendren, V. Sundaresan, P. Lam, E. Gagnon and P. Co,<br />

"Soot — A Java optimization framework," In: IBM Centre for Advanced<br />

Studies Conference(CASCON), November 1999.<br />

[5] N. Tsantalis, A. Chatzigeorgiou and G. Stephanides, "Design pattern<br />

detection using similarity scoring," IEEE Transactions on software<br />

engineering, Vol. 32, Issue 11, pp. 896-909, November 2006.<br />

[6] Y. Guéhéneuc, J. Guyomarc’h and H. Sahraoui, "Improving designpattern<br />

identification: a new approach and an exploratory study," Journal<br />

of Software Quality Control. Vol. 18, Issue 1, pp. 145–174, March,<br />

2010.<br />

[7] A. D. Lucia, V. Deufemia, C. Gravino and M. Risi, "Improving<br />

behavioral design pattern detection through model checking," In: 14th<br />

European Conference on Software Maintenance and Reengineering<br />

(CSMR), pp. 176-185, March 2010.<br />

[8] A. D. Lucia, V. Deufemia, C. Gravino and M. Risi, "Design pattern<br />

recovery through visual language parsing and source code analysis,"<br />

Journal of <strong>Systems</strong> and Software, Vol. 82, Issue 7, pp. 1177–1193, July<br />

2009.<br />

[9] N. Pettersson, Welf and J. Nivre, "Evaluation of a ccuracy in design<br />

pattern occurrence detection," IEEE Trans. Software Eng. Vol. 36, No. 4,<br />

pp. 575-590, July/August, 2010.<br />

[10] S. Romano, G. Scanniello, M. Risi and C. Gravino, "Clustering and<br />

lexical information support for the recovery of design pattern in source<br />

code," In: 27th IEEE International Conference on Software Maintenance<br />

(ICSM), pp. 500-503, November, 2011.<br />

[11] J. Y. Guéhéneuc and G. Antoniol, "Identification of behavioural and<br />

creational design motifs through dynamic analysis," Journal of Software<br />

Maintenance and Evolution: Research and Practice, Vol. 22, Issue 8, pp.<br />

597627, December 2010.<br />

[12] G. Rasool, I. Philippow and P. Mäder, "Design pattern recovery based<br />

on annotations," Advances in Engineering Software, Vol. 41, Issue 4, pp.<br />

519–526, April 2010.<br />

[13] M. V. Detten and D. Travkin, "An evaluation of the Reclipse tool suite<br />

based on the static analysis of JHotDraw," Technical Report tr-ri-10-322,<br />

Software Engineering Group, Heinz Nixdorf <strong>Institute</strong>, University of<br />

Paderborn, Oct 2010.<br />

[14] S. Horwitz, T. Reps and D. Binkley, "Interprocedural slicing using<br />

dependence graphs," ACM Transactions on Programming Languages<br />

and <strong>Systems</strong> (TOPLAS), vol. 12, Issue 1, pp. 26-60, January 1990.<br />

[15] J. Ferrante, K. Ottenstein, and J. Warren, "The program dependence<br />

graph and its use in optimization". ACM Trans. Program. Lang. Syst.<br />

Vol. 9, Issue 3, pp. 319-349, July 1987.<br />

292

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!