LWN.net Logo

Object-oriented design patterns in the kernel, part 1

Object-oriented design patterns in the kernel, part 1

Posted Jun 1, 2011 20:40 UTC (Wed) by michaeljt (subscriber, #39183)
Parent article: Object-oriented design patterns in the kernel, part 1

Surely one of the most important reasons for using a real function as a default and not a NULL pointer (see [ http://en.wikipedia.org/wiki/Null_Object_pattern ] by the way) is that having every caller check for NULL adds the potential for lots of additional typing mistakes or other errors in the caller code.


(Log in to post comments)

Object-oriented design patterns in the kernel, part 1

Posted Jun 1, 2011 22:32 UTC (Wed) by martinfick (subscriber, #4455) [Link]

I think that would fall under Neil's generalization that:

> In general, any testing performed by the caller before calling a method can be seen as an instance of the "mid-layer mistake" discussed in a previous article.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds