Giter Club home page Giter Club logo

hexagonal's Introduction

Hexagonal architecture (Ports and Adapters)

Go Coverage Status

The application is based from a Go article. Changed the app with some refactorings, and to make each component easier to understand.

alt text

Topics:

  1. Summary
    1. What is a port?
    2. What is an adapter?
  2. Setup
  3. Stack
  4. References

Summary

The Ports & Adapters Architecture (aka Hexagonal Architecture) was thought of by Alistair Cockburn and written down on his blog in 2005. This is how he defines its goal in one sentence:

Allows an application to equally be driven by users, programs, automated test or batch scripts, and to be developed and tested in isolation from its eventual run-time devices and databases.

The main idea in this architecture is to separate the concerns, each component has a well-defined purpose. Focus on the core business and the external services will plug and play with the application through ports and adapters.

P.S. The hexagonal architecture is agnostic of the programming language.

Ports

A port is a consumer agnostic entry and exit point to/from the core business. In many languages, it will be an interface. For example, it can be an interface to perform searches in a search engine.

Adapters

Adapters can be external services that wants to communicate with the application business logic.

Example 1: An input adapter could be a web interface. When a user clicks a button, the web adapter calls a certain input port to communicate with the core.

Example 2: An output adapter adapters are called by our core business, for instance, persisting data into a database.

Setup

Run the app:

go build hexagonal/cmd/serve

Test:

go test hexagonal/tests

Stack

References

  1. Alistair Cockburn
  2. Spring with Hexagonal
  3. Go article
  4. FullCycle
  5. Go By example

hexagonal's People

Contributors

jemesson 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.