Overview

In this lesson, we will discuss the scope of this course.

Why do you need patterns in C?

The pattern format has gained tremendous popularity as a format for capturing experience. We can attribute this popularity to the unique success of the book Design Patterns by the Gang of Four. Design Patterns served the coding community by popularizing patterns. However, the book also led many developers to believe that patterns are limited to object orientation.

Today’s patterns aren’t limited to design, but also includes a broad range of patterns:

  • Patterns for software analysis.
  • Patterns for organizations.
  • Patterns for testing.

When it comes to the actual implementations of patterns, most patterns are still described in the context of an object-oriented design. Most pattern literature is limited to design patterns in Java, C#, Smalltalk, and other popular object-oriented languages. The C language is sadly absent in most pattern literature.

Given the remaining popularity of C,

  • Where are the books targeting the unique implementation constraints and techniques for the language?
  • Isn’t it possible to use patterns in the development of C programs or doesn’t it add any benefits?

The purpose of this course is to answer those questions. This course conveys an idea of how to apply known patterns naturally in C. We discuss the actual implementation techniques and trade-offs.

What you will experience

C programmers can benefit from the growing catalog of patterns.This course will focus on the following areas:

  • Implementation techniques:
    We will present several patterns and demonstrate techniques for implementing them in the context of the C language. Common variations in implementation will be discussed as well.
    The implementations included should not be considered as a final specification. Depending on the problem at hand, the implementation trade-offs for every pattern have to be considered.
  • Problem solved:
    Patterns solve problems. Without any common problem, the pattern may not qualify as a pattern at all.
    Therefore, we will present the main problem solved by introducing the pattern and provide examples of problem domains where the pattern can be used.
  • Consequences on the design:
    Every solution implies a set of trade-offs. Therefore each pattern will discuss the consequences on the quality of the design in the resulting context.

What you won’t experience

This course will not focus on the following areas:

  • Object-oriented feature emulation:
    The pattern implementations will not be based on techniques for emulating object-oriented features such as inheritance or C++ virtual functions.

    These features are better left to a compiler. Manually emulating such techniques is obfuscating at best and a source of hard-to-track down bugs at worst.
    Instead, we intend to present implementations that utilize the strengths of the abstraction mechanisms already included in the C language.
  • In-depth discussion of patterns:
    We should look at each pattern as a complement to the original pattern descriptions. So, this course will not include in-depth treatment of the patterns. Instead, we will provide a high-level description of the pattern and reference existing work, where you can find a detailed examination of the pattern.