Abstract | dc.description.abstract | In 1972, David Lorge Parnas argued that modular programming is extremely valuable for the development of large pieces of code. This is so because a module can be written with little knowledge of the code of other modules and replaced without the need to rewrite the remaining other modules. However, paradigms based on general procedures like object-oriented programming do not fully support modular programming due to crosscutting concerns of a system. Fortunately, the aspect-oriented paradigm provides a set of abstractions and mechanisms that allow developers to modularize these concerns; therefore, improving modular programming. Aspects are widely-known abstractions to modularize crosscutting concerns. An aspect intercepts a single execution point, named join point, to execute a piece of code, named advice, that implements a crosscutting concern. However, some crosscutting concerns cannot be modularized through the interception of a single join point, e.g. error detections. Trace-based mechanisms support the definitions of stateful aspects that intercept join point traces. A stateful aspect is defined by a join point trace pattern and an advice that is executed when this pattern is matched.
Various trace-based mechanisms have been proposed. These mechanisms do not share the exact semantics, which suggests there is no silver-bullet trace-based mechanism for all purposes. In addition, existing mechanisms do not allow developers to expressively define patterns and semantics of their stateful aspects. Therefore, developers end up "coding around" these mechanisms or creating specialized ones to modularize a particular crosscutting concern. In this thesis work, we propose a model of an expressive and open trace-based mechanism, named OTM. This model allows developers to flexibly define patterns and adapt them at runtime. In addition, as OTM follows the open implementation guidelines, this model allows developers to customize
the semantics of how stateful aspects match and advise join point traces. Finally, this dissertation presents a concrete and practical implementation of OTM for JavaScript and a typed functional description in Typed Racket.
We use the JavaScript implementation of our model to develop a number of systems that adapt their behavior when they detect certain contexts, know as context-aware systems. A context is detected by analyzing the history of events of a context-aware system. In this kind of systems, patterns represent the contexts that must be detected and advices represent the system adaptations. The development of these systems showed that our practical version improves modularity support to build (Web) applications, and that will eventually make it possible to empirically validate the benefits brought by an expressive and open trace-based mechanism. | es_CL |