GoGaRuCo '09 – Relational Modeling Framework – Nathan Sobo

April 19, 2009 Chad Woolley

Relational Modeling Framework – Nathan Sobo

Intro

GoGaRuCo '09 - Relational Modeling Framework - Nathan Sobo

Video of interaction model that drove thinking

Grockit – it is all common – pushing events collaboratively. This is harder than asynchronous model.

Client needs to respond to to the server in an asynchrounous manner.

All rendering occurs in the browser modifying the DOM as needed.

How do you model this? With a relational model. They build a relational model in the browser.

It is good because you don’t need pointers, you just use foreign keys and scalar values. Really flat, really easy to serialize and move across the wire.

However, it is difficult to work with. Things are indexed by id, etc.

Demo

Lots of live coding. See the video (up soon) at GoGaRuCo.com

New project is “June” – based on Unison, but Unison is being deprecated.

The most primitive object in June is the set

System for working things in the browser.

It behaves as you would expect any relational model. Support add/remove etc.
Example has User, Pet, and Species. Updating Tuples. Testing with Screwunit

Can have events on sets (i.e. on_insert, on_remove, on_update )

GoGaRuCo '09 - Relational Modeling Framework - Nathan Sobo

Events have other stateful information passed through a hash in changed attributes for each event.

on_update(function(model, changed_attributes) {
  if (changed_attributes.name) {
    print(changed_attributes.name.old_value + " was renamed to " + changed_attibutes.name.new_vaue );
  }
});

Also has join model:

var stephs_species = stephs_pets.join(Species).on(Pet.species_id.eq(Species.id)).project(Species);

Also has has_many, and others will be implemented too.

Nathan can live code very well. He is writing a lot of really cool code and talking about it at the same time. Like this:

relates_to_many("pet_species", function() {
  return this.pets_relation
    .join(Species).on(Pet.species_id.eq(Species.id))
    .project(Species);
});

Can also remotely access the entire server-side database (don’t worry, there will be a security model):

var remote = June.remote("/domain");

However, you can’t pull the whole database down to the browser. So, you can get a subset of the data that the client requests.

Security: Only give the browser access to things the user is authorized to see. Every Tuple acts as it’s own database.

Objects that have specific permissions only receive tuples and events that pertain to them.

About the Author

Biography

Previous
Managing Git Resources with Coral
Managing Git Resources with Coral

Author Mislav Marohnic discusses Coral, a way to pull in and organize Git repositories that extends and par...

Next
GoGaRuCo '09 – Arduino is Rails for hardware hacking – Greg Borenstein
GoGaRuCo '09 – Arduino is Rails for hardware hacking – Greg Borenstein

Arduino is Rails for hardware hacking - Greg Borenstein Intro Greg Borenstein Obligatory safety talk ...

×

Subscribe to our Newsletter

!
Thank you!
Error - something went wrong!