Code Monkey home page Code Monkey logo

hexagonalthis's Introduction

hexagonalThis

A simple kata to live-code with Alistair about Hexagonal Architecture

Steps (carpaccio style)

Alistair wants an application that provides poetry.

Steps:

  1. Test-drive the design of our 1st port (i.e. the intention, represented in C# with an interface: IRequestVerses and a first method: GiveMeSomePoetry()).

    • This very first version of the business logic (i.e.: the PoetryReader type) returns an hard-coded result.
    • The left-side adapter is both the unit test framework and the test calling the port
  2. Write another acceptance test with the simplest possible right-side adapter: a stub for the new right-side port: IObtainPoems and its unique GetAPoem() method/verb.

  3. Write another acceptance test to test-drive the usage of a new Console (app) adapter

    • Here, we need to mock the Console.WriteLine calls by introducing a ICanWriteLines strategy. This mock will assert that it has received the proper call after GiveMeSomePoetry is called.
    • Proper time to illustrate the 3 steps initialization of the Hexagonal Architecture (i. Instantiate the "I need to go out" ports and adapters ii. Instantiate the PoetryReader hexagon iii. Instantiate the "I need to go in" ports and adapter)
    • Introduce here an "hexagon" wrapper onto the business logic (to explicit the architectural pattern for the years to come?)
  4. Write a CONSOLE application (embedding the right-side mock) to get end-users feedbacks about the way we will soon ask questions to the system

    • Alistair's feedback (playing the end-user) is that we need to have other poems than the hard-coded one.
  5. Test drive a right-side PoemFileAdapter that will return the content of a file knowing its path (file being: Rimbaud.txt).

The application is now structurally complete (with left and right-side adapters). We can either:

- Add a CycleThroughPoemsAdapter (that will leverage on the Poetry.json file)
- Test drive a __JSON (left-side) adapter and create a Web API project to gather end-users feedbacks
- Replace the PoemFileAdapter and CycleThroughPoemsAdapter with a DatabaseAdapter
- Introduce a new API/Verb for the 1st port: GiveMeLines(int linesCount)

hexagonalthis's People

Contributors

tpierrain avatar

Watchers

James Cloos avatar Guerry Semones 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.