Slide 1

Slide 1 text

Hexagonal Architecture Jose Armesto

Slide 2

Slide 2 text

Who am I? fiunchinho [email protected]

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

The Web

Slide 6

Slide 6 text

2

Slide 7

Slide 7 text

Programming Duplication Dependencies management

Slide 8

Slide 8 text

At the beginning

Slide 9

Slide 9 text

Connected model

Slide 10

Slide 10 text

Composition

Slide 11

Slide 11 text

Connected model

Slide 12

Slide 12 text

Object Oriented Design

Slide 13

Slide 13 text

Why do we need OOP? Better communication Modeling Separation of concerns Dependency management Extensibility

Slide 14

Slide 14 text

OOP mechanisms Message Passing Encapsulation Abstraction

Slide 15

Slide 15 text

Encapsulation

Slide 16

Slide 16 text

Encapsulation Put behaviour where data is Exposes what it does, hides how it does it

Slide 17

Slide 17 text

Abstraction

Slide 18

Slide 18 text

Abstraction Having no reference to material objects or specific examples; not concrete. Not applied or practical; theoretical - WordReference

Slide 19

Slide 19 text

Abstraction [1] http://www.artima.com/lejava/articles/designprinciplesP.html Program to an interface, not an implementation - Erich Gamma

Slide 20

Slide 20 text

Abstraction Coupled code Changes in ClassA, make changes in ClassB

Slide 21

Slide 21 text

Abstraction

Slide 22

Slide 22 text

Maintainable code is this enough?

Slide 23

Slide 23 text

Architecture

Slide 24

Slide 24 text

Architecture Controller View Model

Slide 25

Slide 25 text

Model - View - Controller

Slide 26

Slide 26 text

Separation of concerns

Slide 27

Slide 27 text

Tools

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

Tools

Slide 30

Slide 30 text

Coupled to Frameworks

Slide 31

Slide 31 text

Persistence

Slide 32

Slide 32 text

Data centric application

Slide 33

Slide 33 text

Decoupled business logic Domain Database

Slide 34

Slide 34 text

Decoupled business logic Domain Framework

Slide 35

Slide 35 text

Decoupled business logic Domain Tools

Slide 36

Slide 36 text

Separate your domain

Slide 37

Slide 37 text

Business logic Validations Calculations Calls to other systems Domain

Slide 38

Slide 38 text

Business logic "Classes representing your domain must be understandable by anyone, even though they are not familiar with your framework or database of choice" - Jose Armesto

Slide 39

Slide 39 text

The web is a detail "The Web is a delivery mechanism [...] Your system architecture should be as ignorant as possible about how it is to be delivered. You should be able to deliver it as a console app, or a web app, or even a web service app, without undue complication or change to the fundamental architecture" - Robert Martin

Slide 40

Slide 40 text

Business logic

Slide 41

Slide 41 text

Delivery Mechanism Request Response Delivery (CLI) Delivery (Web) Response Request

Slide 42

Slide 42 text

Ports and Adapters

Slide 43

Slide 43 text

Architecture

Slide 44

Slide 44 text

Entities User Message Photo

Slide 45

Slide 45 text

Architecture

Slide 46

Slide 46 text

Use cases

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

Architecture

Slide 49

Slide 49 text

Adapters

Slide 50

Slide 50 text

Let's try!

Slide 51

Slide 51 text

Use cases Use cases reminded me of something else…

Slide 52

Slide 52 text

Use Stories As a User I want to log in to the system So I can use it

Slide 53

Slide 53 text

No content

Slide 54

Slide 54 text

Behavior Driven Development

Slide 55

Slide 55 text

Behavior Driven Development

Slide 56

Slide 56 text

Summary Independent of framework Expose the intent of your app Agnostic of tools Acceptance tests of your use cases

Slide 57

Slide 57 text

Summary

Slide 58

Slide 58 text

Resources http://confreaks.com/videos/759-rubymidwest2011-keynote- architecture-the-lost-years http://blog.8thlight.com/uncle-bob/2012/08/13/the-clean-architecture. html http://alistair.cockburn.us/Hexagonal+architecture

Slide 59

Slide 59 text

Jose Armesto @fiunchinho

Slide 60

Slide 60 text

Pictures http://www.unex.es/conoce-la-uex/estructura- academica/centros/epcc/archivos/imagenes/twitterbirdblueonwhite.png http://upload.wikimedia.org/wikipedia/de/5/57/Gmail-logo.jpg http://www.reactionface.info/sites/default/files/imagecache/Node_Page/images/28405225.jpg http://thisboyisonfire.files.wordpress.com/2013/06/cable-mess.jpg http://cdn.cpcstrategy.com/blog/wp-content/uploads/2012/07/ingredients.jpg http://www.threeriversinstitute.org/blog/wp-content/uploads/2009/08/connectedAndModularDesign.jpg http://www.seoconsult.com/blog-images/wp-content/uploads/2011/10/oop.jpg http://www.fasebonus.net/old/images/stories/2012/02/joystick%20cx-40.jpg http://www.mifondodepantallagratis.net/artistic/wallpapers/dali-elephants.jpg http://farm3.staticflickr.com/2678/4238610357_b746809d94_o.jpg http://farm3.staticflickr.com/2678/4238610357_b746809d94_o.jpg http://www.htmlgoodies.com/img/2010/11/mvc.png http://substack.net/images/separation_of_concerns.png http://manualburquerque.files.wordpress.com/2012/04/titiritero.jpg http://dmuela.com/blog/wp-content/uploads/2013/07/symfony-logo.png http://www.maltblue.com/wp-content/uploads/2012/12/ZF2-Logo.png http://www.antoniopol.es/wp-content/uploads/2013/04/laravel.jpg http://thesestonewalls.com/wp-content/uploads/2012/11/Hal.png http://blog.yannickmahe.com/symfony/2013/08/19/the-walking-dead.html http://us.123rf.com/400wm/400/400/antonbrand/antonbrand1204/antonbrand120400030/13295825-verde- lindo-zombies-de-dibujos-animados-aislado-en-blanco.jpg

Slide 61

Slide 61 text

Pictures http://cdn4.pedroventura.com/wp-content/uploads/2013/05/mysql_logo.png http://www.recipesforlinux.com/wp-content/uploads/2013/06/logo-mongodb-onwhite.png http://redis.io/images/redis-300dpi.png http://confreaks.com/videos/759-rubymidwest2011-keynote-architecture-the-lost-years http://addins.waow.com/blogs/weather/wp-content/uploads/2011/07/gold-panning.jpg http://www.clker.com/cliparts/7/2/a/6/11949889842140432868gold_coins_in_a_stack_jo_01.svg.med.png http://i.istockimg.com/file_thumbview_approve/3411362/2/stock-illustration-3411362-cartoon-professor- with-bushy-moustache.jpg http://www.codingthearchitecture.com/2011/11/06/the_delivery_mechanism_is_an_annoying_detail.html http://blog.mattwynne.net/wp-content/uploads/2012/06/hexagonal_architecture_sketch.jpg http://blog.8thlight.com/uncle-bob/2012/08/13/the-clean-architecture.html http://www.mformommy.com/wp-content/uploads/2012/06/expectation.jpg http://s7d5.scene7.com/is/image/Staples/s0356787_sc7?$splssku$ http://fc04.deviantart.net/fs71/f/2011/282/0/5/adventure_time_render_by_emoneygraphix-d4cbh8q.png http://yellower.se/wp-content/uploads/2011/12/note_post_it_desktop_2115x1871_wallpaper-80493.jpg http://nvartscouncil.com/wp-content/uploads/2013/04/thanks.jpg