Your Database
IS NOT YOUR
APPLICATION

Hubert Łępicki

Code Europe, 2016

About me

  • Ruby
  • JavaScript
  • Elixir
  • @hubertlepicki

NEW HIRE

NEW PROJECT

DATABASE DESIGN

I don't care

we've been told to do so

it's the default

ORM

Active Record

User Model

Registration form

Context matters

Conditional validations

Unreadable

INSECURE

object oriented design

DRY

Inheritance

Polymorphism

Nope

False hope

unmet promises

STI

TUPLES

polymorphic associations

Loosing Advantage

We have a leak

Single Responsibility anyone?

Transactions

BUSINESS LOGIC

Object-relational impedance mismatch

Vietnam of computer science

Solution?

NoSQL

You still need RDBMS

(most likely)

immature

Partial

put ORM on a diet

class User < ActiveRecord::Base
  has_many :reports
  belongs_to :organization

  def self.active
    where(active: true)
  end
end

move your code

Take control of your objects

It's just data

Functional Programming

web has changed

Batch processing

interactive programming

Rich User interfaces

LOAD data

complex tasks

Server-side stayed the same

Stateful UI

Stateless back-end

unnecessary work

Tools

stateless is expensive

more reads/writes

MORE CONFLICTS

UI PERFORMANCE

NEED TOOLS

more parallel

more control over state

ready to use abstractions

long-living objects

Stateful back-end

own your business logic

USE RDBMS for what it is good for

BONUS

DDD

Aggregates

GenServer

application-layer transactions

Scalability

Future is stateful

Thank you!

Made with Slides.com