Giter VIP home page Giter VIP logo

primary-ports-kata's Introduction

Wifi 1: Conferencias / ConferenciaS-2011

Wifi 2: PamplonaCatedral / 24092009

Primary ports kata

  • This kata is not about implementing an hexagonal architecture
  • There is an architecture already in place
  • This kata is about having a first-hand experience of the benefits and trade-offs of the architecture

Concepts

Reading list

Deliberate practice exercises

Add a new feature: division

  • Hint: don't forget about writing tests!
  • Check: there's no need to change the delivery. New features are automatically delivered though the web and console adapters

Add validation: division by zero is not allowed

  • Hint: the adapters should adapt the error accordingly e.g web responds with a 4xx status code
  • Check: By using the outside-in mindset, tests don't need to know the specifics about the validation implementation and they can focus exclusively on its visible effects.

Change the web route pattern from vertical/feature to vertical-feature

  • Check: changing all the web urls only requires changing one line of code

Free exploration ideas

Here are some ideas to try by yourself:

  • Implement authentication inside your hexagon
  • Log the request history with a secondary port e.g. RequestLogRepository
  • Change the primary port so that you can avoid exposing particular features in your adapters
  • Segregate requests into queries and commands
    • Do you see any relation between Ports and Adapters and CQRS?
    • Once you've done that, can you think of new delivery strategies you can follow?

Discussion

Ports and Adapters: features and architecture are decoupled so:

  • I can develop features without having to be aware of the architecture, and viceversa
  • I can test features without worrying about how they're delivered

Compare these options:

  • Classic layered architecture
  • Ports and Adapters with one adapter for each feature
  • Ports and Adapters with one primary port for all features

About dependencies:

primary-ports-kata's People

Contributors

ggalmazor avatar luisartola avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.