GithubHelp home page GithubHelp logo

anthrax3 / better-code-with-ddd Goto Github PK

View Code? Open in Web Editor NEW

This project forked from asc-lab/better-code-with-ddd

0.0 1.0 0.0 73 KB

This repository contains code that accompanies presentation ASC LAB team gave at meetup about “Creating better code with Domain Driven Design”.

C# 99.87% Dockerfile 0.09% Shell 0.04%

better-code-with-ddd's Introduction

Better code with DDD building blocks

This repository contains code that accompanies presentation ASC LAB team gave at meetup about “Creating better code with Domain Driven Design”.

Link to presentation

Business case

Domain Driven Design tactical patterns are presented here using mortgage loan application processing use case. Business wants to increase efficiency of mortgage loan application processing for individual customers by: automating application score calculation, combining information from online available sources, auto rejecting applications with RED score, having ability to relatively easy add new rules for scoring.

The process:

  • operator submits loan application with property information, customer data, loan information and attached documents provided by customer
  • system performs basic validation, required fields, correct formats
  • operator commands the system to calculates score based on rules
  • if score is RED application is rejected and explanation is provided
  • if score is GREEN then operator validates attached documents and accepts application or rejects it due to discrepancies between provided data and documents. System validates operator’s competence level

The rules:

  • property value must not exceed requested loan amount
  • customer age at the day of last loan installment must not exceed 65 years
  • customer must not be registered debtor in national debtors registry system
  • loan monthly installment must not exceed 15% of customer monthly income

Solutions

Repository contains two solutions. First solution presents typical layered application building approach with anemic model and business logic scattered in services that reside in application layer. This solution also presents usage of generic repository and mixing read and write concerns in the same application service class. First solution is located in the LoanApplication.EnterpriseCake folder.

Second solution presents usage of DDD tactical patterns like: value objects, entities, repositories, factories, domain services and application services to achieve better readability and expressiveness of the code. Applying DDD patterns together with ubiquitous language closes the gap between language spoken by experts and the team and language used in the code. Solution with DDD building blocks applied is located in the LoanApplication.TacticalDdd folder.

DDD Tactical Patterns Based Solution

This solution has two variants. On master branch you can find a version that uses Marten to persist and load domain entities as JSON documents. Read side uses Dapper that executes SQL statements directly against database views. Second variant that lives on ef_cofe branch. This version uses Entity Framework Core to persist and load domain entities. Dapper is still used to handle query side of the application.

DDD solution conatins three projects:

  • LoanApplication.TacticalDdd which contains all the domain logic, application layer which exposes domain logic to the external world, read model which handles queries and adapter that implement infrustructure needed to communicate with databases, message queues and external systems.
  • LoanApplication.TacticalDdd.Tests which contains unit tests for domain model and application layer
  • DebtorRegistryMock which contains mocked version of debtor registry system.

better-code-with-ddd's People

Contributors

wojteksuwala avatar

Watchers

 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.