Advances in the field of wireless sensor networks (WSNs) over the last decade have led to a great number of available hardware platforms and operating systems for embedded devices. With the upcoming research area called Internet of Things (IoT) even more new platforms appeared. Consequently, we are now faced with a vast amount of different embedded systems, ranging from tiny microcontrollers to comparably powerful smartphones. Unfortunately, this diversity of hardware architectures has not yet been fully addressed by any generic software architecture. Various operating systems for embedded devices are available, however, each of them cover only a few architectures. Using Java is not possible on tiny microcontrollers because of the lack of a Java Virtual Machine (JVM) on these platforms. Similarly, the entire field of testing is not geared towards dealing with the amount of heterogeneity. Testing environments are mostly homogeneous, and it is not possible to evaluate ideas on large-sized networks consisting of heterogeneous nodes. In this work, we present techniques to address the aforementioned problems. We introduce modern programming paradigms known from desktop computers and transfer these ideas to embedded systems. Furthermore, we built a testing platform consisting of heterogeneous wireless nodes and sensors. Finally, we present novel communication channels that are able to connect nodes that cannot communicate physically, or even real nodes with simulated ones. Hence, this work consists of three parts: While the dominant programming language on embedded systems is still C, we show that more efficient and comfortable results can be achieved by utilizing modern programming paradigms using C++. We therefore transfer the established template-based design of well-known libraries such as the Standard Template Library (STL) or Boost to embedded systems. After thoroughly studying the design of a software architecture based on C++, we present a successful implementation of our ideas: The Wiselib, a generic algorithms library for distributed heterogeneous embedded systems. To run algorithms in an appropriate test scenario, we built a heterogeneous testbed, consisting of different types of nodes and sensors. To this end, we installed self-designed low-cost load sensors based on strain gauges beneath the floor of a hallway in our institute, capable of identifying passers-by. The load sensors are wired to sensor nodes, which in turn allows for the design of sophisticated algorithms doing in-network data processing. The nodes are additionally connected to passive infrared sensors (PIRs) and actuator units---light-emitting diodes (LEDs) and speakers---for interaction with passers-by. The hallway serves as a platform for various application areas. Examples are target tracking, medical testing, and interactive games. Finally, we present virtualized communication links. This technique allows to connect nodes with incompatible radio transceivers or at distant locations. Furthermore, it can be used to let real nodes communicate with virtual nodes in a simulator, which allows for novel debugging mechanisms for distributed embedded systems such as the instantiation of unit tests.