typesafe nosql @ topconf 2012

Post on 28-Nov-2014

102 Views

Category:

Software

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

TypeSafe NoSQL @ TopConf 2012

TRANSCRIPT

Maciek Próchniak

Algebraic topologyhocolim

Group cohomology

Monads

GWTTouK

CamelOSGi

CQRS

Scala

Typesafe

Steve Yegge - Google

Software engineering has its own political axis, ranging from conservative to liberal

Scala (...): Hardcore conservative.

NoSQL - liberal

Typesafe NoSQL?

Supplier

Typesafe OrientDB

Why OrientDB?

ScalabilityDocument

JSON

Super-Fast Schema-less

Sharding

Graph RB+Tree Indexes

Why OrientDB?

notSoNoSQLJava

Consistency

Partition toleranceAvailability

P - do you really need it?

Data model

Supplier

Details Email

Supplier

Trucks

memory/local/remote

Native Java API

JDBC Driver!

SQL - examples

select from suppliers

select from suppliers where name = 'Henry'

select trucks[0] from suppliers

SQL - examples

select from suppliers where details.status = 'Important'

select from suppliers where trucks[capacity = 5].size() > 3

select from suppliers where trucks contains (capacity = 2)

Typesafe queries for NoSQL

SQL with compile time checking?

● i(my)Batis

● Hibernate

● Hades

SQL with compile time checking?

● QueryDSL

● jOOQ

● OneWebSQL

Goal

.Net

LINQ makes a query a first-class language construct in C# and Visual Basic.

var results = from c in Suppliers where c.size < 10 select new {c.name, c.address};

JVM?

... makes a query a first-class language construct in Java

... makes a query a first-class language construct in Scala

Typesafe queries for OrientDB using

Slick

Scala can do better!

Scala

Language

Intergration

Connectivity

Kit

Architecture

Query Compiler

Lifted embedding Direct embedding

MySQLPostgreSQL

SQLServer OrientDB

WebService?

Lifted embedding

Lifted embedding - meta

Lifted embedding - meta

Lifted embedding - meta

Lifted embedding - query

Lifted embedding - query

Can we do better?

Scala 2.10 - macros

● Compile time metaprogramming

● Transformations of AST

● Great for DSL and like

Macros in Slick

Macro expansion

.filter(s => s.name == "Henry")

"filter", Supplier, Function( List("s"), Apply( Select("s", "name"), "==",

List(Literal(Constant("Henry")))))

Translation to Query AST

"filter", Supplier, Function( List("s"), Apply( Select("s", "name"), "==",

List(Literal(Constant("Henry")))))

Slick Query AST

Direct embedding - meta

Direct embedding - query

Direct embedding - query

Type safety?

Composability?

Additional functions?

● CONTAINS operator

● Relations

● In-memory implementation

Impact: testability

Unit

Functional

Integration

H2/??

Mock

DevBase

Impact: testability

Unit

Functional

Integration

memory:

memory-slick

local:/remote:

Impact: design

DBLogicDAO

findByNamefindByClientAndName

findByCompany...

Impact: design

DBLogicDAO

query

Typesafe queries for NoSQL

are possiblewith

Slick & OrientDB

Call for action

● OrientDB - help crossing the chasm

● Slick - better direct embedding?

● slick-orientDB - everything ;)

Tänan :)

top related