Giter Club home page Giter Club logo

clj-ddd-example's Introduction

Domain Driven Design (DDD) in Clojure

An example implementation with explanation

An example implementation of Domain Driven Design in Clojure with lots of information about DDD and its concepts and how it's implemented in Clojure along the way.

We're taking the same modeling example as from this blog: http://blog.sapiensworks.com/post/2016/07/14/DDD-Aggregate-Decoded-2 and re-doing it in Clojure. We also add the additional requirements from the follow up blog post: http://blog.sapiensworks.com/post/2016/08/19/DDD-Application-Services-Explained

In a nutshell, we're trying to build a banking application, and we know that it needs to support transferring money from one account to another. We've talked with the business users about how they currently manage their bank and what concepts and rules and actions and relationships they currently seem to make use of to manage their bank.

As part of trying to become a domain expert, we've started to learn about the ubiquitous language that the business users are used too. We know there are Accounts, there's this concept of Debit and Credit, there's special identifiers for referring to Accounts, they have the concept of Transfers that tracks all debits and credits between accounts. And most importantly, users can request for money to be transferred from one account to another.

This is what we thus model in this example banking application, with our only feature for now being able to transfer money between existing accounts.

The code base is structured in classic DDD patterns:

  • Application Service: clj-ddd-example namespace, also the main namespace that can be considered the API to clients, side-effectfull.
  • Domain Model: clj-ddd-example.domain-model namespace, where we define our domain model, pure.
  • Domain Services: clj-ddd-example.domain-services namespace, where we define our domain services, pure.
  • Repository: clj-ddd-example.repository namespace, where we maintain our application state, side-effectful.

Refer to each namespace's doc-string to get a full explanation of each of these concepts, and how it is implemented in Clojure.

clj-ddd-example's People

Contributors

didibus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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