Preface – Design Patterns for Embedded Systems in C


Bruce Powel Douglass, Ph.D

The predominate language for the development of embedded systems is clearly C. Other languages certainly have their allure, but over 80% of all embedded systems are developed in this classic language. Many of the advances in the industry assume the use of object-oriented languages, web clients, and technologies that are either unavailable in the bare-metal development environment of embedded systems, or are too memory or resource intensive to be effectively deployed.

Design patterns are one of these profitable areas of advancement. A design pattern is a generalized solution to a recurring problem. Design patterns allow several advantages. First, they allow users to reason about solutions in a more abstract way and to codify their important properties. Since all design patterns are about optimization of some set of design criteria at the expense of others, different design patterns might address the same operational context but provide different benefits and costs. By reifying design patterns as a basic concept, we can reason about the best ways to optimize our systems and the technologies and approaches to accomplish that.

Secondly, design patterns allow us to reuse solutions that have proven themselves to be effective in other, similar circumstances. This is certainly a larger scope of reuse than reusing lines of code or individual functions. Because design patterns can be analyzed for their performance and optimization properties, we can select the best patterns for our particular problems.

Additionally, design patterns give us a larger set of reusable building blocks with which to describe our system. If you say the system uses a “symmetric deployment pattern with RMS multitasking scheduling and a triple modular redundancy approach” that sums up a significant portion of the architectural optimization decisions about your system. Design patterns make our vocabulary larger and more expressive.

Lastly, design patterns provide a unit of reference. If you Google “design patterns” you get over 3,000,000 hits. If you search the Amazon book department online, you get a list of 793 books. There is a great deal of work that goes on in the area of defining and using design patterns, so we are exposed to an enormous wealth of reusable and proven solutions from which we can select, mix, and bring to bear appropriate solutions.

This book brings the power of design patterns to the embedded C developer. Where appropriate, we use an object-based implementation policy with code examples to see how the patterns are implemented and used. The patterns are divided up into different areas of relevance to the embedded developer, including:

  • Hardware access

  • Concurrency

  • State machine implementation

  • Safety and reliability

In each area, different patterns are provided that address common concerns.


The book is oriented toward the practicing professional software developer and the computer science major, in the junior or senior year. It focuses on practical experience by solving posed problems from the context of the examples. The book assumes a reasonable proficiency in the C programming language. UML is used to graphically represent the structure and behavior of the patterns, but code examples are given to clearly show the design and implementation concepts.


The goal of this book is to provide a toolbox for the embedded C developer and to train him or her on the appropriate use of those tools. An agile development workflow, called the Harmony Process™ (developed by the author) is discussed in Chapter 2 to provide a process framework in which patterns have a definite role. However, the use of patterns transcends any individual process, no matter how coolly named.

By the time you’ve reached the end of the book, you will hopefully have the expertise to tackle the real design issues that you face in your life as a professional developer of embedded systems.