Department of Computer Science
University College London
Gower Street
London WC1E 6BT
United Kingdom
E-mail: { A.Finkelstein|A.Savigni}@cs.ucl.ac.uk
In this paper, by "context-awareness" we mean the ability of a particular service to adapt itself to a changing context. One classical example is mobile commerce (m-commerce) applications, which should run equally well on full-fledged Web browsers running on desktop computers, on graphic Personal Digital Assistants (PDAs), on Wireless Application Protocol (WAP)-enabled mobile phones, and possibly even on low-end mobile phones, maybe using Short Message System (SMS).
Requirements engineering in the area of context-aware services, especially when these are targeted towards mobile devices, poses new and very challenging problems, that can be summarised as changing context and changing requirements.
A changing context means essentially that one cannot, while analysing requirements, rely on reassuring assumptions about the world. A changing world complicates the machine by orders of magnitude. In the case of context-aware mobile services, changing context may entail:
volatile concept that can be influenced by the context. For example, in a m-commerce service, a goal can be "maximise usability of the system", which is a very abstract objective that the system should tend to [6]. By contrast, a requirement can be: "the display must show both the current state of the shopping basket and a set of available options". This requirement of course makes sense only if the display is large enough.
One more, fundamental issue related to such services is that they usually belong to the "new economy". This means in general that these systems have an extremely short time-to-market, which in turn means that traditional, heavy-weight methodologies such as the Rational Unified Process (RUP) [5] are not applicable.
For all these reasons, we argue that a new approach is needed to tackle this kind of services. Such an approach is the subject of this paper, and will be described as follows. Section 2 will provide the reader with some background information. Section 3 outlines the reflective approach that will be used throughout the work. Section 4 explains the framework itself, while Sect. 5 sets out some of the key challenges it poses. Finally, Sect. 6 sketches some possible ways to move towards an implementation of the framework.
The problem of allowing a program to reason upon, and possibly change, itself is not new, and has been studied extensively especially in the programming languages community. For example, languages such as LISP and Prolog allow programs to be manipulated as data. More recently, so-called "open languages" (such as OpenC++ [4] or OpenJava [14]) allow programmers to influence the translation process, thus actually providing for the definition of new languages.
For our purposes, reflection means that an explicit, run-time representation of system behaviour is maintained, which reifies the actual system behaviour in the sense that changes in the latter are materialised in the meta-level description. Similarly, changes in the meta-level description reflect back into the underlying system's behaviour. This "closed loop" approach is called causal connection. A reflective system is structured into a (potentially unbound) number of logical levels: the reflective tower [13]. In practice, there are seldom more than two of them.
Reflective systems are based on two concepts: consistency between internal and external representations of the system, and separation between meta computation and computation. The consistency is guaranteed by causal connection: computations performed in the base level are reified by the meta level, whereas changes in the meta level reflect back into the base-level. The separation between meta computation (i. e., computation whose domain [11] is the base-level) and computation (whose domain is the world) is essential in order to achieve transparency: new functionality can be added to an existing system in a transparent way i. e., without the existing system noticing. This is especially true of functionality implementing non-functional requirements, such as fault-tolerance and security.
Why do we regard a reflective approach as such a fundamental issue? First of all, let us make one point clear: reflection, at least in our view, is a mechanism, not a goal. More precisely, it is a mechanism for manipulating meta data in a clean and consistent way. Now, reflection is key in this field because manipulating meta data is essential in this context of highly-dynamic services, as these must be able to dynamically adapt themselves to changing context and changing requirements.
The rest of this section is devoted to a detailed explanation of the framework constituents. This explanation will follow a precise path that moves from the outside inward i. e., from the outer world towards the boundaries with the machine, and finally inside the machine itself. Therefore, we will start from what is available in the world: goals and environment. We will operationalise goals into requirements, and represent environment information into a context; all of this still belongs in the world. Later we will move from requirements and context towards a service description, which is the bridge between the world and the ma-chine (what Michael Jackson calls "specification"). Eventually we move inside the machine with the notion of a service. Note that throughout the paper we will stick to the notion of the machine as pure software; in other words, we will consider devices (PDAs, mobile phones, etc.) as part of the world.
An alternative definition of environment might be: "whatever over which we have no control". If the bandwidth is low, the connection is erratic, the PDA's display is small, the person carrying the mobile phone is driving on a mountain road with many tunnels, this is something that cannot be solved by software. The job of a software engineer can be summarised as a struggle towards the goal despite the environment; all we can do with the environment is know it and describe it in the best possible way, but we cannot change it.
no downwards arrow) because, as explained in the previous section, the environment is not modifiable. A context thus provides a manageable, easily manipulatable description of the environment. Most important, such description is continuously, dynamically updated to take into account the fact that the environment also continuously changes.
In very informal terms, one may say that requirements are a trade-off between the noble goals and the actual reality. For example, the goal of an m-commerce service might be to provide for a highly interactive user experience. Given this goal, if the context is favorable (e. g., high bandwidth, large colour display, Java Virtual Machine implementation available on the PDA) a requirement might be "use a colorful Java applet to represent the state of the shopping basket", whereas if the connection is slow or there is no JVM available, the requirement may be mitigated into "use a 16-colour animated gif".
Now, suppose such a violation is detected. We argue that the "reflective way" is a clean and consistent manner of performing run-time changes to the underlying level (which is, at last, the actual system as perceived by the user). This approach consists in manipulating the service description in order to reconcile the service with the requirements. The causal connection, in particular the downwards link (reflection) provides for the consistency between the service description and the service itself. Architectural reflective techniques can be employed to that aim [2, 3, 15].
Since the service description describes the behaviour of the service, it can be regarded as a system specification in the sense used in [10]. Thus, it serves as the bridge between the world and the machine.
It is also worth pointing out that, apart from goals that are specified off-line and never changed (recall, changing goals means changing what the service provides, and this means at the very least pulling the service down), all the remaining items appearing in Fig. 1 have a run-time image, as emphasised in Fig. 2,
where the run- time components are greyed. Finally, Fig. 3 emphasises (in grey) the meta-level
components i. e., all those components that, even having a run-time image, are not directly visible to the end user.
In addition, as explained in Sect. 4.4, requirements typically change over time, so this representation must not simply be a read-only view, but must rather be an evolvable one.
The main reasons behind such a choice are sketched in the sequel:
We do not yet have a definitive answer to these questions. However, our current thought is that it should be possible to provide a service-independent set of mechanisms for representing context in a significant class of context-aware services. The mechanisms by which such a context is populated in any particular case is clearly a matter for the device vendor.
On the service description side, the situation is more complex, and service description schemes drawn from existing middleware frameworks [1, 7] may be the right direction.
We are also grateful to Licia Capra, Wolfgang Emmerich, and Cecilia Mascolo for the fruitful discussions that influenced some of the views in this paper.
[2] W. Cazzola, A. Savigni, A. Sosio, and F. Tisato. Architectural Reflection: Bridging the Gap Between a Running System and its Architectural Specification. In Proceedings of the 2 nd Euromicro Conference on Software Maintenance and Reengineering and 6 th Reengineering Forum, Florence, Italy, March 8-11 1998.
[3] W. Cazzola, A. Savigni, A. Sosio, and F. Tisato. Rule-Based Strategic Reflection: Observing and Modifying Behaviour at the Architectural Level. In Proceedings of Automated Software Engineering ASE'99 14 th IEEE International Conference, pages 263 266, Cocoa Beach, Florida, USA, Oct 12-15 1999.
[4] S. Chiba. A Metaobject Protocol for C++. In Proceedings of OOPSLA95, pages 285 299, October 1995.
[5] Rational Software Corporation. The Rational Unified Process. http://www.rational.com/products/rup/.
[6] A. Dardenne, A. van Lamsweerde, and S. Fickas. Goal-directed Requirements Acquisition. Science of Computer Programming, 20: 3 50, 1993.
[7] W. Emmerich. Engineering Distributed Objects. John Wiley & Sons, April 2000.
[8] M. Feather, S. Fickas, A. van Lamsweerde, and C. Ponsard. Reconciling System Requirements and Runtime Behavior. In Proceedings of IWSSD'98 -9 th International Workshop on Software Specification and Design, Isobe, Japan, April 1998. IEEE Computer Society Press.
[9] S. Fickas and M. S. Feather. Requirements Monitoring in Dynamic Environments. In Proceedings of the Second IEEE International Symposium on Requirements Engineer-ing, pages 140 147. IEEE Computer Society Press, 1995.
[10] M. Jackson. The World and the Machine. In Proceedings of the 17 th International Conference on Software Engineering, pages 283 292, Seattle, Washington, USA, April 24 28 1995.
[11] P. Maes. Concepts and Experiments in Computational Re-flection. In Proceedings of OOPSLA87, Sigplan Notices. ACM, October 1987.
[12] C. Nentwich, L. Capra, W. Emmerich, and A. Finkelstein. xlinkit: a Consistency Management and Smart Link Generation Service. Technical Report RN/ 00/ 66, University College London Department of Computer Science, December 2000. Submitted for publication.
[13] B. C. Smith. Reflection and Semantics in Lisp. In Conference Record of the 14 th Annual ACM Symposium on Principles of Programming Languages, pages 23 35, Salt Lake City, Utah, USA, January 1984.
[14] M. Tatsubori and S. Chiba. Programming Support of Design Patterns with Compile-time Reflection. In OOPSLA98 Workshop on Reflective Programming in C++ and Java, pages 56 60, Vancouver, Canada, 1998.
[15] F. Tisato, A. Savigni, W. Cazzola, and A. Sosio. Architectural Reflection. Realising Software Architectures via Reflective Activities. In Proceedings of the 2 nd Engineering Distributed Objects Workshop (2000), Davis, California, USA, November 2 3 2000. To appear.
[16] A. van Lamsweerde. Requirements Engineering in the Year 00: A Research Perspective. In Proceedings of ICSE'2000 -22 nd International Conference on Software Engineering, Limerick, 2000. ACM Press. Invited Paper.
[17] K. Yue. What Does It Mean to Say that a Specification is Complete? In Proceedings of IWSSD-4 the Fourth Inter-national Workshop on Software Specification and Design, Monterey, CA, USA, 1987.