Pervasive computing offers environments in which user needs or tasks are fulfilled without demanding their attention. This requires discovering a service or a set of services based on context (i.e. user presence, user activity, user location, temperature level, light intensity level etc.). An atomic service may sometimes meet the simple user needs but meeting of complex user needs may lead to discovering a number of relevant services and composing them together. While the composed service may well serve user needs, there come times when a user may want to customize the environment based on her preferences and this require adapting the composed service through parameter adjustment of one of its constituent services or a multiple constituent services. This makes context-awareness in general and contextual service composition and adaptation in particular a core requirement of pervasive computing applications. Services available in the environment may be heterogeneous with regard to different discovery protocols (e.g., UPnP, SLP, JINI, etc.) being used for their publication, discovery and interaction. Context-aware service composition may involve discovery of heterogeneous services and the adaptation of the composed service may involve interacting with heterogeneous constituent services. This raises the issue of service heterogeneity in context-aware service composition and adaptation.
We have also proposed an approach following a separation of concerns, which allows adaptation decision logic (adaptation concern), a core part of context-aware applications, to be independently treated and managed as a separate unit of execution from the rest of application code. The proposed approach allows modelling of adaption concerns as declarative Event-Condition-Action (ECA) polices. This allows rapid development of context-aware applications and their dynamic Modifiability. Another research issue that we address in this thesis is that of user involvement. To this end, we have proposed a user-centric approach that allows the user to participate in development of context-aware applications. To address aforementioned research challenges, we have designed and implemented a system whose detailed description is provided in the thesis. The system has been evaluated through usability, performance and scalability measures.