13
Learning Relational Algebra by Snapping Blocks Jason Gorman, Sebastian Gsell, Chris Mayfield Department of Computer Science James Madison University SIGCSE 2014

Department of Computer Science James Madison University

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Department of Computer Science James Madison University

Learning Relational Algebra by Snapping Blocks

Jason Gorman, Sebastian Gsell, Chris Mayfield

Department of Computer ScienceJames Madison University

SIGCSE 2014

Page 2: Department of Computer Science James Madison University

What is an algebra?

Mathematical system consisting of:

I Operands: variables or values from whichnew values can be constructed

I Operators: symbols denoting proceduresthat construct the new values

These building blocks form expressions

What are some examples from arithmetic?

I [(x + 7)/(y − 3)] + x

What are some examples from set theory?

I R − (S ∪ T )

SIGCSE 2014 Learning Relational Algebra by Snapping Blocks 2 of 13

Page 3: Department of Computer Science James Madison University

Overview of relational algebra

Formal notation for specifying queries

I DBMS translates SQL into relational algebra

Operands:

I Relations

I Constants (finite relations)

Operators:

I Set operations (union, intersection, difference)

I Selection and projection (remove tuples/attributes)

I Cartesian product and join (combine tuples)

I Renaming (change schema / copy relation)

SIGCSE 2014 Learning Relational Algebra by Snapping Blocks 3 of 13

Page 4: Department of Computer Science James Madison University

Combining operations to form queries

Linear notation:

πtitle,year

(σlength≥100(Movies) ∩ σstudioName=‘Fox ′(Movies)

)Expression tree:

πtitle,year

σlength≥100

Movies

σstudioName=‘Fox ′

Movies

SIGCSE 2014 Learning Relational Algebra by Snapping Blocks 4 of 13

Page 5: Department of Computer Science James Madison University

PROBLEM

How do we make theory more hands-on?

Page 6: Department of Computer Science James Madison University

Tools of the trade

SIGCSE 2014 Learning Relational Algebra by Snapping Blocks 6 of 13

Page 7: Department of Computer Science James Madison University

Block based environments

Advantages [Maloney et al. 2010]

I Simplify the programming environment

I Encourage self-directed learning

I Making program execution visual

I Eliminating syntax error messages

I Making variables/data more concrete

Programming focus

I Object-oriented design

I Interactive media

I Simulation and games

I Mobile development

SIGCSE 2014 Learning Relational Algebra by Snapping Blocks 7 of 13

Page 8: Department of Computer Science James Madison University

MAIN IDEA

Block environment for manipulating data!

Page 9: Department of Computer Science James Madison University

Standing on the shoulders of . . .

Features

I Free and open source (AGPL 3.0)

I Works in the browser (JavaScript)

SIGCSE 2014 Learning Relational Algebra by Snapping Blocks 9 of 13

Page 10: Department of Computer Science James Madison University

A quick tour of Bags

http://bags.cs.jmu.edu/

SIGCSE 2014 Learning Relational Algebra by Snapping Blocks 10 of 13

Page 11: Department of Computer Science James Madison University

Bags architecture

Bags (blocks, gui, results)

Snap (blocks, gui, threads)

Morphic (canvas, framework)

JavaScript (dom, runtime)

Implemented via change sets

I See the paper for details

I Special thanks to Snap!

SIGCSE 2014 Learning Relational Algebra by Snapping Blocks 11 of 13

Page 12: Department of Computer Science James Madison University

Moving forward

Additional features

I Bring your own data

I Load/save projects

I From blocks to Greek

Teaching materials

I Exercises and activities

I Scavenger hunt projects

Educational research

I Bags in DB courses

I Bags in CS0 / K-12

SIGCSE 2014 Learning Relational Algebra by Snapping Blocks 12 of 13

Page 13: Department of Computer Science James Madison University

Summary

Bags allows you to

I manipulate data sets interactively

I experiment with relational operators

I practice computational thinking

I visualize mathematical concepts

Invitation: Build your own Bags!

SIGCSE 2014 Learning Relational Algebra by Snapping Blocks 13 of 13