Purpose of this course

This is a guide to writing reusable and maintainable code using the C language.

Reusable code is essential to avoid duplicated effort in software development. Instead of rewriting software components from scratch, a programmer can make use of an existing component. In addition, reusable code helps performance by making it possible to put reusable software components in shared libraries. Thus, reusability is about avoiding duplicated effort between two or more different programs.

Maintainable code serves a somewhat different purpose. Here, the axis is time, but the program remains the same. Again, we try to avoid duplicated effort, but in this case within the same program undergoing evolution. To make such evolution easier, the code must be possible to understand and easy to modify with predictable results.

This guide is meant for the programmer who writes application programs using the C language. It is not meant for the C programmer doing system programming. System programming differs from application programming in that system programming emphasizes performance over reusable and maintainable code. Often these two goals are in conflict, but certainly not always.

There are many types of applications. This document is meant for applications that use symbolic programming, in contrast to numeric (number-crunching) and administrative (management information systems) programming. Symbolic programming refers to the manipulation of sometimes quite complex data objects and relations between them. Such objects typically represent objects in the real world such as people, motors, and regulators, or purely imaginary objects from computer science such as binary trees, file systems, and user accounts.