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

55
Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

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

Page 1: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

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

Page 2: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

This is a true story …

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

Page 3: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

In my advanced database and systems analysis courses:

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

Page 4: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

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,

Page 5: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

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.

Page 6: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

What was the problem?

Page 7: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

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?

Page 8: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

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?

Page 9: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

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?

Page 10: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

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

Page 11: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

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

Page 12: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

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

Page 13: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

We often recited the poster’s “Golden Rule”

Page 14: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

Actually, I used a streamlined version:

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

Page 15: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

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.

Page 16: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

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)

Page 17: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

An important first step …

PUPPY TRICK

LEARNED IN

KNOWS

PUP TRIX

Page 18: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

Now let’s fast-forward to 2010 …

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

Page 19: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

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

Page 20: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

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?

Page 21: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

A classic paper-based records system …

Page 22: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

Behind each main card, there are related cards …

Page 23: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

Buddy

Suppose you had a puppy named Buddy …

Page 24: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

Unnormalized data has repeating groups, like these …

Page 25: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

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

Page 26: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

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

Page 27: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

Pup Fields

These fields describe the puppy …

Page 28: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

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

Page 29: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

Repeating Group

And these fields describe the tricks the puppy knows …

Page 30: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

The trick field cards would form a repeating group.

Page 31: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

Here is how we can eliminate the repeating group …

Page 32: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

Then identify all primary key fields (shown in red)

Page 33: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

The two key fields form a unique combination primary key…

Page 34: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

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)

Page 35: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

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).

Page 36: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

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

Page 37: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

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.

Page 38: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

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

Page 39: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

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

Page 40: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

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

Page 41: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

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

Page 42: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

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…

Page 43: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

PUP TRIX is an associative entity that joins the tables …

Page 44: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

Here are video clips of 2NF …

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

Page 45: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

Finally, the Puppy Poster explains 3NF:

Page 46: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

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?

Page 47: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

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

Page 48: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

Which ones?

Page 49: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

Right! They depend on the primary key, BUT

Page 50: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

They ALSO are determined by the Kennel Code field …

Page 51: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

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

Page 52: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

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:

Page 53: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

Here are some clips from the last normalization video …

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

Page 54: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

That’s the true story of the Puppy Poster …

Page 55: Using Puppies to Teach Data Design Harry J. Rosenblatt, College of the Albemarle Author, Systems Analysis and Design, 9 th Ed.

Thanks for attending!Harry J. Rosenblatt, College of the AlbemarleAuthor, Systems Analysis and Design, 9th [email protected]