Vertical vs horizontal software architecture ruby conf india 2016

23
Vertical vs Horizontal Software Architecture Christian Hujer CEO / CTO Nelkinda Software Craft Pvt Ltd. At RubyConf India 2016 1 @christianhujer @nelkinda #RubyConfIndia #Ruby 1

Transcript of Vertical vs horizontal software architecture ruby conf india 2016

Page 1: Vertical vs horizontal software architecture ruby conf india 2016

Vertical vs HorizontalSoftware Architecture

Christian HujerCEO / CTO Nelkinda Software Craft Pvt Ltd.

At RubyConf India 2016

1@christianhujer @nelkinda #RubyConfIndia #Ruby 1

Page 2: Vertical vs horizontal software architecture ruby conf india 2016

Horizontal Software Architecture

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

2@christianhujer @nelkinda #RubyConfIndia #Ruby 2

Page 3: Vertical vs horizontal software architecture ruby conf india 2016

Why it’s called “horizontal”?

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

3@christianhujer @nelkinda #RubyConfIndia #Ruby 3

views

helperscontrollers

services

models

Page 4: Vertical vs horizontal software architecture ruby conf india 2016

Horizontal Architecture Synonyms

Horizontal ArchitectureLayered Architecturen-Tier ArchitectureMultitier ArchitectureTechnical Architecture

4@christianhujer @nelkinda #RubyConfIndia #Ruby 4

Page 5: Vertical vs horizontal software architecture ruby conf india 2016

Bad Horizontal - Fundamentals

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

5@christianhujer @nelkinda #RubyConfIndia #Ruby 5

Page 6: Vertical vs horizontal software architecture ruby conf india 2016

Cohesion

Things that change together are cohesive.

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

6@christianhujer @nelkinda #RubyConfIndia #Ruby 6

Page 7: Vertical vs horizontal software architecture ruby conf india 2016

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

Page 8: Vertical vs horizontal software architecture ruby conf india 2016

The 4 Design Smells (Uncle Bob)

Design smells are the odors of rotting software.

● Rigidity● Fragility● Immobility● Viscosity

8@christianhujer @nelkinda #RubyConfIndia #Ruby 8

Page 9: Vertical vs horizontal software architecture ruby conf india 2016

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

Page 10: Vertical vs horizontal software architecture ruby conf india 2016

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

Page 11: Vertical vs horizontal software architecture ruby conf india 2016

Communicate Intent!

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

11@christianhujer @nelkinda #RubyConfIndia #Ruby 11

Page 13: Vertical vs horizontal software architecture ruby conf india 2016

CCP: Cohesion Collocation Principle

Cohesive things should be collocated!

Put things that change together in the same place!

13@christianhujer @nelkinda #RubyConfIndia #Ruby 13

Page 14: Vertical vs horizontal software architecture ruby conf india 2016

Vertical Software Architecture

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

14@christianhujer @nelkinda #RubyConfIndia #Ruby 14

Page 15: Vertical vs horizontal software architecture ruby conf india 2016

Vertical Software Architecture

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

15@christianhujer @nelkinda #RubyConfIndia #Ruby 15

Page 16: Vertical vs horizontal software architecture ruby conf india 2016

Let’s talk business!

16@christianhujer @nelkinda #RubyConfIndia #Ruby 16

Page 17: Vertical vs horizontal software architecture ruby conf india 2016

This talks Business!

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

17@christianhujer @nelkinda #RubyConfIndia #Ruby 17

Page 18: Vertical vs horizontal software architecture ruby conf india 2016

This doesn’t talk Business!

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

18@christianhujer @nelkinda #RubyConfIndia #Ruby 18

Page 19: Vertical vs horizontal software architecture ruby conf india 2016

MVC is a pattern!Pattern ≠ Architecture

19@christianhujer @nelkinda #RubyConfIndia #Ruby 19

Page 20: Vertical vs horizontal software architecture ruby conf india 2016

Architecture /Directory Structure

Should ReflectThe Business Model

20@christianhujer @nelkinda #RubyConfIndia #Ruby 20

Page 21: Vertical vs horizontal software architecture ruby conf india 2016

MVC isn’t badBut…

it shouldn’t dominate you

21@christianhujer @nelkinda #RubyConfIndia #Ruby 21

Page 22: Vertical vs horizontal software architecture ruby conf india 2016

Vertical Software Architecture

22@christianhujer @nelkinda #RubyConfIndia #Ruby 22

car driver insurance rental repair

Page 23: Vertical vs horizontal software architecture ruby conf india 2016

Thank you!Follow me on Twitter

@christianhujer

23@christianhujer @nelkinda #RubyConfIndia #Ruby 23