the seneca pattern at engineyard distill 2013 conference

Post on 06-May-2015

2.193 Views

Category:

Technology

4 Downloads

Preview:

Click to see full reader

DESCRIPTION

A discussion of the psychological basis for the Seneca message-passing and micro-service pattern.

TRANSCRIPT

How do You Build Big Apps?

@rjrodgersenecajs.org

Tuesday 13 August 2013

TechnicalDebt

Tuesday 13 August 2013

"A good plan, violently executed now,is better than a perfect plan next week."

Tuesday 13 August 2013

You Must take onTechnical Debtor You Will Die

Tuesday 13 August 2013

Sometimes,it Happens

AnywayTuesday 13 August 2013

Tuesday 13 August 2013

Tuesday 13 August 2013

Tuesday 13 August 2013

NTSC 1941 Standard:

Black+White onlySignal encodes BrightnessEach Channel gets 6Mhz

Happy Days!

Tuesday 13 August 2013

Color TelevisionThree Colors: Red, Green, Blue

Each Color needs 3MhzYou only have 6Mhzand you need 9Mhz!

Technical Debt FTW

Tuesday 13 August 2013

You can't Break theold Black+White TVs

Tuesday 13 August 2013

We must send the old brightness signal

White Light =30% Red

59% Green11% Blue

Send White, Red and Blue

Tuesday 13 August 2013

You need to embed the color signals inside

the brightness signal

Tuesday 13 August 2013

Color TV circuits aremore complicated

than they should be.

Tuesday 13 August 2013

How do you ReduceTechnical Debt?

Tuesday 13 August 2013

Longer and more detailed

Specifications!

Tuesday 13 August 2013

Better LanguagesBetter Mental Models

Tuesday 13 August 2013

How did theRomans do

Long Division?Tuesday 13 August 2013

LXXII MMMDCXIIL rem XII

Tuesday 13 August 2013

How did theRomans doAddition?

Tuesday 13 August 2013

1. Normalize: IV → IIII2. Concatenate: IIII + XI → IIIIXI3. Sort, descending: IIIIXI → XIIIII4. Reduce: XIIIII → XV

IV + XI = ?

Tuesday 13 August 2013

How did theRomans do

Subtraction?Tuesday 13 August 2013

1. Normalize: XXIV → XXIIII2. Eliminate: XXIIII - XV → XIIII - V3. Expand: XIIII - V → VIIIIIIIII - V4. Repeat 2 and 3 until no moves left5. Reduce: IIIIIIIII → IX

XXIV - XV = ?

Tuesday 13 August 2013

How did theRomans do

Multiplication?Tuesday 13 August 2013

III → 3VI → 6 → 110

III × VI = ?

3 × 001 × 0 = 03 × 010 × 1 = 63 × 100 × 1 = 12 18

bit shifting

Tuesday 13 August 2013

How did theRomans doDivision?

Tuesday 13 August 2013

they didn't

Tuesday 13 August 2013

Roman Numerals have

Technical DebtTuesday 13 August 2013

Tuesday 13 August 2013

Positional Number Systems make us

SmarterTuesday 13 August 2013

Mental Modelsfor Code

Tuesday 13 August 2013

ProceduralFunctional

Object-OrientedLogic

Tuesday 13 August 2013

Let's Experiment

Tuesday 13 August 2013

Stand up.Everybody.

Tuesday 13 August 2013

Is this a car?

Tuesday 13 August 2013

YES NOStay standing Sit down

And stay down!

Tuesday 13 August 2013

Tuesday 13 August 2013

Tuesday 13 August 2013

Tuesday 13 August 2013

Tuesday 13 August 2013

Tuesday 13 August 2013

Tuesday 13 August 2013

Objects areRoman Numerals

Tuesday 13 August 2013

Objects break as system complexity

growsTuesday 13 August 2013

The need for design "patterns" is telling

you somethingTuesday 13 August 2013

ProceduralFunctional

Object-OrientedLogic

Tuesday 13 August 2013

Procedural code tends to

SpaghettiTuesday 13 August 2013

ProceduralFunctional

Object-OrientedLogic

Tuesday 13 August 2013

Functional and Logic are

More PowerfulTuesday 13 August 2013

WhatHappened?

Why didn't theyWin?

Tuesday 13 August 2013

Technical Debt

Tuesday 13 August 2013

ProceduralFunctional

Object-OrientedLogic

Tuesday 13 August 2013

What do weNeed?

Tuesday 13 August 2013

A BetterMental Model

Tuesday 13 August 2013

Easy to LearnEasy to Scale (humans)Easy to Scale (machines)Easy to ImplementEasy to build a Mental Model

Does not have to achieveVery Large Scale

Tuesday 13 August 2013

We need Modelsthat Work forHuman Brains

Tuesday 13 August 2013

Why isRuby on Rails

Popular?Tuesday 13 August 2013

Opinionated==

Shared Mental ModelTuesday 13 August 2013

Ruby on RailsModel is an

Accident of HistoryTuesday 13 August 2013

Let's Design aModel!

Tuesday 13 August 2013

What does a Programmer do?

Self-contained AlgorithmsProcedural Business LogicFitting it all Together

Tuesday 13 August 2013

Fitting it all Together is

the Hard PartTuesday 13 August 2013

What are HumansGood At?

Tuesday 13 August 2013

If a card has a vowel on one side, it must have an odd number on the other.

Which cards should you turn over to verify that the rule is followed?

Tuesday 13 August 2013

If you're drinking beer, you must be 21 or over.

Which patrons should you ask for ID?

Tuesday 13 August 2013

You solved the second version using

Pattern MatchingTuesday 13 August 2013

Why is Pattern Matching

Such a Win?Tuesday 13 August 2013

We are Pattern MatchersIt scales for humans and machinesWorks without needing context

Tuesday 13 August 2013

Why do I Care?

Tuesday 13 August 2013

We build Minimum Viable Productsfor startups.It's all about technical debt.

Tuesday 13 August 2013

Lucius Annaeus Seneca

Tuesday 13 August 2013

The Seneca Strategy

Tuesday 13 August 2013

EmbraceMicro-Services

Tuesday 13 August 2013

Lots of Little ProcessesDo one thing, and do it WellCommunicate with Messages

Tuesday 13 August 2013

Pattern Match onMessages

Tuesday 13 August 2013

Messages are Asynchronous Send them any way you likeUse JSON as the data model

Tuesday 13 August 2013

"Send Tweet"Acted on by Tweet Service

Example

{ command:"tweet" author:"@rjrodger" status:"Distill Rocks!"}

Tuesday 13 August 2013

Tweet ServiceIf I see a message with this property:

Match the Pattern!

command:"tweet"

It's Mine!I don't care how you get it to me.

And I'll ignore anything else.

Tuesday 13 August 2013

The Tweet Service can be written in

Any LanguageTuesday 13 August 2013

Keep it SmallDie and restart on Errors

Report your status

Tuesday 13 August 2013

Level Up ThePattern Matching

Tuesday 13 August 2013

Patterns map to Actions

Tuesday 13 August 2013

cmd:drivestart engine, and go!

cmd:drive, type:hoverturn on anti-gravitystart engine and go!

Example

Tuesday 13 August 2013

Two Rules to make this Unique

1. More properties always wins2. Check properties alphabetically

Tuesday 13 August 2013

cmd:drive

cmd:drive,type:hover

Mappingcmd: drivetype: wheelspeed: 50

cmd: drivetype: hoverspeed: 100

Tuesday 13 August 2013

One More Thing

Tuesday 13 August 2013

Layers

Tuesday 13 August 2013

When you add a pattern:If the pattern Already Exists,

Keep the Old Action,so you can use it

inside the New Action

Tuesday 13 August 2013

cmd:drivestart engine, and go!

cmd:drivecall prior actionset speed to speed

Example

Tuesday 13 August 2013

Implementation

senecajs.org

Tuesday 13 August 2013

Let's build stuff!

Tuesday 13 August 2013

Blog Data Layer

Platform-as-a-Service

Tuesday 13 August 2013

the actions are

Blog

cmd:draft, post:contentcmd:publish, post:idcmd:redact, post:idcmd:homepagecmd:comment, post:id, comment:comment

Tuesday 13 August 2013

action, not abstractioneasy to learn

easy to modifyeasy to maintainself-documenting

Win

Tuesday 13 August 2013

the actions are

Data Layer

cmd:save, name:entitycmd:load, name:entitycmd:list, name:entitycmd:remove, name:entity

Tuesday 13 August 2013

save some data

cmd: save, name: product,data: { name: Apple, price: 1.99 }

Tuesday 13 August 2013

load some data

cmd: load, name: product,query: { name:Apple }

Tuesday 13 August 2013

implement the actions

cmd:saveinsert into table name values data

cmd:loadselect * from name where query

Tuesday 13 August 2013

add caching

cmd:savecall prior actionwrite into cache data

cmd:loadread data from cacheif found, return data, else call prior action

Tuesday 13 August 2013

layers

cmd:savecall prior actionwrite into cache data

cmd:loadread data from cacheif found, return data, else call prior action

insert into table name values data

select * from name where query

Tuesday 13 August 2013

more data layers

validationpermissionsthrottling

custom logicmultiple databases

...

Tuesday 13 August 2013

multiple databases

cmd:save, name:sessionsave data to redis

cmd:saveinsert into table name values data

when entity is a session:

all other entities:

Tuesday 13 August 2013

fine-grained controleasy to extend

easy to customizeeasy to debug - there's no magic

Win

Tuesday 13 August 2013

Micro-Services

deployerdispatchercontroller

Platform-as-a-Service

Tuesday 13 August 2013

deployer

controller

dispatcher

app appapp

requestsstartstop

install

route

dashboard

Tuesday 13 August 2013

controller actionsdash:install, app:detailssubmit cmd:install, app:details to message bus (deployer picks up)

dash:start, app:idsubmit cmd:start, app:id to message bus (dispatcher picks up)

dash:stop, app:idsubmit cmd:stop, app:id to message bus (dispatcher picks up)

Tuesday 13 August 2013

deployer actionscmd:install, app:details

download app code to serverget route from app detailssubmit cmd:route, route:path, server:server to message bus (dispatcher picks up)

Tuesday 13 August 2013

dispatcher actionscmd:routeadd route and server to local routing table

cmd:start, app:idstart routing requests to app

cmd:stop, app:idstop routing requests to app

Tuesday 13 August 2013

controller, dispatcher, deployer are all in one app

install apps to localhostfocus on what, not how

Prototype

Tuesday 13 August 2013

controller, dispatcher, deployer are separate processes

communicate via direct HTTPapps live on VMs

but ... no design changes!

Minimum ViableProduct

Tuesday 13 August 2013

controller, dispatcher, deployer are many processes

communicate via a message busapps live anywhere

but ... no design changes!

Scale It

Tuesday 13 August 2013

build now, scale later!easy refactoring

language independenceeasily observe and manage

Win

Tuesday 13 August 2013

How do You Build Big Apps?

Tuesday 13 August 2013

Design for ManyLanguages

Tuesday 13 August 2013

Design forScale

(human + machine)Tuesday 13 August 2013

Design forHuman Brains

Tuesday 13 August 2013

Thank You!@rjrodger

senecajs.org

Tuesday 13 August 2013

top related