maglev-a different way to develop with ruby

37
agile software development & services Maglev RubyConf Argentina 2012 Hernán Wilkinson Twitter: @HernanWilkinson Blog: objectmodels.blogspot.com www.10pines.com

Upload: hernan-wilkinson

Post on 14-Jun-2015

768 views

Category:

Technology


0 download

DESCRIPTION

These are the slides of the Maglev presentation I gave at @RubyConfAr 2012 The code of the example is in github

TRANSCRIPT

Page 1: Maglev-A different way to develop with Ruby

agile software development & services

MaglevRubyConf Argentina 2012

Hernán WilkinsonTwitter: @HernanWilkinson

Blog: objectmodels.blogspot.comwww.10pines.com

Page 2: Maglev-A different way to develop with Ruby
Page 3: Maglev-A different way to develop with Ruby

What is the presentation about

Page 4: Maglev-A different way to develop with Ruby

Common WebApp Architecture

Page 5: Maglev-A different way to develop with Ruby

Common WebApp Architecture

Page 6: Maglev-A different way to develop with Ruby

Issues

Code vs. DataObject vs. Data

Page 7: Maglev-A different way to develop with Ruby

Issues

Paradigm Mismatch(Need a translator)

Page 8: Maglev-A different way to develop with Ruby

Issues

Design Errors

• Forced by the ORM• Thinking in tables not in objects• Difficult to create test objects – Mock

abuse!• etc

Page 9: Maglev-A different way to develop with Ruby

Issues

More time to run!

• Tests run slow!• Starting can take minutes due to

ActiveRecord!

Page 10: Maglev-A different way to develop with Ruby

Therefore…

More “Human” TimeBigger Development Cost

Page 11: Maglev-A different way to develop with Ruby

Imagine…

Page 12: Maglev-A different way to develop with Ruby

Imagine…

Page 13: Maglev-A different way to develop with Ruby
Page 14: Maglev-A different way to develop with Ruby

Maglev

A…– Transactional– Automatically persisted– Multi-VM – NO RAM restricted

… Object Server

Page 15: Maglev-A different way to develop with Ruby

Maglev

• Two Modes:– Transient mode (normal ruby)– Persistent mode – The really interesting one!• Objects are naturally persistent• On Commit, saves transitive closure from a root

object• Transactional memory! (no deadlocks)

Page 16: Maglev-A different way to develop with Ruby

Example!

• Investment Accounts – Balance:

• 10 pesos + 5 dollars• 3000 bodens2012 + 600 futureDollarJan2013

• Portfolios– Account composite

• Multiple Web Interface– Sinatra (simple )– Rails

• Using TDD!

Page 17: Maglev-A different way to develop with Ruby
Page 18: Maglev-A different way to develop with Ruby
Page 19: Maglev-A different way to develop with Ruby

Goals

1. No Object-To-RDB Mapping– No Portfolio < ActiveRecord– No id

2. No SQL SELECT…3. No save! or update!4. Separation of concern – No transactional code mixed with model code

5. No Model to Web Framework coupling6. Only Objects!7. Development using TDD

Page 20: Maglev-A different way to develop with Ruby

Fulfilling Goals…

• No Object-To-RDB Mapping– No Portfolio < ActiveRecord– No id

• No SQL SELECT

Page 21: Maglev-A different way to develop with Ruby

Account Hierarchy

Page 22: Maglev-A different way to develop with Ruby

AccountTransaction Hierarchy

Page 23: Maglev-A different way to develop with Ruby

Measure Hierarchy

Page 24: Maglev-A different way to develop with Ruby

Fulfilling Goals…

• No Model to Web Framework coupling

Page 25: Maglev-A different way to develop with Ruby

PortfolioSystem and PortfolioSinatraApplication

Page 26: Maglev-A different way to develop with Ruby

Fulfilling Goals…

• No save! or update!• Separation of concern – No transactional code mixed with model

code

Page 27: Maglev-A different way to develop with Ruby

Showing the home page

Page 28: Maglev-A different way to develop with Ruby

Adding an Account

Page 29: Maglev-A different way to develop with Ruby

FREEDOM!!!

Page 30: Maglev-A different way to develop with Ruby

Conclusions

• Just Objects!• No ORM! No SQL! No ActiveRecord! • Tests run fast• Developed really fast• No need for mocks! – Bye bye FactoryGirl!• We did not have to worry about– Persistence– Transaccionability– Solved in one place

Page 31: Maglev-A different way to develop with Ruby

Conclusions

SimplerEasier

Cheaper…

Happier

Page 32: Maglev-A different way to develop with Ruby

Maglev

• Install with: rvm install maglev• Ruby 1.8.7• Rails: – No scaffolding when using just objects– Need to write generators

• Heroku??• Licence– Ruby code open source– VM is not open source

Page 33: Maglev-A different way to develop with Ruby

Futurology

Relational Databases will fall in less than 10 years

Page 34: Maglev-A different way to develop with Ruby

• Diseño Avanzado de Softaware con Objetos I: 29 de Octubre

• Metaprogramación con Lenguajes de Objetos: 13 de Noviembre

• TDD: 19 de Noviembre

• Diseño Avanzado de Softaware con Objetos II: 4 de Diciembre

(50% de descuento si vinieron a esta conferencia!)http://www.10pines.com/content/cursos-disponibles

Page 35: Maglev-A different way to develop with Ruby

Smalltalks 2012

Page 36: Maglev-A different way to develop with Ruby

Questions?

Page 37: Maglev-A different way to develop with Ruby

agile software development & services

Muchas gracias!

[email protected]

twitter: @10Pines

Argentina

Tel.: +54 (11) 6091-3125Alem 693, 5BBuenos Aires