Software in mobile and ubiquitous computing scenarios has to cope with a highly dynamic and heterogeneous environment. For tapping the environment''s full potential, software should be able to dynamically adapt on demand in a platform- and language-independent manner (e.g., by migration). Current systems have only limited support for the requested dynamics and heterogeneity. In the context of this work, the SAMProc middleware is designed. SAMProc supports software developers in creating such adaptive applications. In the SAMProc approach, applications are able to dynamically change the location and to adapt the provided interface, the current state and the implementation in use to the particular local execution context. Thereby, applications are transparently and permanently addressable. This allows continuous interaction with other applications. For easing application development SAMProc uses a model-driven approach. For this purpose, this work introduces the novel concept of a self-adaptive mobile process (SAMProc), which allows code generation on the basis of an abstract specification of the life cycle and distribution aspects of an adaptive application.