SlideShare a Scribd company logo
1 of 35
Download to read offline
Voyage by example
tips and tricks on persisting object models
Esteban Lorenzano
Pharo core developer
INRIA - RMoD
http://smallworks.eu
Why?
• You already know about Voyage
• You already attended to a tutorial last year
• But there are some recurrent problems people find
when trying to use it
• And I’m still seeing a lot of people that could be
using it and they chose other solutions
What is Voyage? (1)
• Simple abstraction layer to map objects into a database
- Very well suited for document databases, but in theory,
the approach will work for other kind of repositories
‣ There was (long time ago) a Voyage-GLORP backend
‣ There was (even more time ago) a Voyage-
ImageSegment backend
- Voyage-Memory, Voyage-Mongo
What is Voyage? (2)
• Did I said is simple?
• it ensures object identity
• it provides error handling
• it implements a connection pool
Voyage principles
• Behavioural complete (for common usage), but
decoupled approach also possible.
• Same design for different backends, but not a
common abstraction
- There is no such thing as a “voyage query
language”, etc.
- is a bit more work for users who want to switch,
but a lot more happiness for the program itself
Voyage ultimate goal
To be the GLORP for NoSQL databases
The problem to solve
Impedance mistmatch
Table BTable A Table C
Class A Class B Class C
1..*
*..*
Ideal relational model
Impedance mistmatch
anObject otherObject
aColection
firstObject
secondObject
thirdObject
Real object model
Impedance mistmatch
Real object model
anObject otherObject
aColection
firstObject
secondObject
thirdObject
Impedance mistmatch
Real object model
anObject otherObject
aColection
firstObject
secondObject
thirdObject
So, what about those tips?
Think in objects
A simple model
Hero Power
*..*
Persist
(Hero named: ‘Groot’)
addPower: ((Power named: ‘Plant Control’)
level: #epic;
yourself);
save.
Persist
{
_id: OID(…),
#version: …,
#instanceOf: ‘Hero’,
name: ‘Groot’,
powers: [ { #collection: ‘Power’, __id: OID(…) } ]
}
!
{
_id: OID(…),
#version: …,
#instanceOf: ‘Power’,
name: ‘Plant Control’,
level: #epic,
heroes: [ #collection: ‘Hero’, __id: OID(…) ]
}
Take control
A simple model
(a bit more complete)
Hero Power
*..*
Equipment
1..*
Container Pistol
1..*
Persist
(Hero named: ‘Star-lord’)
addEquipment: (Container
addItem: Pistol new;
yourself);
save.
Persist (1)
{
_id: OID(…),
#version: …,
#instanceOf: ‘Hero’,
name: ‘Star-lord’,
powers: [],
equipment: [ {
#instanceOf: ‘Container’,
‘items’, [
{ #instanceOf: ‘Pistol’ } ] } ]
}
Persist (2)
{
_id: OID(1),
#version: …,
#instanceOf: ‘Hero’,
name: ‘Star-lord’,
powers: [],
equipment: [ { #collection: ‘Equipment’, __id: OID(2) } ]
}
!
{
_id: OID(2),
#version: …,
#instanceOf: ‘Container’,
items: [ { #collection: ‘Equipment’, __id: OID(3) } ]
}
!
{
_id: OID(3),
#version: …,
#instanceOf: ‘Pistol’,
}
Integrity is a
consequence
Allowing missing content
• We do not have foreign keys
- So we cannot do things like “ON DELETE
CASCADE”
- Even delete validations are difficult
‣ Imagine “hero” has a “power”,and I remove the
“power”. How can the hero notice it?
Persist
mongoContainer
<mongoContainer>
!
^ VOMongoContainer new
collectionName: ‘powers’;
enableMissingContent;
yourself
Querying smart
Query (1)
Hero
selectMany: [ :each | … ]
sortBy: { #name -> VOOrder ascending } asDictionary
limit: 100
offset: 100
Query (2)
Hero
selectMany: {
‘name’ -> {
‘$regexp’ -> ‘^G.*’.
‘$options’ -> ‘i’
} asDictionary
} asDictionary
Adapt schemes
The “scheme is not mine”
problem
• You can move meta-information to your program
• Magritte-Voyage gives you a lot of power
• You can extend/modify parts of the updating
system too (like versioning)
Meta-information
{
_id: OID(…),
#version: …,
#instanceOf: ‘Hero’,
name: ‘Star-lord’,
powers: [],
equipment: [ {
#instanceOf: ‘Container’,
‘items’, [
{ #instanceOf: ‘Pistol’ } ] } ]
}
Meta-information
{
_id: OID(…),
#version: …,
#instanceOf: ‘Hero’,
name: ‘Star-lord’,
powers: [],
equipment: [ {
#instanceOf: ‘Container’,
‘items’, [
{ #instanceOf: ‘Pistol’ } ] } ]
}
Meta-information
{
_id: OID(…),
name: ‘Star-lord’,
powers: [],
equipment: [ {
‘items’, [ {} ] } ]
}
Voyage 2.0
• Root detection (enhance save & update)
• Cyclic detection
- Add strategy to persist cycles even without roots (It has some
consequences (in querying, etc.), so it will be optional)
• integrity validations
- #removeWithDependencies
• Materialisation customisations
- #readRaw
• Add backend: Riak
Use it today!
Gofer it
smalltalkhubUser: ‘Pharo’ project: ’MetaRepoForPharo30’;
configurationOf: ‘VoyageMongo’;
loadStable.
Thanks!!
Esteban Lorenzano - 2014

More Related Content

What's hot

Designers Guide To jQuery
Designers Guide To jQueryDesigners Guide To jQuery
Designers Guide To jQuerySteve Krueger
 
Multitenant applications: How and Why
Multitenant applications: How and WhyMultitenant applications: How and Why
Multitenant applications: How and WhyFilipe Ximenes
 
Serializing Ruby Objects in Redis
Serializing Ruby Objects in RedisSerializing Ruby Objects in Redis
Serializing Ruby Objects in RedisBrian Kaney
 
Creatively creating custom post types! word sesh2
Creatively creating custom post types!  word sesh2Creatively creating custom post types!  word sesh2
Creatively creating custom post types! word sesh2techvoltz
 
Advanced Debugging with Xcode - Extending LLDB
Advanced Debugging with Xcode - Extending LLDBAdvanced Debugging with Xcode - Extending LLDB
Advanced Debugging with Xcode - Extending LLDBAijaz Ansari
 
Getting startedwith noir-clojureexchange-2011
Getting startedwith noir-clojureexchange-2011Getting startedwith noir-clojureexchange-2011
Getting startedwith noir-clojureexchange-2011John Stevenson
 
Using Data That Isn't Yours
Using Data That Isn't YoursUsing Data That Isn't Yours
Using Data That Isn't Yourscogsprocket
 
Joomla plugin & module develpment - Presented at Sydney JUG 09/04/2013
Joomla plugin & module develpment - Presented at Sydney JUG 09/04/2013Joomla plugin & module develpment - Presented at Sydney JUG 09/04/2013
Joomla plugin & module develpment - Presented at Sydney JUG 09/04/2013Tim Plummer
 
Ruby in ogrodje Rails
Ruby in ogrodje RailsRuby in ogrodje Rails
Ruby in ogrodje RailsOto Brglez
 
Lumberjack 2 - Supercharging WordPress in 2018
Lumberjack 2 - Supercharging WordPress in 2018Lumberjack 2 - Supercharging WordPress in 2018
Lumberjack 2 - Supercharging WordPress in 2018Joe Lambert
 
Get Django, Get Hired - An opinionated guide to getting the best job, for the...
Get Django, Get Hired - An opinionated guide to getting the best job, for the...Get Django, Get Hired - An opinionated guide to getting the best job, for the...
Get Django, Get Hired - An opinionated guide to getting the best job, for the...Marcel Chastain
 
[WLDN] Supercharging word press development in 2018
[WLDN] Supercharging word press development in 2018[WLDN] Supercharging word press development in 2018
[WLDN] Supercharging word press development in 2018Adam Tomat
 

What's hot (19)

Designers Guide To jQuery
Designers Guide To jQueryDesigners Guide To jQuery
Designers Guide To jQuery
 
Multitenant applications: How and Why
Multitenant applications: How and WhyMultitenant applications: How and Why
Multitenant applications: How and Why
 
Your JavaScript Library
Your JavaScript LibraryYour JavaScript Library
Your JavaScript Library
 
bcgr3-jquery
bcgr3-jquerybcgr3-jquery
bcgr3-jquery
 
Serializing Ruby Objects in Redis
Serializing Ruby Objects in RedisSerializing Ruby Objects in Redis
Serializing Ruby Objects in Redis
 
Creatively creating custom post types! word sesh2
Creatively creating custom post types!  word sesh2Creatively creating custom post types!  word sesh2
Creatively creating custom post types! word sesh2
 
Sprockets
SprocketsSprockets
Sprockets
 
Essential YUI
Essential YUIEssential YUI
Essential YUI
 
Advanced Debugging with Xcode - Extending LLDB
Advanced Debugging with Xcode - Extending LLDBAdvanced Debugging with Xcode - Extending LLDB
Advanced Debugging with Xcode - Extending LLDB
 
Getting startedwith noir-clojureexchange-2011
Getting startedwith noir-clojureexchange-2011Getting startedwith noir-clojureexchange-2011
Getting startedwith noir-clojureexchange-2011
 
Using Data That Isn't Yours
Using Data That Isn't YoursUsing Data That Isn't Yours
Using Data That Isn't Yours
 
Joomla plugin & module develpment - Presented at Sydney JUG 09/04/2013
Joomla plugin & module develpment - Presented at Sydney JUG 09/04/2013Joomla plugin & module develpment - Presented at Sydney JUG 09/04/2013
Joomla plugin & module develpment - Presented at Sydney JUG 09/04/2013
 
The jQuery Divide
The jQuery DivideThe jQuery Divide
The jQuery Divide
 
Ruby in ogrodje Rails
Ruby in ogrodje RailsRuby in ogrodje Rails
Ruby in ogrodje Rails
 
Lumberjack 2 - Supercharging WordPress in 2018
Lumberjack 2 - Supercharging WordPress in 2018Lumberjack 2 - Supercharging WordPress in 2018
Lumberjack 2 - Supercharging WordPress in 2018
 
Get Django, Get Hired - An opinionated guide to getting the best job, for the...
Get Django, Get Hired - An opinionated guide to getting the best job, for the...Get Django, Get Hired - An opinionated guide to getting the best job, for the...
Get Django, Get Hired - An opinionated guide to getting the best job, for the...
 
Puppet & Vagrant Intro
Puppet & Vagrant IntroPuppet & Vagrant Intro
Puppet & Vagrant Intro
 
[WLDN] Supercharging word press development in 2018
[WLDN] Supercharging word press development in 2018[WLDN] Supercharging word press development in 2018
[WLDN] Supercharging word press development in 2018
 
Redis, Resque & Friends
Redis, Resque & FriendsRedis, Resque & Friends
Redis, Resque & Friends
 

Viewers also liked

2015 july 9 europeana labs market & audiences
2015 july 9 europeana labs market & audiences2015 july 9 europeana labs market & audiences
2015 july 9 europeana labs market & audiencesEuropeana
 
Middle east infographic
Middle east infographicMiddle east infographic
Middle east infographicWissam Dandan
 
Impact eats sustainability for lunch!
Impact eats sustainability for lunch!Impact eats sustainability for lunch!
Impact eats sustainability for lunch!Europeana
 
Web 2.0 and Depository Web Sites: A Winning Combination (FDLP Version)
Web 2.0 and Depository Web Sites: A Winning Combination (FDLP Version)Web 2.0 and Depository Web Sites: A Winning Combination (FDLP Version)
Web 2.0 and Depository Web Sites: A Winning Combination (FDLP Version)Peter Thayer
 
Europeana Publishing Framework (Concept) at Culture Jam
Europeana Publishing Framework (Concept) at Culture JamEuropeana Publishing Framework (Concept) at Culture Jam
Europeana Publishing Framework (Concept) at Culture JamEuropeana
 
Compliance In A Box Documentum Deployment Solution
Compliance In A Box Documentum Deployment SolutionCompliance In A Box Documentum Deployment Solution
Compliance In A Box Documentum Deployment Solutionairsch
 
Delicious Linkroll Instructions
Delicious Linkroll InstructionsDelicious Linkroll Instructions
Delicious Linkroll InstructionsPeter Thayer
 
2012 oct 22 shaping access presentation_alt
2012 oct 22  shaping access presentation_alt2012 oct 22  shaping access presentation_alt
2012 oct 22 shaping access presentation_altEuropeana
 
Impact workshop glasgow
Impact workshop glasgowImpact workshop glasgow
Impact workshop glasgowEuropeana
 
110322 Social media för företag
110322 Social media för företag110322 Social media för företag
110322 Social media för företagPetter Kolseth
 
Projecte Educatiu del Centre
Projecte Educatiu del CentreProjecte Educatiu del Centre
Projecte Educatiu del CentreMercè Puig
 
6 Secrets To A Powerful Life
6 Secrets To A Powerful Life6 Secrets To A Powerful Life
6 Secrets To A Powerful Lifemarktittley
 
Lite färsk omvärldsbevakning
Lite färsk omvärldsbevakningLite färsk omvärldsbevakning
Lite färsk omvärldsbevakningPetter Kolseth
 
Meet Charlie - What is Enterprise 2.0?
Meet Charlie - What is Enterprise 2.0?Meet Charlie - What is Enterprise 2.0?
Meet Charlie - What is Enterprise 2.0?倉博 胡
 
Comics and the Storytelling Imperative
Comics and the Storytelling ImperativeComics and the Storytelling Imperative
Comics and the Storytelling ImperativeRyan Evans
 
Avaliação de métodos de Segmentação mediante algoritmos de Machine Learning
Avaliação de métodos de Segmentação mediante algoritmos de Machine LearningAvaliação de métodos de Segmentação mediante algoritmos de Machine Learning
Avaliação de métodos de Segmentação mediante algoritmos de Machine Learningtookumy
 
Networking Now & Personal Branding
Networking Now & Personal BrandingNetworking Now & Personal Branding
Networking Now & Personal BrandingPreston Lewis
 

Viewers also liked (20)

2015 july 9 europeana labs market & audiences
2015 july 9 europeana labs market & audiences2015 july 9 europeana labs market & audiences
2015 july 9 europeana labs market & audiences
 
Middle east infographic
Middle east infographicMiddle east infographic
Middle east infographic
 
Impact eats sustainability for lunch!
Impact eats sustainability for lunch!Impact eats sustainability for lunch!
Impact eats sustainability for lunch!
 
Connect2 Books2
Connect2 Books2Connect2 Books2
Connect2 Books2
 
Web 2.0 and Depository Web Sites: A Winning Combination (FDLP Version)
Web 2.0 and Depository Web Sites: A Winning Combination (FDLP Version)Web 2.0 and Depository Web Sites: A Winning Combination (FDLP Version)
Web 2.0 and Depository Web Sites: A Winning Combination (FDLP Version)
 
Europeana Publishing Framework (Concept) at Culture Jam
Europeana Publishing Framework (Concept) at Culture JamEuropeana Publishing Framework (Concept) at Culture Jam
Europeana Publishing Framework (Concept) at Culture Jam
 
Compliance In A Box Documentum Deployment Solution
Compliance In A Box Documentum Deployment SolutionCompliance In A Box Documentum Deployment Solution
Compliance In A Box Documentum Deployment Solution
 
Delicious Linkroll Instructions
Delicious Linkroll InstructionsDelicious Linkroll Instructions
Delicious Linkroll Instructions
 
2012 oct 22 shaping access presentation_alt
2012 oct 22  shaping access presentation_alt2012 oct 22  shaping access presentation_alt
2012 oct 22 shaping access presentation_alt
 
Loading Paper
Loading PaperLoading Paper
Loading Paper
 
Impact workshop glasgow
Impact workshop glasgowImpact workshop glasgow
Impact workshop glasgow
 
110322 Social media för företag
110322 Social media för företag110322 Social media för företag
110322 Social media för företag
 
Projecte Educatiu del Centre
Projecte Educatiu del CentreProjecte Educatiu del Centre
Projecte Educatiu del Centre
 
6 Secrets To A Powerful Life
6 Secrets To A Powerful Life6 Secrets To A Powerful Life
6 Secrets To A Powerful Life
 
Lite färsk omvärldsbevakning
Lite färsk omvärldsbevakningLite färsk omvärldsbevakning
Lite färsk omvärldsbevakning
 
Meet Charlie - What is Enterprise 2.0?
Meet Charlie - What is Enterprise 2.0?Meet Charlie - What is Enterprise 2.0?
Meet Charlie - What is Enterprise 2.0?
 
Comics and the Storytelling Imperative
Comics and the Storytelling ImperativeComics and the Storytelling Imperative
Comics and the Storytelling Imperative
 
Basic Copying
Basic CopyingBasic Copying
Basic Copying
 
Avaliação de métodos de Segmentação mediante algoritmos de Machine Learning
Avaliação de métodos de Segmentação mediante algoritmos de Machine LearningAvaliação de métodos de Segmentação mediante algoritmos de Machine Learning
Avaliação de métodos de Segmentação mediante algoritmos de Machine Learning
 
Networking Now & Personal Branding
Networking Now & Personal BrandingNetworking Now & Personal Branding
Networking Now & Personal Branding
 

Similar to Voyage by example: tips and tricks on persisting object models

Voyage by example
Voyage by exampleVoyage by example
Voyage by exampleESUG
 
Look Again at the ZCA
Look Again at the ZCALook Again at the ZCA
Look Again at the ZCAmikerhodes
 
Introduction To Moose
Introduction To MooseIntroduction To Moose
Introduction To MooseMike Whitaker
 
Thinking Outside The [Sand]Box
Thinking Outside The [Sand]BoxThinking Outside The [Sand]Box
Thinking Outside The [Sand]BoxMichael Genkin
 
Objective-C & iPhone for .NET Developers
Objective-C & iPhone for .NET DevelopersObjective-C & iPhone for .NET Developers
Objective-C & iPhone for .NET DevelopersBen Scheirman
 
Learn JS concepts by implementing jQuery
Learn JS concepts by implementing jQueryLearn JS concepts by implementing jQuery
Learn JS concepts by implementing jQueryWingify Engineering
 
Docker DevTools: Docker as part of your development toolset
Docker DevTools: Docker as part of your development toolsetDocker DevTools: Docker as part of your development toolset
Docker DevTools: Docker as part of your development toolsetWill Hall
 
Perl 5.10
Perl 5.10Perl 5.10
Perl 5.10acme
 
Creating Hybrid mobile apps with YUI
Creating Hybrid mobile apps with YUICreating Hybrid mobile apps with YUI
Creating Hybrid mobile apps with YUIGonzalo Cordero
 
D7 entities fields
D7 entities fieldsD7 entities fields
D7 entities fieldscyberswat
 
Everything is Permitted: Extending Built-ins
Everything is Permitted: Extending Built-insEverything is Permitted: Extending Built-ins
Everything is Permitted: Extending Built-insAndrew Dupont
 
Drupalcon cph
Drupalcon cphDrupalcon cph
Drupalcon cphcyberswat
 
Drupal 8: A story of growing up and getting off the island
Drupal 8: A story of growing up and getting off the islandDrupal 8: A story of growing up and getting off the island
Drupal 8: A story of growing up and getting off the islandAngela Byron
 
GOTO Night with Charles Nutter Slides
GOTO Night with Charles Nutter SlidesGOTO Night with Charles Nutter Slides
GOTO Night with Charles Nutter SlidesAlexandra Masterson
 
Docker experience @inbotapp
Docker experience @inbotappDocker experience @inbotapp
Docker experience @inbotappJilles van Gurp
 
Beyond JVM - YOW! Brisbane 2013
Beyond JVM - YOW! Brisbane 2013Beyond JVM - YOW! Brisbane 2013
Beyond JVM - YOW! Brisbane 2013Charles Nutter
 

Similar to Voyage by example: tips and tricks on persisting object models (20)

Voyage by example
Voyage by exampleVoyage by example
Voyage by example
 
Look Again at the ZCA
Look Again at the ZCALook Again at the ZCA
Look Again at the ZCA
 
Introduction To Moose
Introduction To MooseIntroduction To Moose
Introduction To Moose
 
Thinking Outside The [Sand]Box
Thinking Outside The [Sand]BoxThinking Outside The [Sand]Box
Thinking Outside The [Sand]Box
 
Iphone course 1
Iphone course 1Iphone course 1
Iphone course 1
 
Objective-C & iPhone for .NET Developers
Objective-C & iPhone for .NET DevelopersObjective-C & iPhone for .NET Developers
Objective-C & iPhone for .NET Developers
 
Learn JS concepts by implementing jQuery
Learn JS concepts by implementing jQueryLearn JS concepts by implementing jQuery
Learn JS concepts by implementing jQuery
 
Core_java_ppt.ppt
Core_java_ppt.pptCore_java_ppt.ppt
Core_java_ppt.ppt
 
Docker DevTools: Docker as part of your development toolset
Docker DevTools: Docker as part of your development toolsetDocker DevTools: Docker as part of your development toolset
Docker DevTools: Docker as part of your development toolset
 
JavsScript OOP
JavsScript OOPJavsScript OOP
JavsScript OOP
 
Perl 5.10
Perl 5.10Perl 5.10
Perl 5.10
 
Creating Hybrid mobile apps with YUI
Creating Hybrid mobile apps with YUICreating Hybrid mobile apps with YUI
Creating Hybrid mobile apps with YUI
 
D7 entities fields
D7 entities fieldsD7 entities fields
D7 entities fields
 
Everything is Permitted: Extending Built-ins
Everything is Permitted: Extending Built-insEverything is Permitted: Extending Built-ins
Everything is Permitted: Extending Built-ins
 
Drupalcon cph
Drupalcon cphDrupalcon cph
Drupalcon cph
 
Drupal 8: A story of growing up and getting off the island
Drupal 8: A story of growing up and getting off the islandDrupal 8: A story of growing up and getting off the island
Drupal 8: A story of growing up and getting off the island
 
GOTO Night with Charles Nutter Slides
GOTO Night with Charles Nutter SlidesGOTO Night with Charles Nutter Slides
GOTO Night with Charles Nutter Slides
 
Docker experience @inbotapp
Docker experience @inbotappDocker experience @inbotapp
Docker experience @inbotapp
 
Java for beginners
Java for beginnersJava for beginners
Java for beginners
 
Beyond JVM - YOW! Brisbane 2013
Beyond JVM - YOW! Brisbane 2013Beyond JVM - YOW! Brisbane 2013
Beyond JVM - YOW! Brisbane 2013
 

More from Esteban Lorenzano

More from Esteban Lorenzano (9)

Spec 2.0
Spec 2.0Spec 2.0
Spec 2.0
 
Pharo: A roadmap to solid evolution.
Pharo: A roadmap to solid evolution.Pharo: A roadmap to solid evolution.
Pharo: A roadmap to solid evolution.
 
Voyage - PharoConf 2012
Voyage - PharoConf 2012Voyage - PharoConf 2012
Voyage - PharoConf 2012
 
Reef - ESUG2011
Reef  - ESUG2011Reef  - ESUG2011
Reef - ESUG2011
 
iBizLog - ESUG2010
iBizLog - ESUG2010iBizLog - ESUG2010
iBizLog - ESUG2010
 
Mars - ESUG 2010
Mars - ESUG 2010Mars - ESUG 2010
Mars - ESUG 2010
 
Reef - ESUG 2010
Reef - ESUG 2010Reef - ESUG 2010
Reef - ESUG 2010
 
Cruzando Fronteras - Respuestas revolucionarias a la crisis de las web-applic...
Cruzando Fronteras - Respuestas revolucionarias a la crisis de las web-applic...Cruzando Fronteras - Respuestas revolucionarias a la crisis de las web-applic...
Cruzando Fronteras - Respuestas revolucionarias a la crisis de las web-applic...
 
Seaside, El framework hereje
Seaside, El framework herejeSeaside, El framework hereje
Seaside, El framework hereje
 

Voyage by example: tips and tricks on persisting object models