What is the
Object Oriented Normal Form?
Last week you read that
the third normal form is fine
to model data into a
a logical database design.
OONF Definition
A collection is in OONF
if it is in 3NF and
contains meaningful data elements only.
An example
A Cup contains Pens and Pencils of different colour. |
In 3NF you'll find only 2 entities.
The attributes
last sharpened
and
ink type
are sometimes meaningful, sometimes not.
|
Last sharpened is only meaningful for Pencils.
Sharpening a Pen is nonsense.
Ink type is only meaningful for Pens.
|
Description |
3NF |
OONF |
- Only Pencils can be sharpened.
- Only Pens have ink of a certain type.
|
cup number
Cup size
|
cup number
Cup size
|
writing utensil number
colour
last sharpened
ink type
* cup number
|
writing utensil number
colour
* cup number
|
* writing utensil number
ink type
|
* writing utensil number
last sharpened
|
The OONF is a bit odd at first sight,
having 3 entities sharing the same
key.
The relations of Writing Utensil with Pen and Pencil are of the special kind
one-to-sometimes-one .
- Some writing utensils are a pencil.
- Every pencil is a writing utensil.
OONF in the Conceptual model
In the conceptual design the OONF consists of 3 entities.
- Writing Utensil is abstract.
- Pen is a specialisation of Writing Utensil.
- Pencil is also a specialisation of Writing Utensil.
Database design
In the physical database design you can
- Implement 3 separate tables, with foreign keys from both Pen and Pencil to Writing Utensil.
- Implement 2 tables, for pencil and pen, after
de normalisation of all
attributes of Writing Utensil.
- Implement one table by
combining
all three,
a step backwards from OONF to 3NF.
Object model
When
mapping a conceptual model to an OO model
the OONF remains.
Till
next week,
Nut
|