Giter Club home page Giter Club logo

dddkata's Introduction

Domain Driven Design Spring Boot Kata - a TODO list to Get Things Done

Presentation

A simple Rest API for a Todo list management, developped with Spring Boot and DDD concepts

Article

Please read https://medium.com/@gsigety/domain-driven-design-spring-boot-kata-1-8a85034babec

Architecture

Maven modules, responsibilities, dependencies

GetThingsDone-domain

The hexagon

  • contains all business logic; validation rules of users inputs ; mandatory information for a Todo, format of fields and so on => it validates invariants of value objects entering into the system
  • contains domain objects. Business concepts and words have their objects in your code (ubiquitous language). Here one domain object which is a Todo
  • transaction boundaries : manage database transactions ; decide whether actions results should be persisted or rollbacked.

dependencies : (almost) nothing. The upper module. Javax.transaction for transactions declaration. See pom.xml.

GetThingsDone-infra

Infrastructure layer

  • contains implementation of means for hexagon to communicate with the outside world
  • here GetThingsDone-infra is responsible of one major topic ; manage persistence of Todos with a persistent storage.

But it could be many others responsibilities ; sending email, SMS, push notification, read configuration info etc.

dependencies : GetThingsDone-domain, and many Spring/boot and persistence libraries stuff

GetThingsDone-app

UI and final runnable artifact

  • contains java main Class : entry point to launch the whole stuff
  • application packaging : an auto-executable jar
  • user interface : user interface is a HTTP Rest/JSON API, but it could be html pages, CLI etc.

dependencies : GetThingsDone-domain, ddd-infra, and many Spring/boot stuff for Rest JSON

Bibliography

Hexagonal architecture :

https://blog.octo.com/en/hexagonal-architecture-three-principles-and-an-implementation-example/

DDD quickly :

https://www.infoq.com/minibooks/domain-driven-design-quickly

Tell, Don't ask :

https://www.martinfowler.com/bliki/TellDontAsk.html

Implementing DDD, Vaughn Vernon

https://www.oreilly.com/library/view/implementing-domain-driven-design/9780133039900/

Usage :

endpoints URL is

http://localhost:8080/todos

Create

curl -X POST \
  http://localhost:8080/todos/ \
  -H 'Content-Type: application/json' \
  -d '{
   "title":"plant a tree",
   "description" : "because green is pleasing",
   "dueDate": 1557847007
}'

list

curl -X GET \
  http://localhost:8080/todos \

... and use PUT, DELETE HTTP verbs to update and delete todos (see source code for details)

dddkata's People

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.