Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems...

Post on 31-Mar-2015

227 views 3 download

Tags:

Transcript of Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems...

Using Puppies to Teach Data DesignHarry J. Rosenblatt, College of the AlbemarleAuthor, Systems Analysis and Design, 9th Ed.

This is a true story …

It all began in a computer lab at College of the Albemarle in Elizabeth City, NC, in 1991.

In my advanced database and systems analysis courses:

Students were able to handle one-to-many (1:M) relationships,

In my advanced database and systems analysis courses:

Students were able to handle one-to-many (1:M) relationships,

but they found it much harder to work with many-to-many (M:N) relationships,

In my advanced database and systems analysis courses:

Students were able to handle one-to-many (1:M) relationships,

but they found it much harder to work with many-to-many (M:N) relationships,

and they did not really understand how a relational database forms an overall data structure.

What was the problem?

What was the problem?

Our introductory database course focused on 1:M examples, with little emphasis on M:N relationships

Why did my students have more difficulty with M:N?

What was the problem?

Our introductory database course focused on 1:M examples, with little emphasis on M:N relationships

Students had not created entity-relationship diagrams, and were not familiar with associative entities.

Why did my students have more difficulty with M:N?

What was the problem?

Our introductory database course focused on 1:M examples, with little emphasis on M:N relationships

Students had not created entity-relationship diagrams, and were not familiar with associative entities.

Students had never learned about normalization concepts or data design rules.

Why did my students have more difficulty with M:N?

So, I decided to use the Puppy Poster to teach data design

So, I decided to use the Puppy Poster to teach data design

Students liked the approach and it seemed to work well ...

We often recited the poster’s “Golden Rule”

Actually, I used a streamlined version:

In 3NF, all fields must depend upon the key, the whole key, and nothing but the key.

Students followed a step-by-step process …

• Created entity-relationship diagrams that included associative entities.

• Learned how to use standard notation format.

• Created 1NF designs where all fields depend on the key.

• Created 2NF designs where all fields depend on the whole key.

• Created 3NF designs where all fields depend on the key, the whole key, and nothing but the key.

Here’s the modern version of the puppy model …

Puppy PalaceSituation: Puppy Palace works with TV and movie producers who need dogs that can perform special tricks, such as headstands, somersaults, ladder climbs, and various dog-and-pony tricks. Puppy Palace has about 16 dogs and a list of 50 tricks from which to choose. Each dog can perform one or more tricks, and many tricks can be performed by more than one dog. When a dog learns a new trick, the trainer assigns a skill level. Some customers insist on using dogs that score a 10, which is the highest skill level.

As an IT consultant, you have been asked to suggest 3NF table designs.You are fairly certain that a M:N relationship exists between dogs and tricks.

(Source: Systems Analysis and Design, 9th Edition, Page 443)

An important first step …

PUPPY TRICK

LEARNED IN

KNOWS

PUP TRIX

Now let’s fast-forward to 2010 …

Here are clips from a video session that can help students work with entity-relationship diagrams.

Next, we followed the Puppy Poster command for 1NF:

A typical conversation about repeating groups …

Me: In first normal form, there must be NO repeating groups.

Student: I’m lost. I never heard of repeating groups. What are they?

A classic paper-based records system …

Behind each main card, there are related cards …

Buddy

Suppose you had a puppy named Buddy …

Unnormalized data has repeating groups, like these …

Standard notation format looks like this …

TABLE NAME(Field 1, Field 2, Field 3, etc.)

Notes:• All fields are shown inside a set of parens, and are separated

by commas• The primary key is underlined

Here is standard notation format for an unnormalized design

PUPPY (Pup No, Pup Name, Pup DOB, Breed, Size, Kennel Code, Kennel Name, Kennel Location, (Trick ID, Trick Name, Learned, Skill))

Notes:• The repeating group is shown in an inner set of parens• The main key and repeating group key are both underlined

Pup Fields

These fields describe the puppy …

In the index card example, these cards would have tabs …

Repeating Group

And these fields describe the tricks the puppy knows …

The trick field cards would form a repeating group.

Here is how we can eliminate the repeating group …

Then identify all primary key fields (shown in red)

The two key fields form a unique combination primary key…

And all other fields depend on that key …

PUPPY (Pup No, Trick ID, Pup Name, Pup DOB, Breed, Size, Kennel Code, Kennel Name, Kennel Location, Trick Name, Learned, Skill)

The new video is like an interactive version of the poster …

In this session, students learn how to create a design in first normal form (1NF).

Next, the poster explains how to create a 2NF design …

A typical conversation about Second Normal Form (2NF)

Me: In second normal form, nonkey fields must depend on the whole key – not just part of it.

Student: I don’t understand what that means. Please explain it to me.

For 2NF, we split up a 1 NF table, like this …

The pup-related fields go into the 2NF PUPPY table …

The trick-related fields go into the 2NF TRICKS table …

Fields that depend on the entire key go into a new table …

2NF PUPPY (Pup No, Pup Name, Pup DOB, Breed, Size, Kennel Code, Kennel Name, Kennel Location

2NF TRICKS (Trick ID, Trick Name)

2NF PUP TRIX (Pup No, Trick ID, Learned, Skill)

Now the 1NF design is transformed into three tables in 2NF…

PUP TRIX is an associative entity that joins the tables …

Here are video clips of 2NF …

In this session, students learn how to create designs in second normal form (2NF).

Finally, the Puppy Poster explains 3NF:

A typical conversation about Third Normal Form (3NF)

Me: In third normal form, all non-key fields must depend on the key, the whole key, and nothing but the key. In other words, a non-key field cannot depend on any other non-key field.

Student: Wow. That sounds really complicated. Could you explain it?

In this design, some fields depend on other non-key fields …

Which ones?

Right! They depend on the primary key, BUT

They ALSO are determined by the Kennel Code field …

So they move to a new table, with Kennel Code as the key …

3NF PUPPY (Pup No, Pup Name, Pup DOB, Breed, Size) 3NF TRICKS (Trick ID, Trick Name)3NF PUP TRIX (Pup No, Trick ID, Learned, Skill) 3NF KENNEL (Kennel Code, Kennel Name, Kennel Location)

Here is the complete 3NF design:

Here are some clips from the last normalization video …

In this session, students learn how to create designs in third normal form (3NF)

That’s the true story of the Puppy Poster …

Thanks for attending!Harry J. Rosenblatt, College of the AlbemarleAuthor, Systems Analysis and Design, 9th Ed.harryr@centurylink.net