C. Rahmani, Software Architecture Recovery Introduction

advertisement
Software Architecture Recovery
Cobra Rahmani
03/26/2010
Introduction
• In this work [1] a framework for architecture
recovery of component-based applications is
proposed
• SAR: Software Architecture Recovery
[1] Chang-ai Sun, Jun Zhou, “ReArchJBs: a Tool for Automated Software Architecture Recovery of
JavaBeans-based Applications”, Proceedings of the 2005 Australian Software Engineering
Conference (ASWEC’05)
Introduction
• SAR is a reliable approach to obtain the architecture of the
targeted systems.
• Holt et al. [1,6] have focused on case studies on the
architecture recovery of several different kinds of
applications, such as web applications.
• Kramer et al. [12,13] have proposed an approach X-ray to aid
the programmers in recovering the runtime architecture
information of distributed systems.
[1] I.T. Bowman, R.C. Holt, N.V. Brewster. Linux as a Case Study: Its Extracted Software Architecture, Proceedings
of the ICSE 1999, Los Angels, May 1999, pp.555-563.
[6]A.E. Hassan, R.C. Holt, Architecture Recovery of Web Applications, Proceedings of the ICSE 2002, pp.349-359
[12]N.C. Mendonca, J. Kramer. An experiment in Distributed Software Architecture Recovery, Proceedings of the
Second International ESPRIT ARES Workshop on Development and Evolution of Software Architectures for
Product Families, LNCS 1429, Las Palmas de Gran Canaria, Spain, February 1998 pp.106-114
[13]N.C. Mendonca, J. Kramer. An Approach for Recovering Distributed System Architectures, Automated
Software Engineering, 2001 (8). pp.311-354
Introduction
• Kazman et al. [2,7,8] have studied the architecture recovery of
C/C++ applications, viewing the function or method as the
component of architecture, and developed the platform
named Dali.
[2]L.Brien, Experiences in Architecture Reconstruction at Nokia, CMU/ SEI-2002-TN –
004,CMU, March 2002.
[7]R.Kazman, S.J.Carriere, Playing Detective: Reconstruction Software Architecture from
Available Evidence, Automated Software Engineering, 1999 (6). pp.107-138
[8]R. Kazman, L. Brien, Chris Verhoef, Architecture Reconstruction Guidelines, CMU/SEI2001-TR-026,CMU, August 2001
Introduction
• Guo et al. [5] proposed an architecture recovery method,
called ARM, which supports the semi-automated architecture
recovery of systems developed using design patterns.
• Medvidovic et al. [14] proposed a light–weight incremental
approach to architecture recovery and evolution.
[5]G. Guo, J.Atlee, R.Kazman, A Software Architecture Reconstruction Method, In
Proceedings of WICSA 1999. Kluwer Academic Publishers, San Antonio, Texas,
February 22-24,1999, pp.225-243
[14]M. Shaw, The coming-of-age of software architecture research, Proceedings of
23rd ICSE, IEEE Computer Society, Washington DC, 2001 pp.657~664
Objectives
• This work recovers architecture model in a
graphical way from the perspective of
structure and behavior, including the
component view, the assembly view and the
interaction view.
• The paper chose JavaBeans-based applications
as its targeted systems.
The principle of Reverse Engineering
• Data Extraction: collecting original data related
with the reverse engineering goal;
• Knowledge Organization: organizing and storing
the extracted data in certain forms, such as
conceptual model, domain model and so on;
• Information Browse: filtering and analyzing the
information according to some domain-related
rules, and representing the result in the various
ways.*
*Here, Data is the unprocessed fact, Knowledge is a collection of relation and rules
deduced from Data, and Information is the integrated knowledge to be delivered to
users.
Requirement of component-based SAR
• The framework of SAR of component-based application should deal
with the following features:
• 1. High-level abstraction: the component in the architecture model
should be specified with specific model beyond function or
methods.
• 2. Comprehension: multiple architecture views should be provided
to represent recovered software architecture from the different
layers and aspects.
• 3. Understandability: the recovered architecture should be
represented in a way where users can easily understand.
• 4. Generality: the framework should be general, instead of the
limitation to the certain component technology.
A General Framework
•
Architecture recovery of JavaBeans-based applications
Java Bean example:
The class should be serializable. This allows
PersonBean.java:
applications and frameworks to reliably save,
/** * Class <code>PersonBean</code>. */
public class PersonBean implements java.io.Serializable { store, and restore the bean's state in a fashion
private String name;
that is independent of the VM and
private boolean deceased;
/** No-arg constructor (takes no arguments). */
platform.[Wiki]
public PersonBean() { }
/** * Property <code>name</code> (note capitalization) readable/writable. */
public String getName()
{
return this.name;
}
/** * Setter for property <code>name</code>. * @param name */
public void setName(final String name) \
{ this.name = name; }
/** * Getter for property "deceased" * Different syntax for a boolean field (is vs. get) */
public boolean isDeceased()
{ return this.deceased; }
/** * Setter for property <code>deceased</code>. * @param deceased */
public void setDeceased(final boolean deceased)
{ this.deceased = deceased;
}}
TestPersonBean.java:
/** * Class <code>TestPersonBean</code>. */
public class TestPersonBean {
/** * Tester method <code>main</code> for class <code>PersonBean</code>. * @param args */
public static void main(String[] args)
{ PersonBean person = new PersonBean();
person.setName("Bob");
person.setDeceased(false);
// Output: "Bob [alive]" System.out.print(person.getName());
System.out.println(person.isDeceased() ? " [deceased]" : " [alive]");
}}
Architecture recovery of JavaBeans-based applications
• 1. A JavaBeans component consists of Event, Property and
Method.
• 2. A JavaBeans component is in nature defined by a public
class. In one Java file, at most one public class can be
declared. Therefore, it is inferred that one Java file can define
at most one JavaBeans component.
• 3. A Java application is organized as packages physically. One
package can contain multiple Java files. One Java file can only
belong to one specific package.
• 4. In the JavaBeans-based applications, one package can be
reused by another package through import mechanism.
Architecture recovery of JavaBeans-based applications
Identifying the component model
AST-based parser is used to extract a variety of
elementary information of a program, such as the
set of classes, functions or variables and so on.
Then the component model can be abstracted by
clustering these elements according to the
mechanism of JavaBeans-based applications and
the reverse component model.
Acquiring the component assembly view
In this research, the paper classify the
connector into six types of association
according to the specific mechanism of
JavaBeans-based applications, namely
call association,
event association,
data sharing,
composition association,
dependence association and
implementation association
For example, <C1.a1, C2.a2 > is one
association between component C1
and component C2, which means that
one element a1 in C1 associates with
another element a2 in C2.
Acquiring the component interaction view
• Component interaction requires identifying both callers and
callees, and identifying the dynamic call order.
• In the body of all functions contained in the classes, the probe
“probeFunBegin (f, funID, 0)” should be inserted at the
beginning, and the probe “probeFunEnd(f, funID,1)” should be
inserted at the end.
• f is referred to as the handle of a file that receives the dynamic
track data, funID is referred to as the identity of current
function, and 0/1 indicates the flag of function begin or function
end. When probe is executed, the funID and begin/end Flag will
be written into f.
Acquiring the component interaction view
When the instrumented code segment is executed, track data that are written into
the track_data file are obtained as follows (ten data pairs):
1: 0,0 2:1,0 3: 2,0 4: 2,1 5: 3,0 6: 3,1 7: 1,1 8: 3,0 9: 3,1 10: 0,1
Acquiring the component interaction view
Using XML to store the data
• The data directly extracted from the program
and indirectly inferred associations between
components can be represented and stored as
XML files.
Visualization of architecture views
The recovered component interaction view
JavaBeans components set for ReArchJBs
• Thanks
Download