• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Scala dsls-dissecting-and-implementing-rogue
 

Scala dsls-dissecting-and-implementing-rogue

on

  • 546 views

Just a few simple slides for a presentation at Kraków's Scala User Group. The rest of the session is live coding where we reimplement a tiny subset of Rogue, Foursquares MongoDB DSL.

Just a few simple slides for a presentation at Kraków's Scala User Group. The rest of the session is live coding where we reimplement a tiny subset of Rogue, Foursquares MongoDB DSL.

Statistics

Views

Total Views
546
Views on SlideShare
546
Embed Views
0

Actions

Likes
0
Downloads
5
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Scala dsls-dissecting-and-implementing-rogue Scala dsls-dissecting-and-implementing-rogue Presentation Transcript

    • Scala DSLs Dissecting Rogue Konrad Malawski / @ktosopl GDG / PJUG / KSUG / SCKRK ScalaCamp 23.01.2012Wednesday, December 26, 12
    • Wednesday, December 26, 12
    • Querying MongoWednesday, December 26, 12
    • Querying MongoWednesday, December 26, 12
    • Querying MongoWednesday, December 26, 12
    • Querying Mongo QL = Plain JSONWednesday, December 26, 12
    • Querying Mongo QL = Plain JSON JavaScript ConsoleWednesday, December 26, 12
    • Querying Mongo QL = Plain JSON JavaScript Console Java DriverWednesday, December 26, 12
    • Querying Mongo QL = Plain JSON JavaScript Console Java Driver Casbah = Scala DriverWednesday, December 26, 12
    • Querying Mongo QL = Plain JSON JavaScript Console Java Driver Casbah = Scala Driver ... used by RogueWednesday, December 26, 12
    • Querying Mongo: JS Console APIWednesday, December 26, 12
    • Querying Mongo: JS db.inventory.find( {} )Wednesday, December 26, 12
    • Querying Mongo: JS db.inventory.find( {} ) “find all”Wednesday, December 26, 12
    • Querying Mongo: JS db.inventory.find( { qty: { $gt: 20 } } )Wednesday, December 26, 12
    • Querying Mongo: JS db.inventory.find( { qty: { $gt: 20 } } ) gt means >=Wednesday, December 26, 12
    • Querying Mongo: JS db.pople.find( { age: { $gte: 20 }, $or: [ { name: “Ken” }, { name: “Kenshiro” }, { city: “Tokyo” }, ... ] } )Wednesday, December 26, 12
    • Querying Mongo: JS db.pople.find( { age: { $gte: 20 }, $or: [ { name: “Ken” }, $or may contain any clause { name: “Kenshiro” }, { city: “Tokyo” }, ... ] } )Wednesday, December 26, 12
    • Querying Mongo: Java Java API (Morhpia)Wednesday, December 26, 12
    • Querying Mongo: Java ds.find(Employee.class).field("manager").equal(null).get();Wednesday, December 26, 12
    • Querying Mongo: Java ds.find(Employee.class).field("manager").equal(null).get(); You call this typesafe!?Wednesday, December 26, 12
    • Mongo with RogueWednesday, December 26, 12
    • Rogue in Action import com.foursquare.rogue.Rogue._Wednesday, December 26, 12
    • Rogue in Action Person where(_.age gte 18) limit(100) fetch()Wednesday, December 26, 12
    • Rogue in Action Code Completion Code Completion Person where(_.age gte 18) limit(100) fetch() Code Completion Code CompletionWednesday, December 26, 12
    • Rogue in Action Person where(_.age gte “Bazinga”) limit(100) fetch()Wednesday, December 26, 12
    • Rogue in Action Person where(_.age gte “Bazinga”) limit(100) fetch() Won’t compile - age is IntFieldWednesday, December 26, 12
    • Rogue in Action Person where(_.age gte 18) limit(100) fetch()Wednesday, December 26, 12
    • Rogue in Action Person where(_.age gte 18) limit(100) fetch() LimitWednesday, December 26, 12
    • Rogue in Action Person where(_.age gte 18) limit(100) foreach { p => println(”Name: ” + p.firstName) }Wednesday, December 26, 12
    • Rogue in Action gte means >= Person where(_.age gte 18) limit(100) foreach { p => println(”Name: ” + p.firstName) }Wednesday, December 26, 12
    • Rogue in Action Person or( _.where(_.name eqs "Ken"), _.where(_.name eqs "ken") _.whereOpt(Option("Kenshiro")(_.name eqs _)) ) get()Wednesday, December 26, 12
    • Rogue in Action eqs means Equals Person or( _.where(_.name eqs "Ken"), _.where(_.name eqs "ken") _.whereOpt(Option("Kenshiro")(_.name eqs _)) ) get()Wednesday, December 26, 12
    • Rogue in Action eqs means Equals Person or( _.where(_.name eqs "Ken"), _.where(_.name eqs "ken") _.whereOpt(Option("Kenshiro")(_.name eqs _)) ) get() Get me one Person.Wednesday, December 26, 12
    • Rogue in Action eqs means Equals Person or( _.where(_.name eqs "Ken"), _.where(_.name eqs "ken") _.whereOpt(Option("Kenshiro")(_.name eqs _)) ) get() Issue #69: fix in my pull req Get me one Person.Wednesday, December 26, 12
    • Live HackingWednesday, December 26, 12
    • Live HackingWednesday, December 26, 12
    • Live HackingWednesday, December 26, 12
    • Live Hacking Advanced Stuff.Wednesday, December 26, 12
    • Live Hacking Advanced Stuff. Fast.Wednesday, December 26, 12
    • Live Hacking Advanced Stuff. Fast. Ask Questions!Wednesday, December 26, 12
    • Wednesday, December 26, 12
    • def links = • Scala Lang http://www.scala-lang.org/ • Scala Koans http://www.scalakoans.org • Blog.Project13.pl - http://www.blog.project13.pl •MongoDB ref - docs.mongodb.org/manual/reference/operators/ • Foursquare Rogue - https://github.com/foursquare/rogue • Java Morphia - http://code.google.com/p/morphia/ • Kraków Scala UG - http://krakowscala.pl / http://scalacamp.plWednesday, December 26, 12
    • def links = • Scala Lang http://www.scala-lang.org/ • Scala Koans http://www.scalakoans.org • Blog.Project13.pl - http://www.blog.project13.pl •MongoDB ref - docs.mongodb.org/manual/reference/operators/ • Foursquare Rogue - https://github.com/foursquare/rogue • Java Morphia - http://code.google.com/p/morphia/ • Kraków Scala UG - http://krakowscala.pl / http://scalacamp.pl Mailing lists rock!Wednesday, December 26, 12
    • Thanks! Dziękuję! ありがとう! Konrad Malawski / @ktosopl GDG / PJUG / KSUG / SCKRK ScalaCamp 23.01.2012Wednesday, December 26, 12
    • Thanks! Dziękuję! ありがとう! I love feedback! <3 Konrad Malawski / @ktosopl GDG / PJUG / KSUG / SCKRK ScalaCamp 23.01.2012Wednesday, December 26, 12