THE SQL Server Blog Spot on the Web

Welcome to SQLblog.com - The SQL Server blog spot on the web Sign in | |
in Search

Paul Nielsen

www.SQLServerBible.com

Multiple Inheritance for Nordic?

<Background>

I’ve been playing with Nordic  (New Object/Relational Design) for a few years, but this year I began to work on a product app using Nordic which was the impetus for beefing up the API. The Nordic 2.0 API and a .net front-end app will be launched at SQL Teach in Vancouver Nov 28th.

</Background>

I’ve presented Nordic to about 20 user groups and conferences over the past few years. At nearly every presentation someone will ask about multiple inheritance. It’s a good question. In my production app, I’d love to define an object that includes properties from both Major Donor and Volunteer. Perhaps due to my ignorance, I’ve always looked at multiple inheritance as an object that belongs to multiple classes. While that could be done, it seems a bit complex. The currnen Nordic API supports morphing an object from one class to another (a necissary feature for any Object/Relational solution), but the Nordic schema is a far cry from defining an object using multiple classes. The most basic assumtion is the every object is defined as belonging to a single class.

Another possible way to extend an object with properties beyond its class is to define optional roles for a class. This would permit any Donor, for example, to also have attributes of a Major Donor role and the Volunteer role simultaneously. Very cool idea suggested to me by Wolfgang Baeck.  I think I’ll add this feature in a future version.

But back to multiple inheritance, while mindlessly browsing the net the a few nights ago I was completely shocked to read that Cache (an object database that claims to be 10-15 times FASTER than any relational database !?!?) supports multiple inheritance. They define multiple inheritance as a single class that inherits from multiple classes. Their example is a Dog class that inherits from both the Mammal and Pet classes.

Now That I can do.

Nordic's current Class metadata table has a SuperClassID which defines the hierarchy of classes. Two functions, SuperClasses(), and Subclasses() navigate the class structure and provide the list of classes for other queries that return the list of attributes that apply to a class or the subclasses for selecting all objects of a given class including subclasses.

Using a SuperClass table to store a many-to-many relationship between classes (like a BOM) is a trivial change. The same to function once refactored can return the superclasses including the multiple inheritance classes. The code generation will then automatically include the additional columns and cascading call tables in the code generated class APIs and tada - multiple inheritance.

I love SQL – any data solution that can be dreamed can be built in SQL.  

Published Saturday, November 03, 2007 11:52 AM by Paul Nielsen
Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Phillip Senn said:

So let's say you have a pet dog named "Jake".

November 6, 2007 7:11 PM
 

Paul said:

Then Jake would be an object of the Dog Class,  Dog:Jake. And he would be defined by attributes of both Pet and Mammal, because the Dog Class inherits from both super classes.

November 8, 2007 8:43 AM
 

Kent said:

Paul, you said "The Nordic 2.0 API and a .net front-end app will be launched at SQL Teach in Vancouver Nov 28th"  

Where can I find info about that?   I thought I read somewhere that it was becoming an open source project.  Will it be on CodePlex or ?

Thanks

November 29, 2007 10:33 PM
 

Darren said:

Paul

I was wondering if there have been any developments regarding releasing this to open source. I'm desperate to have a look at it.

Regards

Darren

April 3, 2008 5:28 AM

Leave a Comment

(required) 
(required) 
Submit

About Paul Nielsen

Paul Nielsen believes SQL is the romance language of data. As such he’s a hands-on database developer, Microsoft SQL Server MVP, trainer, and author of SQL Server Bible series (Wiley). As a data architect, he developed the concepts of Smart Database Design and Nordic – an open source O/R dbms for SQL Server. He lives in Colorado Springs.

This Blog

Syndication

News

news item test
Powered by Community Server (Commercial Edition), by Telligent Systems
  Privacy Statement