vertical vs horizontal software architecture ruby conf india 2016

Post on 16-Jan-2017

589 Views

Category:

Engineering

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Vertical vs HorizontalSoftware Architecture

Christian HujerCEO / CTO Nelkinda Software Craft Pvt Ltd.

At RubyConf India 2016

1@christianhujer @nelkinda #RubyConfIndia #Ruby 1

Horizontal Software Architecture

Directory structure reflects framework aspects� app/┣━� controllers/┣━� helpers/┣━� models/┣━� services/┗━� views/

2@christianhujer @nelkinda #RubyConfIndia #Ruby 2

Why it’s called “horizontal”?

Because the predominant architecture represents (mostly) “horizontal” layers:

3@christianhujer @nelkinda #RubyConfIndia #Ruby 3

views

helperscontrollers

services

models

Horizontal Architecture Synonyms

Horizontal ArchitectureLayered Architecturen-Tier ArchitectureMultitier ArchitectureTechnical Architecture

4@christianhujer @nelkinda #RubyConfIndia #Ruby 4

Bad Horizontal - Fundamentals

● Cohesion● Coupling● Design Smells, Immobility● Communicating Intent● CCP - Common Closure Principle

5@christianhujer @nelkinda #RubyConfIndia #Ruby 5

Cohesion

Things that change together are cohesive.

Examples:● A model, its view and and its controller.

6@christianhujer @nelkinda #RubyConfIndia #Ruby 6

Collocation

Things which are “next” / “close” to each other.Examples:● Files in the same directory● Classes in the same package

7@christianhujer @nelkinda #RubyConfIndia #Ruby 7

The 4 Design Smells (Uncle Bob)

Design smells are the odors of rotting software.

● Rigidity● Fragility● Immobility● Viscosity

8@christianhujer @nelkinda #RubyConfIndia #Ruby 8

Immobility = Inability to Reuse

Reusable =● Independently deployable● Independently developable● Independently testable● Scalable (i.e. carving out microservices)

⇒ It’s important even if you don’t reuse!9@christianhujer @nelkinda #RubyConfIndia #Ruby 9

Oh, this is an MVC web application(Surprise, surprise!)

vs

Oh, this is an event registration system.

Software Architecture

10@christianhujer @nelkinda #RubyConfIndia #Ruby 10

Communicate Intent!

Like every software entity,the architecture shouldcommunicate its intent,not its implementation!

11@christianhujer @nelkinda #RubyConfIndia #Ruby 11

CCP: Cohesion Collocation Principle

Cohesive things should be collocated!

Put things that change together in the same place!

13@christianhujer @nelkinda #RubyConfIndia #Ruby 13

Vertical Software Architecture

Directory structure reflects business aspects� app/┣━� attendee/┣━� event/┣━� organizer/┣━� payment/┗━� subscription/

14@christianhujer @nelkinda #RubyConfIndia #Ruby 14

Vertical Software Architecture

Directory structure reflects business aspects� app/┣━� booking/┣━� cleaning/┣━� guest/┣━� payment/┗━� room/

15@christianhujer @nelkinda #RubyConfIndia #Ruby 15

Let’s talk business!

16@christianhujer @nelkinda #RubyConfIndia #Ruby 16

This talks Business!

� app/┣━� car/┣━� driver/┣━� insurance/┣━� rental/┗━� repair/

17@christianhujer @nelkinda #RubyConfIndia #Ruby 17

This doesn’t talk Business!

� app/┣━� controllers/┣━� helpers/┣━� models/┣━� services/┗━� views/

18@christianhujer @nelkinda #RubyConfIndia #Ruby 18

MVC is a pattern!Pattern ≠ Architecture

19@christianhujer @nelkinda #RubyConfIndia #Ruby 19

Architecture /Directory Structure

Should ReflectThe Business Model

20@christianhujer @nelkinda #RubyConfIndia #Ruby 20

MVC isn’t badBut…

it shouldn’t dominate you

21@christianhujer @nelkinda #RubyConfIndia #Ruby 21

Vertical Software Architecture

22@christianhujer @nelkinda #RubyConfIndia #Ruby 22

car driver insurance rental repair

Thank you!Follow me on Twitter

@christianhujer

23@christianhujer @nelkinda #RubyConfIndia #Ruby 23

top related