Computer Systems & Architecture Lesson 4

Download Report

Transcript Computer Systems & Architecture Lesson 4

Computer Systems & Architecture
Lesson 4
8. Reconstructing Software Architectures
8. Reconstructing Software Architecture
Objectives
• Describe why we need to reconstruct the software
architecture
• Explain about the database construction
• List the importance of information extraction in
software architecture
8.1 Introduction
• Suppose we have a system that already exists, but
we do not know its architecture. Perhaps the
architecture was never recorded by the original
developers.
• Perhaps it was recorded but the documentation has
been lost. Or perhaps it was recorded but the
documentation is no longer synchronized with the
system after a series of changes.
• How do we maintain such a system? How do we
manage its evolution to maintain the quality
attributes that its architecture has provided for us?
The workbench approach
• Architecture reconstruction requires tool
support, but no single tool or tool set is
always adequate to carry it out.
• For one thing, tools tend to be languagespecific and we may encounter anu number
of languages in the artifacts we examine.
• A workbench should be open and provide a
lightweight integration framework whereby
tools added to the tool set do not affect the
existing tools or data unnecessarily.
Reconstruction activities
•
Software architecture reconstruction
comprises the following activities, carried
out iteratively:
1.
2.
3.
4.
Information extraction
Database construction
View fusion
Reconstruction
8.2 Information extraction
• Information extraction involves analyzing a system’s
existing design and implementation artifacts to
construct a model of it.
• The result is a set of information placed in a database,
which is used in the view fusion activity to construct a
view of the system.
• Information extraction is a blend of the ideal – what
information do you want to discover about the
architecture that will most help you meet the goals of
your reconstruction effort – and the practical – what
information can your available tools actually extract
and present.
• From the source artifacts and other artifacts, you can
identify and capture the elements of interest within the
system and their relationships to obtain several base
system views.
Guidelines
• The following are some practical considerations in
applying this step of the method.
– Use the ‘least effort’ extraction.
– Validate the information you have extracted.
– Extract dynamic information where required.
8.3 Database construction
• The extracted information is converted into
standard format for storage in a database
during database construction. It is necessary to
choose a database model. When doing so,
consider the following:
– It should be well-known model, to make replacing
one database implementation with another
relatively simple.
– It should allow for efficient queries, which is
important given that source models can be quite
large.
- It should support remote access of the
database from one or more geographically
distributed user interfaces.
- It supports view fusion by combining
information from various tables.
- It supports query languages that can express
architectural patterns.
- Checkpointing should be supported by
implementations, which means that
intermediate results can be saved.
Conversion of the extracted information to SQL format
Extracted View
Rigi Standard
Form
SQL Code
• The Dali workbench, for example, uses a
relational database model. It converts the
extracted views into Rigi Standard Form.
• This format is then read in by a perl script
and output in a format that includes the
necessary SQL code to build the relational
tables and populate them with the extracted
information. The above diagram shows an
outline of this process.
Guidelines
• When constructing the database, consider the
following.
– Build database tables from the extracted relations to
make processing of the data views easier during
view fusion.
– As with any database contraction, carefully consider
the database design before you get started.
– Use simple lexical tools like perl and awk to change
the format of data that was extracted using any tools
into a format that can be used by the workbench.
8.4 View fusion
• View fusion involves defining and
manipulating extracted information to
reconcile, augment and establish
connections between the elements.
• Different forms of extraction should provide
complementary information. Fusion is
illustrated using the examples given in the
following sections.
Improving a view
• Consider the two excerpts shown in the below figure,
which are from the sets of methods extracted from a
system implemented in C++.
• These tables include static and dynamic information
about an object-oriented segment of code.
• We can see from the dynamic information that, for
example, list::getnth is called.
• However, this method is not included in the static
analysis because the static extractor tool missed it.
Static and dynamic data information about the
class-contains-method relation
InputValue::GetValue
InputValue::SetValue
List::()
List::length
List::attachr
List::detachr
PrimitiveOp::Compute
InputValue::GetValue
InputValue::SetValue
InputValue::-InputValue
InputValue::InputValue
List::()
List::length
List::getnth
List::list
Arithmeticop::Compute
• Also, the calls to the constructor and destructor
methods of Inputvalue and List are not included in
the static information and need to be added to the
class/method table that reconciles both source of
information.
• In addition, the static extraction in this example
shows that the PrimitiveOP class has a method called
Compute. The dynamic extraction results show no
such class, but they do show classes, such as
ArithmeticOp, which has a Compute method and is
in fact a subclass of PrimitiveOp.
Disambiguating function calls
• In a multi-process application, name clashes are
likely to occur.
• For example, several processes might have a
procedure called main. It is important that
clashes be identified and disambiguated within
the extracted views.
• Once again, by fusing information that can be
easily extracted, we can remove this potential
ambiguity.
Guidelines
• The following are some practical considerations in
applying this step of the method.
– Fuse tables when no single extracted table
provides the needed information.
– Fuse table when there is ambiguity within one of
them, and it is not possible to disambiguate using
a single table.
– Consider different extraction techniques to extract
different information: for example you can use
dynamic and static extraction.
8.5 Reconstruction
• At this point, the view information has been
extracted, stored and refined or augmented to
improve its quality.
• The reconstruction operates on views to reveal
broad, coarse-grained insights into the
architecture. Reconstruction consists of two
primary activities: visualization and interaction
and pattern definition and recognition.
– Visualization and interaction provides a
mechanism by which the user may interactively
visualize, explore and manipulate views.
– Pattern definition and recognition provides
facilities for architectural reconstruction: the
definition and recognition of the code
manifestation of architectural patterns.
Guidelines
• The following are some practical
considerations in applying this step of the
method.
• Be prepared to work with the architect closely
and to iterate several times on the architectural
abstractions that you create.
• When developing code segments, try to build
ones that are succinct and that do not list every
source element.
• Code segments can be based on naming
conventions, if the naming conventions are
used consistently throughout the system.
• Code segments can be used on the directory
structure where files and functions are located.
• Architecture reconstruction is the effort of
redetermining architectural decisions, given
only the result of these decisions in the actual
artifacts.