In this paper we present STITCH, a middleware that facilitates the development of ubiquitous user-centric and contextaware applications. These systems are built form distributed components which are highly heterogeneous, covering a large range of hardware configurations, from sensors to computers, and with software ranging from embedded software with small footprint to larger scale services. We believe it is essential to provide infrastructure support to express system behaviors across such components. Our approach relies on an integrated view of distributed events and transactional resource manipulation. The former is well-suited to loosely couple small devices,while the latter allows for verification of distributed conditions and coordination of actions, STITCH provides a common layer of abstraction allowing application developers to take advantage of both paradigms.