Data Model Splendor

../../_images/splendor_big.jpg

game scene in Splendor

Goal

Students draw a data model.

Time

120’

Data modeling

Data modeling is a key activity when developing an IT system. The data model determines what data are stored (data types), where they are kept (data structures) and how they are related (references). When using a releational database, one needs to answer the question which tables should be there and what columns they should have.

Often, more than one data model is possible. Alternative implementations determine, how easy the system is to modify how fast certain queries are executed. Therefore domain knowledge helps with data modeling. By playing a game, you infuse the necessary domain knowledge directly to your class.

In this lesson, the students create a data model for a game. I have used this lesson with many different games: Wizard, Boggle, Yatzhee and Connect Four. The lesson plan below uses the game Splendor, but the lesson practically works with any game.

The Game: Splendor

I used simplified rules of Splendor, to accelerate the game:

  • The level 3 cards and VIPS were removed completely.

  • The maximum number of chips per player was reduced to 8.

  • The game stops immediately if a player reaches 8 points.

This not only speeds up the game, but also allows to play Splendor in a group of six with one set of material.

Lesson Plan

step

description

time

explain the rules of the game

5’

play a game of Splendor

20’

ask: “now we want to save the state of the game. What do we need?”

2’

task students to draw tables and their columns to save the game

5’

hand out paper and let them draw for a while

20’

compare results

10’

draw a data model as an ER-diagram together on the board

10’

optional: implement the model in SQL

30’

Hint

If the students did not have previous exposure to SQL you may want to move the implementation of the SQL database to a follow-up lesson.

../../_images/splendor_big.jpg

ER-diagram for an SQL data model created by students (in German). The model is certainly improvable but as a first attempt it is an important achievement.

Results

Here you find a couple of SQL implementations of Splendor and a few other games:

Reflection Questions

  • is it better to represent the owner of a card as a number player_id=3 or as text owner=”Maria”?

  • how can the data model distinguish between open cards and cards in the draw pile?

  • how could you distinguish two identical cards?

  • is it better to use a single text column for the color of a card (color=’blue’) or as five columns (blue=1, red=0)?

  • what effect do typos have (bleu)?

  • how could you store multiple games?

  • how would you add the VIPs (good homework)

Comments

Splendor is an excellent priming that builds up domain knowledge. Addressing a clear use case (*”save the state of the game”) makes the practical transfer possible.

A pivotal moment is when the students realize that they need more than one table. If you choose a different game, make sure that it requires two or more tables.

If the group is strong, you may want them to implement the data model by themselves.

Hint

Because data modeling is one of the most fundamental skills in data processing, it may be worth to model multiple games in the same course.

Continuation

The data model can be used as a starting point for a whole series of SQL lessons:

  • C.R.U.D. operations

  • primary keys

  • foreign keys and cardinality

  • SQL JOIN

  • Constraints (CHECK, UNIQUE)

  • data normalization

Hint

I have used a very similar lesson structure when modeling data in a programming language using classes. With kids, we modeled data in a spreadsheet.