Thursday, December 29, 2005

Data Structure Patterns - II

In Data Structure Patterns, I referred to embedding data structures in other concrete data types to as a pattern. Linux Device Drivers, third edition talks about embedding kobjects, which I quote here

If you are used to thinking of things in object-oriented terms,kobjects can be seen as a top-level,abstract class from which other classes are derived. A kobject implements a set of capabilities that are not particularly useful by themselves but that are nice to have in other objects. The C language does not allow for the direct expression of inheritance,so other techniques —such as embedding one structure in another —must be used.

I realized that what I originally called a data structure pattern is really a means of achieving inheritance. I would like to refine what I said and call it a "Data Structure mechanism to implemeninheritancece in C". What is interesting to note is that this is not a design pattern, but rather a code pattern to achieve a design goal inheritance.

I would like to thank Jonathan Corbet, Alessandro Rubini, and Greg Kroah-Hartman for their book and seeing things so clearly.
Post a Comment