C design patterns

broken image

Each pattern is coupled to an example that is useful in furthering your understanding but that won’t make it into your code. This is not a recipe book, as some of the other works on patterns are. UML diagrams are used throughout, and an appendix provides all of the background even a UML neophyte needs to understand the book.

broken image
broken image

It’s quite complex but very thought-provoking. Sure, malloc() may let the caller know that there’s no memory available… but what then? The channel patterns are designed to allow processing to continue, perhaps in a degraded mode, when things go awry. One of the most vexing problems in firmware is how to respond to errors. The second pattern that I particularly liked is really a collection called the channel patterns. When the information is available the publisher notifies all of the subscribers.

broken image

The subscribe to the publishers channel, in effect. Instead, the consumers of the info (the “subscribers”) tell the “publisher” to let them know when the data is available. When many activities need information it’s often inefficient to have them stuck in waiting loops.

broken image