Dismantling the Monorail

Jack Lawson (@ajacksified)

Goals

In the Beginning

A Team Builds An App

Priority #1

Rapid Iteration

Simple Conceptual Model

Fast Feature Development

Single MVC Application

Layers Are Great

That's not sarcasm

It's Easy

for example

rails new catkarma

or

express --sessions --hogan catkarma

then

cd catkarma
git init
git add .
git commit -m 'Intial'
heroku create
git push heroku master

Keep It All In Your Head

Later On

Shifting Priorities

catkarma a riotious success

Time is Your Enemy

Chaos and Entropy

Growing Introduces Complexity

Higher Communication Overhead

Meetings, Standups, & Coordination

Big Problems if Test Suite is Lacking

Upgrading Becomes Hard

Raise your hand if you've ever put off a Rails 3.2 Upgrade

One-offs and Duplicated Code

To Maintain Speed

Take Shortcuts

Simple Conceptual Model?

Not Quite

Complex And Full of Hacks

:(

You May Ask Yourself

How Did I Get Here?

"We Will Rebuild It When We Get Time"

Right? ...soon?

Dismantling the Monorail

Prioritize Efficiency

A Different Conceptual Model

It's Still Simple

Services

Not a Particularly New Idea

You're likely familiar with "the internet", a distributed system

Discrete Systems Lead to Specializing

Specializing Leads To Efficiency

Abstracted Logic Leads To Flexibility

Using the Right Tool for the Job

Best Technology For

Application Logic

User Interface

Persistence

These Are Almost Never the Same Answer

Reusable APIs

Implement Android, iOS, Google Glasses,

Kindles, Game Consoles,

Raspberry Pis, Desktops, Laptops,

e-paper Wristwatches, 3-D Printers,
Chatbots, Console Scripts, public APIs...

With No Special Code

Provided You Use

Common Protocols

Like RESTful JSON

Additional Complexity Opportunity

Partial Failure

Means The Entire Application Isn't Unavailable

Multiple Systems at Once

Highlights Communication Inefficiencies

More Complex Ops

Allows Scaling Specific Services

Shared Assets

Bundle Reusable Libraries

Fast Iterations

Which Is What We Wanted Anyway

Less Overhead

More Efficiently Used Servers and Developer Time

Less Frustration

Stop Digging Through SQL Injected In View Helpers

Getting There

Few People Are Starting from Nothing

Separate Data Structures into Libraries

Define Services

Break Out Existing Services into Modules

Define an Interface, like JSON over REST, and Refactor

Optimize Features Involving Many Services

Define a View in the Middle

Break out Service Modules into Servers

Delete Your Old Monolithic Repository

Monorail Dismantled