Design patterns are reusable solutions for recurrent architectural problems in software design. Pattern catalogs have been widely used since Gamma et al. [1]. In this paper, Gay et al. address the use of design patterns on the development of TinyOS, an open-source operating system (OS) designed to run on wireless sensor network (WSN) nodes. Such an OS must provide application developers with sufficient abstraction of the node’s underlying hardware platform, but they are very constrained by the platform’s limited resources and power budget.
Design patterns have been successfully applied to different kinds of systems, from large-scale enterprise information systems to embedded real-time devices. However, this paper states that the need for reliability and efficiency on WSNs can prevent the direct application of many well-known patterns. The reason is that most patterns are based on object-orientation, relying on inheritance, dynamic object allocation, and other concepts that are too expensive to be implemented on a wireless sensor node. Sections 1 and 2 of the paper describe the typical constraints of a node’s hardware platform, as well as the restrictions introduced to TinyOS’ programming model in order to cope with them.
In section 3, the authors present a small catalog of eight patterns developed or adapted specifically for TinyOS. The catalog follows the format proposed by Gamma et al. [1], describing for each pattern its intent, motivation, applicability, structure, participants, sample code, known uses, and related patterns. The catalog can be used as a documentation of the design of TinyOS, but it also has great value as a source of reusable solutions for the development of other applications targeted to WSNs (the paper already refers to some applications that effectively use some of the patterns, such as the Mate virtual machine and the TinyDB database). Section 4 presents an analysis of the implementation of some of the described patterns using nesC (TinyOS’s implementation language), as well as a brief report on how nesC’s 1.2 version can better support the implementation of particular patterns.