Combining Static and Dynamic Views For Architecture Reconstruction
Combining Static and Dynamic Views For Architecture Reconstruction
Combining Static and Dynamic Views For Architecture Reconstruction
2
Columbus [12]). to represent the system’s structure [17], and message
sequence charts (MSC) [4] for describing its behaviour.
The dynamic information is obtained by instrumenting
The representations are based on generic elements and
the source code and executing different scenarios in a
they allow us to describe software architectures for
simulator. We instrument the source code with ThirdEye
different domains. In the MSC we use concepts like
[10] and select the scenarios among the features of the
participant and message, which can be matched for
system. This choice aims at enabling the architects to
instance with subsystems at high level or function calls at
understand how the features are implemented in a system.
source code level.
3. Abstraction
To cope with the complexity of the message sequence
The model of the previous phase is usually at a very low charts, we need two mechanisms of abstractions:
level of abstraction. The goal of this phase is to enrich the horizontal and vertical abstractions. Horizontal
model with domain dependent abstractions that will lead abstractions allow us to group the participants of a MSC
to a high level view of the system. Known abstractions in order to reduce their number. As the participants are
can be easily added to the model. Unknown abstractions architectural entities in the static view, the horizontal
have to be identified by the architects, categorised, named grouping in the MSC has to be linked to the hierarchical
and then stored in the model. Such reasoning is conducted grouping in the static view. Vertical abstractions consist
manually by the architects and then fixed in a set of with grouping a set of contiguous messages into one high-
abstraction rules. The abstraction process has also to level message. This allows us to reduce the amount of
produce the architectural views that will be presented in messages and to order them according to the scenarios
the last phase (for example, according to the 4+1 model and sub-scenarios.
[9]). The abstraction process is supported by a Prolog
We follow an iterative process for refining the
system. This allows us to formally specify the abstraction
architectural model with the aid of the system knowledge.
rules and the transformations that we need to apply to the
The initial raw model is a plain representation of the
model. The abstractions rules can be reused for later
system without any hierarchical structure in the static
versions of the same system.
view and many message repetitions in the dynamic view.
4. Presentation To simplify the model, the user needs to switch between
different views (static and dynamic) and maintain them
The architects need to present the reconstructed synchronised. The synchronisation helps the user in
architecture in different formats. We allow the architects
identifying interesting relations in the structure (static
to select a particular architectural view (logical, process,
view) and behaviour (dynamic view) of the system. As
physical, development) and a particular format: graphs proposed by T. Systä [19], we group the participants of
(using Rigi) for the static views and a simplified version
the dynamic views using the static information and we
of message sequence charts [4] for the dynamic views. use the dynamic view to slice the static view to reduce its
We have also exploited UML visualisations with the tool complexity.
Venice [20].
The use cases are also a mechanism for compressing the
4 REQUIREMENTS FOR THE APPROACH dynamic view. We can break the trace into a set of
As we pointed out in Section 2, most of the approaches
hierarchical use cases, which provide a logical partition of
collect language dependent data either by parsing the
the software behaviour by functionality. A use case is the
source code or by tracing functions calls at run time. Such ordered set of messages used to accomplish a software
a low-level reverse engineering leads to a low-level system or user level goal. A scenario is a contiguous
comprehension of the subject software even after
sequence of messages that performs a concrete function
applying abstractions.
but needs the context of a use case. A scenario can appear
Our goal is to generate architecturally significant views of several times in the use case or others and contributes to
the system based on static and dynamic information. We build up and achieve the goal of the use cases. For
want to allow the architects to start from a high-level instance, a user can ‘load a file’ (use case) in a tool, and
view of the structure and behaviour of the subject the program executes many ‘read record’ calls (scenario),
software, and then to descend the levels of abstraction to which uses some lower level calls.
focus on the details of the implementation or smaller parts
We can summarise the requirements in the following
of the system.
points:
The high level view should not contain language - Architecture and programming language independent
programming artefacts as it is mainly intended to inform approach.
the architect about the important relationships of the
system’s high level components. We use directed graphs - Generation of high-level views of the structure and
3
behaviour.
R IG I
- Interactive manipulation and synchronisation of static M enu
and dynamic views. M SC
- Abstraction widely used to cope with system
complexity (message and participant compression,
hierarchical grouping)
- Management of scenarios (and use cases).
- Support for an iterative process of data analysis C om m ands
R IG Ifile M SC file
form at form at
5 THE APPROACH
Our technique aims at creating architectural views based Prolog
on static and dynamic information. We are seeking two
key improvements for the analysis of dynamic Static Analysis
Traces
information: (1) an effective method for managing D ata
4
and the scenarios bMSC [4]. During the data-gathering One key issue of the architects is to manage the
phase, we organise the use cases in a tree hierarchy organisation of the components so that they can
(nested use cases are possible) as shown in Figure 3. The collaborate to implement the system’s features. Each
hierarchy is defined during the data gathering phase, message exchange between two components creates a
inserting bookmarks in the trace. The use cases hierarchy dependency that has to be taken into account by the
can be used to slice the dynamic views and provides architect. In a system with hundreds of components the
context information of the current scenario being dependency graph becomes rather complicated. For this
analysed. The abstractions applied on one scenario are task, the architects can find very useful to have a logical
also reflected overamong the other scenarios in the view that shows the organisation of the components in
hierarchy. packages and their dependences and an execution view
that shows how the components interact. To generate
F
A E those views, we have to analyse the exchange of
B C messages statically and dynamically. This is the focus of
D
the next phases.
A Extraction of Static Information
B The extraction of the static information is carried out with
C a source code analyser that detects all the communication
Trace flow
5
to form subsystems or more abstracted entities. that is done in the real case.
Below there is an example in Prolog where we define four Visualisation.
new components. The components are associated to the The logical view can be visualised with Rigi as a
directory that contains its implementation. hierarchical graph. We can also export the graph from
Rigi to the Venice. Venice allows us to show the logical
contain(‘C all’,X):-register(‘/gui/voice’,X).
view in the UML notation. We use the notation proposed
contain(‘C all’,X):-register(‘/gui/data’,X).
contain(‘M essaging’,X):-register(‘/gui/inst_m sg’,X).
in [18]. Figure 4 shows the logical view of the example.
contain(‘M essaging’,X):-register(‘/gui/em ail’,X). The packages have been created according to the
contain(‘N etw ork’,X):-register(‘/resource/protocol’,X). hierarchy relationship. The edges show the high level
The previous components are then grouped in subsystems dependencies that exist among the packages. The user can
according to their functionality. select the level of detail for the visualisation of the edges
[20].
contain(‘Services’,’C all’).
contain(‘Services’,’C all’).
contain(‘G U I’,’Services’).
contain(‘G U I’,’Application’).
contain(‘R esources’,’D isplay’).
contain(‘R esources’,’N etw ork’).
View selection
To define a view, we need (1) to select its representation
format and (2) to define the set of relationships that have
to be projected in it. We use graph-based representations
for the static information and message sequence charts for
the dynamic information
6
trace(’m sg’,’D ATA_C TR L’,’EM AIL’,’con_active’,30). and dynamic information to be available and presented in
trace(’sc_end’,’SendM ail’,’’,’’,31). different views. Abstraction plays a key role in reducing
The ‘trace’ relationship contains the type of the trace, the the complexity of the models in different dimensions
sender, the receiver, a label and the time stamp. Two (system structure, organisation of scenarios, participants
special events (‘sc_start’ and ‘sc_end’) delimit the begin and messages in the MSC).
and end of a scenario. We elaborate the traces with We have highlighted that the architectural views have to
Prolog propositions in order to apply the abstraction rules be maintained synchronised in order to present the static
created during the static analysis. We plan to use Prolog and dynamic views at the same level of abstraction.
also to separate the different scenarios and to detect
patterns in the sequence chart. The results can be exported The end-user customisation represents a powerful
to the Message Sequence Chart visualiser. mechanism to tailor the tools for the specific subject
system needs. It is an improvement to cope with the wide
Navigating Static and Dynamic Views variety of programming languages. Moreover, it makes
We present an example of navigation in the architectural easy to introduce new features, to aid the process of
model with both the static and dynamic views. Figure 5 abstracting and understanding, like dynamic metrics
shows a graph-based representation of the logical view of calculation and participants clustering algorithms [1].
Figure 4 in Rigi. The graph shows the two components at
the highest level of abstraction: ‘GUI’ and ‘Resources’. The use case hierarchy allows the user to select the
The process (or execution) view is visualised in the MSC starting point of the analysis, either from a bottom-up or a
Visualiser as shown in Figure 6. The MSC is shown at the top-down approach.
same level of abstraction as the logical view in Rigi. The use case hierarchy allows the user to focus into more
Therefore, only the two high level participants and concrete use cases or scenarios. The hierarchy could be
messages are visualised. The messages that are exchanged used to generate other static-dynamic representations, as
among the nodes contained in the two participants are in [11], or collaboration diagrams, at different levels of
hidden. This reduces the objects to be visualised and architecture abstraction. As well, it is useful for program
simplifies the understanding of the MSC. comprehension, to isolate smaller scenarios, discover
The user can navigate the two views by expanding or errors or analyse concrete behaviour.
collapsing the nodes in the same style like in Rigi. The Our future work will focus on creating a better
system takes care of maintaining the two views management for the scenarios and defining a technique
synchronised. We imagine the user wants to investigate for detecting interaction patterns in the MSC using
the details of the ‘GUI’ component. The user can expand Prolog.
the GUI node for example in the logical view, as shown
in Figure 7. The same effect is propagated to the MSC, as 8 REFERENCES
shown in Figure 8. The messages between the two 1. Cho E. S., Kim C. J., Kim S. D., Rhew S. Y., Static
components (‘Services’ and ‘Application’) of the ‘GUI’ and Dynamic Metrics for Effective Object Clustering,
component are visible. The same result can be achieved Proceedings of the Asia Pacific Software Engineering
by selecting and expanding a node in the MSC. Conference, December 2-4 1998, Taipei, Taiwan.
The user can also apply vertical abstractions in order to 2. Hofmeister C., Nord R.L. and Soni D., Describing
hide a set of messages. In Figure 9, the user selects a set Software Architecture with UML, Proc. of the 1st
of messages. The selection can be either contiguous or Working IFIP Conference on Software Architecture,
not. The user can then group together the messages in one Kluwer Academic Publishers, 1999.
single message that represents them. In case of un- 3. Holt R., Structural Manipulations of Software
contiguous messages, multiple groups are created. The Architecture using Tarski Relational Algebra,
result of the grouping is shown in Figure 10. Figure 11 Proceedings of the Working Conference on Reverse
and Figure 12 show the views at a lower level of Engineering 1998, pp. 210-219, 1998.
abstraction where the two low level elements
(‘MAKE_CALL’ and ‘SEND_MAIL’) are visible. 4. ITU-T. recommendations Z.120. ITU –
Telecommunication Standarization Sector, Geneva,
The user can also follow a bottom-up approach by Switzerland, may 1996. review draft Version.
starting with a raw model and by grouping the nodes
towards higher levels of abstraction. The system takes 5. Jerding D., Rugaber S., Using visualization for
care of keeping the views synchronised. Architectural Localization and Extraction,
Proceedings of the Working Conference on Reverse
7 CONCLUSIONS AND FUTURE WORK Engineering, (WCRE97), pp. 56-65, October 1997,
Understanding a software architecture requires both static Amsterdam, Netherlands..
7
6. Kazman R., Carrière S. J., View Extraction and View 17. Riva C., Reverse Architecting: an Industrial
Fusion in Architectural Understanding, Proceedings Experience Report, Proceedings of the 7th Working
of the fifth International Conference on Software Conference on Reverse Engineering (WCRE2000),
Reuse (ICSR5), pp.290-299, IEEE Computer Society Brisbane, Australia, 23-25 November, 2000.
Press, Victoria, B.C, Canada, June 1998.
18. Riva C., Xu J. and Maccari A., Architecting and
7. Koskimies K., Männistö T., Systä T., Tuomi J.: Reverse Architecting in UML, Workshop on
Automated support for modeling of OO software. Describing Software Architecture with UML,
IEEE Software, January/February 1998, 87-94. International Conference on Software Engineering
2001 (ICSE), Toronto, May 2001.
8. Koskimies K., Mössenböck H., SCENE: Using
Scenario Diagrams and Active Text for Illustrating 19. Systä T., Static and Dynamic Reverse Engineering
Object-Oriented Programs, Proceedings of the 18th Techniques for Java Software Systems, Ph.D Thesis,
International Conference on Software Engineering, University of Tampere, Dept. of Computer and
(ICSE ’96), IEEE Computer Society Press, pp 366- Information Sciences, Report A-2000-4, 2000.
375, 1996.
20. Venice, http://www.cs.Helsinki.FI/group/venice/
9. Kruchten P.B., The 4+1 View Model of architecture,
21.Danny B. Lange and Yuichi Nakamura. Program
IEEE Software, 12(6):42-50, 1995.
Explorer: A Program Visualiser for C++. In Proc. of
10. Lencevicius R., Ran A., Yairi R., ThirdEye – the USENIX Conference on Object-Oriented
Specification-Based Analysis of Software Execution Technologies, June 1995.
Traces, Proceedings of the 22nd International
Conference on Software Engineering (ICSE 2000),
Limerick, Ireland, 4-11 June, 2000, page 772.
11. Leue,S., Mehrmann L., Rezai M., Synthesizing
software architecture descriptions from Message
Sequence Chart specifications, Proceedings of the
13th IEEE International Conference on Automated
Software Engineering (ASE ’98), 1998, Page(s): 192 -
195
12. R. Ferenc, F. Magyar, Á. Beszédes, Á. Kiss and M.
Tarkiainen. Columbus - Tool for Reverse Engineering
Large Object Oriented Software Systems, Proc. of
SPLST 2001, Szeged, Hungary, pp. 16-27, June 15-
16, 2001. (ed. T. Gyimothy)
13. Ran A., “ARES Conceptual Framework for Software
Architecture” in M. Jazayeri, A. Ran, F. van der
Linden (eds.), Software Architecture for Product
Families Principles and Practice, Addison Wesley,
2000.
14. RedHat Source Navigator,
http://sources.redhat.com/sourcenav/
15. Richner T., Ducasse S., Recovering high-level views
of object-oriented applications from static and
dynamic information, Proceedings of the IEEE
International Conference on Software Maintenance
(ICSM '99), Oxford, 1999, Page(s): 13 -22
16. Rigi: a visual tool for understanding legacy systems,
University of Victoria, http://www.rigi.csc.uvic.ca/
8
Figure 5. The component view in Rigi. Figure 6. The MSC in the MSC visualisarer.
Figure 7. Expand node. Figure 8. Expand node. Figure 9. Selection in MSC. Figure 10. Grouping.
Figure 11. Low level. Figure 12. Low level details in MSC.