Tagged: oo

Review: Interface Oriented Design

iodThis is a review of “Interface Oriented Design” by Ken Pugh.

I don’t have a ton to say about this book, it was a fairly quick read at about 200 pages. If you have a lot of experience with OO, the concepts presented within it are nothing that startling, however they may serve the reader as a nice refresher or presentation of important principles in a “interface” oriented and focused approach. I think if anything, one handy thing that the author presented were the “laws” of any interface:

a) “Do what its methods say it does” : this is obviously important as how many times have you seen methods in a program that do what their name implies, but… sometimes add on a bit more undocumented functionality.

b) “Do no harm”: the implementation to should avoid affecting other modules or consuming resources that it does not explicitly declare it will etc.

c) “Provide meaningful errors”: I think this is often missing. Too many times I’ve called some method to get a horrible low-level exception thrown back at me, or a custom one with some un-intelligible error code. Rarely wil you get back something meaningful, like the author suggests which contains not only the problem, but why it occurred and how you can possibly avoid it on the next call.

Overall I found chapters 1-7 to be the most informative, while chapters 8-10 went through some examples which focused on the principles covered in 1-7 in working examples. Chapter 11 covers the standard GoF patterns but from a “interface” based perspective.

Overall, I would say that if you are pretty versed in OO you could get a way with skipping this book. Otherwise if you are intermediate or new to OO and the proper use of interfaces as opposed to constantly using inheritance, this might be a good book for you.

Lastly I will say that after reading this book, when faced with new design decisions, I found myself focusing much, much more on pure interface based designs and minimizing inheritance except where absolutely necessary.