C Interfaces and Implementations: Techniques for Creating Reusable Software
F**S
The best C programming book I have EVER seen, hands down.
I don't normally leave reviews, but I cannot believe how good this book really is. I'm a power C++20 developer who recently has become fascinated with cross-language interoperability and as such have sought to build my own C runtime framework and utility library from scratch (libGimbal), influenced by GLib's GObject and Microsoft COM. I've personally implemented my own C17-based versions of C++'s containers, standard algorithms, multiple types of custom strings, custom allocators, and a meta type system providing uniform object representation across languages.I cannot believe the fact that this book is an almost complete, beautifully architected collection of what amounts to a general-purpose C framework and set of standard containers and algorithms, similar to C++'s STL. If you were to release the examples in the book as a framework, you'd have something similar to GNOME's GLib, which powers all of GTk and the GNOME stack.Is this book still relevant today? 100% absolutely. It's timeless. It should be a must-have for any C programmer--especially with the breadth of subjects it covers. There is pretty much something in here for every type of developer at every skill level. Even for a C++ developer, you can still learn a lot and "C++-itize" a lot of these data structures and concepts. His programming style is concise, easy to read, and unlike most C texts, is not an bunch of small, abstract, academic snippets. These are production-ready and useful in the real world. Also unlike a lot of the esteemed C classic texts, even though the book was written in '97, this feels like how modern C is written today.I only wish I had found this book sooner. I cannot recommend it enough.
R**A
Is this book still relevant?
Hanson reveals the book's essence in Chapter 2, Interfaces & Implementations. In Chapter 2, Hanson differentiates interfaces and implementations. For interfaces, Hanson stresses the importance of clients adhering to interface contracts. These are the interface's expected upheld preconditions and invariants.Starting at Chapter 3, until the end of the book, Hanson reinforces the essential ideas from Chapter 2. He teaches the following concepts:- how to leverage opaque pointers, providing encapsulation- how to use assert(), explicitly stating and ensuring an interface's invariantsUnfortunately, Hanson codes using Knuth's literate programming, which adds unnecessary friction for the reader.Overall, the essence of this book is timeless. (I consider it the C version of Bjarne's lectures on designing good programs. Bjarne always implements the Vector container, maintaining its interface and invariants.)
M**R
Examples of how to write large-scale C programs
A number of years ago, I asked more experienced programmers about how to write larger programs in C and was recommended to read "C Interfaces and Implementations." I can definitely say I was not disappointed, as the book does a good job of showing how to structure a large code base. In fact, if you look at large, open source C code bases such as the Python interpreter or Quake 3 Arena, you will find a number of the principles at work. So, in that regard, the book does a fantastic job.The book also excels at showing how more advanced and/or less used parts of the language and standard library can augment the capabilities of your programs. The chapter on Exceptions using setjmp() and longjmp() is worth the price of entry alone. While especially dry, the multiple and extended precision arithmetic chapters also present a topic that is not found in many other places.If I had to point out one thing that drove me crazy during my reading, it would have to be the overuse of one- and two-letter variable names. While space is at a premium on the page, using names such as "dest" instead of "z" or "sign_of_x" instead of "sx" would have been more elucidating. I found myself losing track of which variable was which in functions that had as many as six one-letter variable names (I'm looking at you XP_div()!).
F**Z
An embedded developer point of view
A very good book also for the embedded field; you can't use much of the code in small 8bit microcontroller environments, but if you work with bigger 16/32bit microcontrollers many of the abstract data types (ADTs) described here can be useful. Maybe the "threads" interface can even be used as a base to develop a tiny cooperative embedded OS, too.The title of the book is not exactly true: this is not a generic text on "C interfaces an implementation", it's a complete and detailed documentation of a well-projected C user level generic library, implementing a lot of ADTs that are not available in the C standard library but are available in many other high(er?) level languages.You may like or not the semantic details and coding style, probably depending on your background: unix/linux programmers may not like it, as they may not like the ADTs prefix-verbosity...It's a way to add modularity to a not-object-oriented language as C is; the same for the "typedef struct T *T" (opaque pointers) in headers: modularity and encapsulation.Pseudocode notation (literate programming) is clear, as long as you read chapter 1.
P**Z
Este libro hay que aprendérselo de memoria...
El contenido me parece buenísimo, para estudiar a fondo. La copia del libro que me llegó no es óptima, porque las página estan un poco onduladas, pero merece 5 estrellas igualmente.
Trustpilot
3 weeks ago
2 months ago