Patterns For Understanding Frameworks
Patterns For Understanding Frameworks
net/publication/234802448
CITATIONS READS
4 2,812
2 authors:
All content following this page was uploaded by Nuno Flores on 03 June 2014.
Learning and understanding a framework is usually a major obstacle to its effective reuse.
Before being able to use a framework successfully, users often need to surpass a steep
learning curve by spending a lot of effort understanding its underlying architecture and
design principles. This is mainly due to users having to understand not only single isolated
classes, but also complex designs of several classes whose instances collaborate for many
different purposes, and using many different mechanisms. In addition, frameworks are also
full of delocalized plans, and use inheritance and delegation intensively, which makes their
design more difficult to grasp at a first glance. How to obtain the necessary information
from the framework itself and its accompanying documentation is the main problem with
framework understanding. Considering its importance, this paper presents an initial
attempt to capture, in the pattern form, a set of proven solutions to recurrent problems of
understanding frameworks. The fundamental objective of this work is to help non-experts
on being more effective when trying to learn and understand object-oriented frameworks.
Introduction The introduction of reuse in a software development process implies splitting the
traditional software life cycle into two interrelated cycles: one focused on developing
reusable assets, and another focused on searching and reusing reusable assets already
developed.
A framework is a reusable design together with an implementation. It consists of a
collection of cooperating classes, both abstract and concrete, which embody an
abstract design for solutions to problems in an application domain [15][16][17].
In the particular case of framework-based application development, the traditional
life cycle can be organized in: a framework development life cycle devoted to build
frameworks, corresponding to the abstraction phase of software reuse; and an
application development life cycle (also known as framework usage) devoted to develop
applications based on frameworks, corresponding to the selection, specialization,
and integration phases of software reuse.
Although the activities of framework development and application development
are often separate and assigned to different teams, the knowledge to be shared
between them is large, as the design of a framework for a domain requires
considerable past experience in designing applications for that domain.
In application development, frameworks act as generative artefacts as they are used
as a foundation for several applications of the framework’s domain. This contrasts
with the traditional way of developing applications, where each application is
developed from scratch. The most distinctive difference between the traditional
and the framework-based development of applications is the need to map the
Patterns for Understanding Frameworks 2
structure of the problem to be solved onto the structure of the framework, thereby
forcing the application to reuse the design of the framework. The positive side of
this is that we don’t need to design the application from scratch. But, on the other
hand, before starting application development, we need to understand the
framework design, a task that sometimes can be very difficult and time-consuming,
especially if the framework is large or complex, and is not appropriately
accompanied with good documentation or training material.
Applications
refining
applying
evolving
documenting
Documentation
framework
developer
Copyright © 2008, Nuno Flores ,Ademar Aguiar. All rights reserved. Permission granted to copy for all purposes of PLoP’2008
Patterns for Understanding Frameworks 3
Black-box frameworks are the easiest to use, because they are structured using
object composition and delegation rather than inheritance. On the other hand,
black-box frameworks are the most difficult to develop, because they require the
definition of the right interfaces and hooks able to anticipate a wide range of
application requirements.
Most real-world frameworks combine black-box and white-box characteristics,
being thus called gray-box frameworks. They allow extensibility both by using
inheritance and dynamic binding, as well as by defining interfaces. Gray-box
frameworks are designed to avoid the disadvantages of black-box frameworks and
white-box frameworks.
Although some of the problems here addressed could also be common to large or
complex software systems, frameworks are specifically designed to be easy to reuse,
thus adding special needs from the point of view of learning and understanding.
Pattern language The pattern language comprises a set of interdependent patterns aiming to help
users become aware of the problems that they will typically face when starting to
learn and understand frameworks. These patterns are targeted for framework users
especially novices. The patterns were mined from existing literature, lessons
learned, and expertise on using frameworks, based on previous studies and
literature reviews of the authors on the topic [5][6].
The pattern language outlines a path commonly followed when learning and
understanding a framework. As many frameworks can be very difficult to learn and
understand, completely or in detail, these patterns aim to expose the tradeoffs
involved in the process of understanding a framework, and to provide practical
guidelines on how to balance them to find the best learning strategy for each
specific person (learner or framework user) and context.
The problems addressed by the patterns are basically raised by the following
questions:
• What do I need to understand about the framework to accomplish my
task? What kind of knowledge do I need? More concrete or abstract? At
code level, design level, documentation level?
• How can I acquire the knowledge I need? Which learning strategy should I
adopt? Which one is best for my needs?
• Which kinds of tools can I use to gather, organize, explore and preserve
the knowledge I value most?
According to [14], framework reuse can be divided into categories according to the
re-user’s interests, whether a framework selector, an application developer, a
framework maintainer, or a developer of other frameworks. These categories range
from selecting, instantiating, flexing, composing, evolving and mining a framework.
For the scope of the pattern language presented in this paper, only the most
commonly used will be addressed: selecting, instantiating and evolving.
Copyright © 2008, Nuno Flores ,Ademar Aguiar. All rights reserved. Permission granted to copy for all purposes of PLoP’2008
Patterns for Understanding Frameworks 4
Patterns overview To describe the patterns, we have adopted Christopher Alexander's pattern form:
Name-Context-Problem-Solution-Consequences [7]. We’ve also added a Rationale section
and a See also section, where known uses and further reading directions can be
found. Before going to the details of each pattern, we will briefly overview the
pattern language with each pattern’s intent and a map (Figure 2) showing their
relationships.
How to choose
a framework ? What are the Understand the preserve your
Instantiating a main components?
architecture knowlegde
framework
How to use Knowledge
the framework? Drive your Captures the Focus on -keeping
high-level design the hot-spots
learning
Benefits from
experience of Understand the preserve your
How to evolve How is the
design internals knowlegde
the framework? flexibility supported ?
Evolving a Implementation
Captures intermediate
framework design concepts details
How is it
preserve your
implemented?
knowlegde
Understand the
source code
When referring to a related pattern within this pattern language, its name will
appear in SMALLCAPS. Otherwise, if it’s an “outside” pattern, it will appear in
SMALLCAPS ITALICISED together with the respective reference.
Copyright © 2008, Nuno Flores ,Ademar Aguiar. All rights reserved. Permission granted to copy for all purposes of PLoP’2008
Patterns for Understanding Frameworks 5
Rationale When using frameworks, one of the key decisions that need to be made is whether
or not the framework fits the application. Since frameworks can be complex,
Copyright © 2008, Nuno Flores ,Ademar Aguiar. All rights reserved. Permission granted to copy for all purposes of PLoP’2008
Patterns for Understanding Frameworks 6
Copyright © 2008, Nuno Flores ,Ademar Aguiar. All rights reserved. Permission granted to copy for all purposes of PLoP’2008
Patterns for Understanding Frameworks 7
Copyright © 2008, Nuno Flores ,Ademar Aguiar. All rights reserved. Permission granted to copy for all purposes of PLoP’2008
Patterns for Understanding Frameworks 8
Copyright © 2008, Nuno Flores ,Ademar Aguiar. All rights reserved. Permission granted to copy for all purposes of PLoP’2008
Patterns for Understanding Frameworks 9
Copyright © 2008, Nuno Flores ,Ademar Aguiar. All rights reserved. Permission granted to copy for all purposes of PLoP’2008
Patterns for Understanding Frameworks 10
system. The evolver performs a change in a single location in the code that is better
understood, but which may lead to unforeseen effects throughout the framework
as its dependencies aren’t properly identified and taken into account.
Rationale The need to evolve a framework usually arises during any of the following
situations: (1) new domain concepts need to be incorporated into the framework,
(2) reducing the complexity of the framework through re-design and (3) initial
design issues that were neglected need to be addressed [22]. The evolution process
usually involves the execution of two tasks: restructure (refactoring) and extension. In
order to restructure it properly, the developer must be aware of all the
repercussions and dependencies of the components or customization areas she
intends to extend or alter. Another concern is application compatibility. The
framework must remain compatible with earlier developed applications, whereas a
faulty evolution process may change the way the framework is supposed to be
used, closing otherwise opened customization points. By understanding how the
framework is supposed to be used will enable the developer to maintain its
interface coherent, without too much effort.
See also In [1], Roberts and Johnson present a pattern language for evolving frameworks
where they show that there is need for the understanding of different levels of
detail concerning the framework components.
In [39], Cortés et al. present a tool to support framework evolution tasks, namely
refactoring and extension. They propose to automate certain kinds of refactoring
tasks and applying extension rules based on Pree’s meta-patterns, which implement
variation points as a combination of template and hook methods.
Copyright © 2008, Nuno Flores ,Ademar Aguiar. All rights reserved. Permission granted to copy for all purposes of PLoP’2008
Patterns for Understanding Frameworks 11
Copyright © 2008, Nuno Flores ,Ademar Aguiar. All rights reserved. Permission granted to copy for all purposes of PLoP’2008
Patterns for Understanding Frameworks 12
Rationale On the field of Program Comprehension, many researchers have studied how
programmers understand programs through observation and experimentation
[28][29]. This research has resulted in the development of several cognitive theories
to describe the comprehension process. These range from bottom-up [30][31], top-
down [32][33], knowledge-based [34] and systematic [35] converging into an
integrated model that frequently switches between all of these [36]. This integrated
model would serve a wider range of learners as it would give the learner the option
of choosing the most effective learning strategy. All of these cognitive models use
existing knowledge together with the code and documentation to create a mental
representation of the program.
See also In [40], Schull et al. performs a study of about reading techniques while learning
about a framework and divides them into two categories: hierarchy-based and
example-based. While the former is mostly used by experienced learners, the latter
gains the preference of the most novice learners. Nevertheless, one important
conclusion of the study is that the learning process should not be strict and allow
the learner to freely choose the way she feels more comfortable with, thus
potentially achieving the better results faster.
In [37], an exploratory study was performed on how developers investigate source-
code in order to perform a change task. One of the major results of that study was
that a methodical investigation of the code of a system was more effective than an
opportunistic approach. Nevertheless, this theory does not imply that a purely
systematic approach to program investigation is the most effective. Successful
subjects also exhibited some opportunistic behaviour.
Copyright © 2008, Nuno Flores ,Ademar Aguiar. All rights reserved. Permission granted to copy for all purposes of PLoP’2008
Patterns for Understanding Frameworks 13
Pattern Knowledge-keeping
You want to keep what you have learned while understanding the framework. You
want to be able to use that knowledge in the future so that you don’t have to do it
all again. Also you want it to be fit for other framework users.
Problem Learning how to use a framework means finding, browsing, using and generating
understanding knowledge. Reusing the knowledge in future learning tasks is as
useful as reusing design and code. Developers go to great lengths to create and
maintain rich mental models of code that are rarely permanently recorded.
Preserving this knowledge for later use is, therefore, of utter importance.
How to adequately preserve the acquired learning knowledge?
Forces Adopting existing documentation artefacts as templates to
Existing Documentation.
harbour new knowledge depends on its availability, easiness of use and quality of
its contents.
Intrinsic knowledge. Much relevant information is kept in the minds of experts that
have used the framework. This knowledge decays with time and never becomes
useful to others but the expert himself. Sharing this knowledge is important, but
might be expensive to experts as it causes interruption and can be time-consuming.
Documentation generation tools, using recovery and extraction techniques,
Tools.
might be used to generate several specific kinds of views and formats over the
information about the framework.
Producing documentation can be tiresome and boring. The long-term
Motivation.
cost-benefit is often overlooked, thus affecting the motivation to spent time and
resources producing documentation.
Solution Use documentation methodologies and tools to produce documentation artefacts
and store them in an open, shared, collaborative environment where the
information can be accessed and evolved through time.
Choose the documentation artefacts that most adequately can register the
knowledge you’ve acquired, namely FRAMEWORK OVERVIEW, GRADED
EXAMPLES, CUSTOMIZATION POINTS, DESIGN INTERNALS and COOKBOOK &
RECIPES [2][3][4].
Consequences The learning knowledge is shared through the community of
Shared knowledge base.
learners, from experts to novices, being all able to use and improve it according to
their needs.
By opening the knowledge to the community, its quality improves
Collaborative effort.
from the constant revising by a heterogeneous group of learners, grasping all the
benefits this can bring.
Copyright © 2008, Nuno Flores ,Ademar Aguiar. All rights reserved. Permission granted to copy for all purposes of PLoP’2008
Patterns for Understanding Frameworks 14
Rationale Good quality documentation is crucial for the effective reuse of object-oriented
frameworks. Without a clear, complete and precise documentation describing how
to use the framework, how it is designed, and how it works, the framework will be
particularly hard to understand and nearly impossible to use by software engineers
not initially involved in its design.
Documenting a framework is not trivial. Producing framework documentation
needs to address several issues ranging from contents consistency to contents
organization. Using framework documentation also poses a problem where issues
like understandability, searchability, and effectiveness need to be adequately
addressed [5].
Adopting known documentation artefacts [2][3][4] specific to our learning task to
store our understanding knowledge helps to lessen the burden of recording our
findings. If that knowledge is then shared with a community of other fellow users,
that burden can be even less because the responsibility of keeping the information
up-to-date is also shared by the other contributors.
The “community” factor also contributes to the refining and quality increase of the
documentation as factors like diversity, independence, decentralization and
aggregation [46] will mitigate quality issues like accommodating different audiences,
having different views over the information or even the lack of standards.
See also In [5], a minimalist approach to framework documentation is proposed. It presents
an extensible documentation infrastructure based on the WikiWikiWeb concept
and XML technology. It provides several document templates and a simple
cooperative web-based environment to produce and use minimalist framework
documentation. The proposed approach covers the overall documentation process,
from the creation and integration of contents till the publishing and presentation. It
encompasses a documentation model, a process and a set of supporting tools.
Copyright © 2008, Nuno Flores ,Ademar Aguiar. All rights reserved. Permission granted to copy for all purposes of PLoP’2008
Patterns for Understanding Frameworks 15
Copyright © 2008, Nuno Flores ,Ademar Aguiar. All rights reserved. Permission granted to copy for all purposes of PLoP’2008
Patterns for Understanding Frameworks 16
Rationale When you know nothing about a framework, usually you try to see what the
framework is for. You look for the title, a paragraph, maybe the name of the
components. These elements are usually on the documentation that accompanies
the framework, whether is a specific document, website or other kind. When trying
to find out its purpose, you look for keywords or something that will shed some
light about the domain concepts of the framework. It is about graphics? It is about
networks? It is general-purpose? What are the concepts it encompasses and how?
Only after you’ve acquired this information you start looking for other details.
See also In [19], the process of determining a framework’s suitability to a problem domain
starts with the domain analysis activity. This activity has several non-contiguous
steps to reach a domain model, where existing documentation (when this
documentation is not available for the framework itself, they resort to
documentation belonging to exiting application developed using that framework) is
reviewed and domain experts are consulted. Also existing standards for the domain
are studied. The result of the activity is a domain analysis model containing the
requirements of the domain, the domain concepts and the relationships between
concepts.
Copyright © 2008, Nuno Flores ,Ademar Aguiar. All rights reserved. Permission granted to copy for all purposes of PLoP’2008
Patterns for Understanding Frameworks 17
Copyright © 2008, Nuno Flores ,Ademar Aguiar. All rights reserved. Permission granted to copy for all purposes of PLoP’2008
Patterns for Understanding Frameworks 18
Copyright © 2008, Nuno Flores ,Ademar Aguiar. All rights reserved. Permission granted to copy for all purposes of PLoP’2008
Patterns for Understanding Frameworks 19
Copyright © 2008, Nuno Flores ,Ademar Aguiar. All rights reserved. Permission granted to copy for all purposes of PLoP’2008
Patterns for Understanding Frameworks 20
Copyright © 2008, Nuno Flores ,Ademar Aguiar. All rights reserved. Permission granted to copy for all purposes of PLoP’2008
Patterns for Understanding Frameworks 21
Copyright © 2008, Nuno Flores ,Ademar Aguiar. All rights reserved. Permission granted to copy for all purposes of PLoP’2008
Patterns for Understanding Frameworks 22
Copyright © 2008, Nuno Flores ,Ademar Aguiar. All rights reserved. Permission granted to copy for all purposes of PLoP’2008
Patterns for Understanding Frameworks 23
References
[1] Roberts, D. and Johnson, R. E. (1997). Evolving frameworks: A pattern language for developing
object-oriented frameworks. In Pattern Languages of Program Design 3. Addison Wesley.
[2] Aguiar, A., and David, G. (2005). Patterns for Documenting Frameworks – Part I. In Proceedings of
VikingPLoP’2005, Helsinki, Finland.
[3] Aguiar, A., and David, G. (2006). Patterns for Documenting Frameworks – Part II. In Proceedings of
EuroPLoP’2006, Irsee, Germany.
[4] Aguiar, A., and David, G. (2006). Patterns for Documenting Frameworks – Part III. In Proceedings
of PLoP’2007, Portland, Oregon, USA.
[5] Aguiar, A. (2003). A minimalist approach to framework documentation. PhD thesis, Faculdade de
Engenharia da Universidade do Porto.
[6] Flores, N. (2006). From Program Comprehension to Framework Understanding: a roadmap.
Available at http://www.fe.up.pt/~nflores
[7] Alexander, C., Ishikawa, S., and Silverstein, M. (1977). A Pattern Language. Oxford University Press.
[8] Zdun, U. and Avgeriou, P., (2005) “Modeling Architectural Patterns Using Architectural Primitives”,
OOPSLA
[9] Gamma, E., Helm, R., Johnson, R., and Vlissides, J. (1995).“Design Patterns — Elements of reusable
object-oriented software”. Addison-Wesley.
[10] Froehlich, G., Hoover, H., Lui, L. and Sorenson, P. (1997) “Hooking into Object-Oriented
Application Frameworks”, Proceedings of the 19th International Conference on Software
Engineering, pp.491- 501.
[11] Buschmann, F., Meunier, R., Rohnert, H., Sommerlad, P. and Stal, M..(1996) “Pattern oriented
software architecture - a system of patterns”. John Wiley and Sons.
[12] Robillard, M., Coelho, W., and Murphy, G., (2004) “How Effective Developers Investigate Source
Code: An Exploratory Study”, IEEE Transactions on Software Engineering, vol..30, no. 12,
December 2004
[13] Felder, R.., and Spurlin, J. (2005) “Applications, Reliability, and Validity of the Index of Learning
Styles”. International Journal of Engineering Education, v. 21, n. 1, pp. 103-112.
[14] Butler, G. (1997). A reuse case perspective on documenting frameworks.
http://www.cs.concordia.ca/faculty/gregb.
[15] Johnson, R. E. and Foote, B. (1988). “Designing reusable classes”. Journal of Object-Oriented
Programming, 1(2):22–35.
[16] Deutsch, L. P. (1989). “Design reuse and frameworks in the smalltalk-80 system”. In Software
reusability: vol. 2, applications and experience, pages 57–71. ACM Press.
[17] Fayad, M. E. and Schmidt, D. C. (1997b). “Object-oriented application frameworks.”
Communications of the ACM, 40(10):32–38.
[18] Turner, A. and Wang, C. (2007). “AJAX: Selecting the Framework that Fits”. Dr. Dobb's Journal,
May 01, 2007. http://www.ddj.com/web-development/199203087
[19] Ahamed, S. I., Pezewski, A., and Pezewski, A. (2004). “Towards Framework Selection Criteria and
Suitability for an Application Framework.” In Proceedings of the international Conference on
information Technology: Coding and Computing (Itcc'04).
[20] Pree, W”. “Design Patterns for Object-Oriented Software Development” (1995). Addison-Wesley /
ACN Press 1995
[21] Fayad, M. E., Schmidt D. C., Johnson, R. E. “Building Application Frameworks” (1999). John Wiley
& Sons, Inc. 1999
[22] Codenie W., Hondt K., Steyaert P., Vercammen A. “From Custom Applications to Domain-Specific
Frameworks.” (1997) Communications of the ACM, 40(10): 71-77. 1997
[23] Butler G., Xu L. “Cascaded Refactoring for Framework Evolution” (2001). Proceedings of 2001
Symposium on Software Reusability. ACM Press. P. 51-57. 2001
Copyright © 2008, Nuno Flores ,Ademar Aguiar. All rights reserved. Permission granted to copy for all purposes of PLoP’2008
Patterns for Understanding Frameworks 24
[24] Felder, R.M. and Silverman, L.K. "Learning and Teaching Styles in Engineering Education" (1988),
Engr. Education, 78(7), 674-681, 1988
[25] Sillito, J., Murphy, G. C., and De Volder, K. (2006). “Questions programmers ask during software
evolution tasks”. In Proceedings of the 14th ACM SIGSOFT international Symposium on Foundations of
Software Engineering (Portland, Oregon, USA, November 05 - 11, 2006)
[26] Kirk, D., Roper, M., and Wood, M. (2005). “Identifying and Addressing Problems in Framework
Reuse”. In Proceedings of the 13th international Workshop on Program Comprehension (May 15 - 16, 2005).
[27] Shull, F., Lanubile, F., and Basili, V. R., "Investigating Reading Techniques for Framework Learning"
(1998), Technical Report CS-TR-3896, UMCP Dept. of Computer Science, 1998
[28] Storey, M-A, “Theories, Methods and Tools in Program Comprehension: Past, Present and Future.”
(2005) Proceedings of the 13th IEEE International Workshop on Program Comprehension (IWPC).
St. Louis, MO, pp. 181-191, IEEE Computer Society Press 2005.
[29] Storey, M-A, Fracchia, F. and Muller, H.. “Cognitive design elements to support the construction of a
mental model during software visualization”. (1997) Proceedings of the 5th International Workshop
on Program Comprehension (IWPC’97), Dearborn, Michigan, pp. 17-28, May, 1997
[30] Pennington, N., “Stimulus structures and mental representations in expert comprehension of
computer programs” (1987), Cognitive Psychology, pp. 295-341, vol 19, 1987.
[31] Shneiderman, B. and Mayer, R., “Syntactic/semantic interactions in programmer behavior: A model
and experimental results” (1979). International Journal of Computer and Information Science, pp.
219-238, 8(3), 1979
[32] Brooks, R., “Towards a theory of the comprehension of computer programs” (1983), International
Journal of Man-Machine Studies, pp. 543-554, vol.18, 1983.
[33] Soloway, E. and Erlich, K. “Empirical studies of programming knowledge” (1984), IEEE
Transactions on Software Engineering, pp. 595-609, SE-10(5), September 1984.
[34] Letovsky, s. “Cognitive processes in program comprehension” (1986), Empirical Studies of
Programmers, pp.58-79, 1986
[35] Littman, D.C., Pinto, J., Letovsky, S. and Soloway, E., “Mental models and software maintenance”
(1986), Empirical Studies of Programmers, pp. 80-98, 1986
[36] Maryhauser and Vans. “Program comprehension during software maintenance” (1995), IEEE
Computer pp. 44-55, August 1995.
[37] Robillard et al. “How Effective Developers Investigate Source Code: An Exploratory Study” (2004).
IEEE Transactions on Software Engineering, Vol. 30, Nº12, December 2004.
[38] Froehlich, G., Hoover, H.J., Liu, L., Sorenson, P.G. “Choosing an Object-Oriented Domain
Framework” (2000), ACM Computing Surveys, vol.32(1), 2000.
[39] Cortés, M., Fontoura, M., Lucena, C. “Framework Evolution Tool” (2006). Journal of Object
Technology, vol.5, no.8, November-December 2006, pp.101-124.
[40] Schull, F., Lanubile, F., Basil, V. “Investigating Reading Techniques for Object-Oriented Framework
Learning”, IEEE TSE, vol.26, nº.11, 2000
[41] Jacobson, E.E., Nowack, P. “Frameworks and Patterns: Architectural Abstractions” (1999). In
Building Application Frameworks, Chapter 2, pp.29-54, John Wiley & Sons, 1999
[42] Shaw, M., Garlan, D., “Software Architecture – Perspectives on an Emerging Discipline”, Prentice
Hall, 1996
[43] Pree, W. (1995). Design Patterns for Object-Oriented Software Development. Addison-Wesley /
ACM Press.
[44] Bruch, M., Schäfer, T. and Mezini, M., “FrUiT: IDE Support for Framework Understanding” (2006)
OOPSLA Eclipse Techonology Exchange, 2006
[45] Fairbanks, G., Garlan D. and Scherlis, W. “Design Fragments Make Using Frameworks Easier”
(2006), OOPSLA 2006.
[46] Surowiecki J. “The Wisdom of Crowds: Why the Many Are Smarter Than the Few and How
Collective Wisdom Shapes Business, Economies, Societies and Nations” (2004), Little Brown 2004
Copyright © 2008, Nuno Flores ,Ademar Aguiar. All rights reserved. Permission granted to copy for all purposes of PLoP’2008