Skip to Main Content
Test Driven Development for Embedded C
book

Test Driven Development for Embedded C

by James W. Grenning
April 2011
Intermediate to advanced content levelIntermediate to advanced
356 pages
8h 55m
English
Pragmatic Bookshelf
Content preview from Test Driven Development for Embedded C

Improving the Design with Dynamic Interface

Now that we’ve reviewed the existing design with its duplicate conditional logic, let’s improve the design and eliminate the duplication with a dynamic interface.

A dynamic interface uses one or more function pointers to allow the implementation of a given function to be chosen at runtime. This single level of indirection provides runtime flexibility.[31] Function pointers are a powerful language feature that allow the caller of a function to avoid a compile or link-time dependency on a particular function.

Applying OCP and LSP

We can apply the Open Closed and the Liskov Substitution Principles to eliminate the redundant conditional logic. The design vision is illustrated in Figure 26, Extendable ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Design Patterns for Embedded Systems in C

Design Patterns for Embedded Systems in C

Bruce Powel Douglass

Publisher Resources

ISBN: 9781941222997Errata Page