Thread: Poor db design?
View Single Post
  #10 (permalink)  
Old August 1st, 2009, 06:37 AM
patch patch is offline
Authorized User
Join Date: Jul 2009
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts


I used SYNON/2 on IBM's AS/400 boxes for a good long while.

It is/was what they used to call a CASE tool. Put simply, it was a purely data driven approcah to developing applications on the above boxes. At it's heart was the 'datamodel'.

In the datamodel you described all your entities (tables), elements (fields) of those entities and attributes of each.

You also defiend the relationships between those entities by means of certain phrases.

For example, you may define a Category table with fields such as

Then, if you had subcategories that had to belong to to a category, you would simply say (via the datamodel)

Subcategory Owned by Category

that would simply add the Catid from Category into the definition of the Subcategory table, make it part of the primary key AND, crucially, that simple phrase would, when appropriate, generate the necessary code to check and enforce referential integrity ... it wouldn't be possible, through the application, to add a subcategory that didn't have a valid Category.

The other most commonly used 'phrase' was Refers To. So one table could refer to another for example Product could refer to Colour. So you have a Product table, full of products and a Colour table full of colours.

That Refers to phrase, in the datamodel, meant the the primary key for the colours table was added to the Products table but only as another field, not as a key - a foreign key if you will - AND, again it would generate the necessary code to enfor referential integrity ... you couldn't add a product with a colour that didn't exist in the Colours table.

The datmodel was pretty simple stuff, the real power was in the autogeneration of all the code - both programs and views. You only changed the bits you needed to ... it was kind of a theoretical OO approach to design and build.

Kind of like Rails or CI but much, much more in there. So much of the 'donkey' work was done for you. Prior to using SYNON/2 who ever had the time to write or test code to enforce db integrity? If the db didn't do it on it's own, it probably never got done!

Hope that makes sense and is what you were after.