Datamapper

1,046 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,046
On SlideShare
0
From Embeds
0
Number of Embeds
13
Actions
Shares
0
Downloads
13
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Datamapper

  1. 1. DataMapper == ActiveRecord 3.0? <ul><li>Miksi? (vrt. ActiveRecord) </li></ul><ul><ul><li>Enemmän Rubyä, vähemmän SQL:ää </li></ul></ul><ul><ul><li>AR: Migraatio/malli -ongelmat </li></ul></ul><ul><ul><ul><li>DataMapper: malli ohjaa tietokantaa eikä toisinpäin </li></ul></ul></ul><ul><ul><li>Intuitiivinen olioidentiteetti </li></ul></ul><ul><ul><ul><li>entity.children.all? {|c| c.parent == entity} # => true </li></ul></ul></ul><ul><ul><li>Fiksumpi SQL-generointi: Lazy loading + Smart Associations </li></ul></ul><ul><ul><ul><li>tekstikentät luetaan oletuksena vain tarvittaessa, assosioitujen tietojen lukeminen </li></ul></ul></ul>
  2. 2. Esimerkki <ul><li>class Employee include DataMapper::Resource property :id, Integer, :serial => true property :name, String # i can has ruby semantics! property :role, String, :accessor => :private property :description, Text, :lazy => false property :deleted_at, ParanoidDateTime belongs_to :company has n, :projects end </li></ul>
  3. 3. Muuta <ul><li>Taulujen luominen </li></ul><ul><ul><li>DataMapper#auto_migrate! # checkout & deploy? </li></ul></ul><ul><li>Suorituskyky </li></ul><ul><li>ks. http://work.rowanhick.com/2008/02/19/rails-vs-merb-activerecorddatamapper/ Rails: 42.16 req/s (baseline) # 770 testiriviä Merb + ActiveRecord: 57.80 req/s (1.37x) Merb + Datamapper: 72.98 req/s (1.73x) Rails: 22.82 req/s (baseline) # 11050 testiriviä Merb + ActiveRecord: 29.85 req/s (1.30x) Merb + Datamapper: 33.91 req/s (1.48x) </li></ul>
  4. 4. Mutta ihan oikeasti... <ul><li>=> Jarkon vuoro :*) </li></ul>

×