Defining Database Tables (part 1)
Welcome back!
In this blog entry we will begin the definition of a Table DB Module, which will be built on top of our DB Module.
As you will remember the DB Module is the lowest level Module in our Database Layer. He is the only module who interacts with the database, no other module in your application should directly touch the database.
Now I will begin the definition of the Modules who sit atop DB. There are three distinct table Structures that have to be considered.
- Single, or stand-alone, Table - examples of this the bottom Module of the Parent Child Structure, or and Class which has No Children. A Static list of Values, a List of Error Codes. This is often referred to an "is a" paradigm. if an object is a ErrorType, where ErrorType is Not a child.
- Parent-Child Table - A great example of this would be Galaxy, a Galaxy has Many SolarSystems, each SolarSystem has many Planets, Each Planet has Many Factories. As you can see the Parent Child Table Structure is best described as the "Has A" paradigm.
- Many to Many Tables - This is a more complex hybrid of the Parent Child, where in Each Record of one table can relate to one or more records of another. This Relationship model requires the use of a Cross-Reference Table, I like to name these as "Xref" Tables.
I will over the next few blog entries explain these table Models further as I show you how to deal with each from a code perspective. Finally, at the end of this series of blogs I will introduce you to a Product which greatly assists you in developing your Database Layer.
Comments
Post a Comment