Sustainable Architecture

Topalov Alex 2017

@sharkzp

Who am I

Who am I

Wot r u talkin bout

It's not about perfect plane

And not about flying chair

Not even about microservices

It's about all of that

Idea

Idea

How often you hear a phrase:

We are starting this project today and expecting to shut it down in 3 weeks

People want to solve a problem

Complexity

Dependencies

(internal and external)

Dependencies

Dependencies

Dependencies

One of the hardest things in software architecture is to draw a line in business logic

Dependencies

Dependencies

Dependencies

You get simplicity by finding slightly more sophisticated building block

Alan Kay

DDD

Database Driven Development

When transaction completed transfer 10% of it amount from payee balance to payer balance

Business

Example 1:

We need to track type of transactions, assuming all with positive balance are 'loan' with negative are 'credit'

Business

Users should be able to name uploaded images

 Business

Example 2:

I really want to enter full description of this mysterious painting.

 User

Datastore(s) just store artifacts of a business process

Separate Persistence from a Business logic

Users should be able to see their statistic when they view analytics

Business

Example 3:

oh BTW, we also need it in CSV and XML format

Business

We also want to send this to our Marketing partners.

Business

Segregate interfaces from a Business logic

Simple != Easy

How

Ideal

Usual

Fat Controller, thin Model

Thin Controller, fat Model

Thin Controller, thin Model, Service Objects in between

High Cohesion

Low Coupling

 Dependencies Direction

Business Contexts

Metcalfe's law

Solutions

LOC < 5000

  1. Goliath
  2. Plain ruby file
  3. eventmachine
  4. Rake app

5000 < LOC < 15000

  • Sinatra
  • Grape

15000 < LOC < 35000

  • Rails
  • Hanami

LOC > 35000

  • It's not a Rails anymore
  • But maybe still a Hanami
  • Trailblazer
  • DRY.rb

No-one has more context about your application than you are

Gems are dependecies

vs

The only conditional that you should have is what object to use

The End

Topalov Alex 2017

@sharkzp

Sustainable Architecture

By Alex Topalov

Sustainable Architecture

  • 1,330