• Stars
    star
    304
  • Rank 137,274 (Top 3 %)
  • Language
    C#
  • Created almost 5 years ago
  • Updated 12 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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

Check out our article on Altkom Software & Consulting blog.

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.

Domain model

Domain model is pretty simple. There are two aggregates LoanApplication and Operator. LoanApplication represenst, as you can guess, a loan application submitted for processsing. LoadApplication is composed of several value objects, which in turn are also composed from other value object. Operator represents a bank employee responsible for processing loan application.

Domain model - aggregates Domain mode - aggregates

The core functionality of our service is loan application evaluation. Each rule is implemented as a separate class that implements IScoringRule interface. A domain service is created to encapsulate rules and score calculation.

Domain model - rules Domain mode - business rules

Application services are clients of domain model. We have three application services one that is responsible for loan application submission, second that evaluates applications and third one that lets users accept or reject application. Diagram below presents dependencies between one sample application service and domain model parts. It also presents dependency between infrastructure layer and domain model, where infrastructure layer provides implementations for interfaces defined as part of the domain model (for example for repositories).

Application services interaction with the domain model Application services interaction with the domain model

More Repositories

1

dotnetcore-microservices-poc

Very simplified insurance sales system made in a microservices architecture using .NET Core
CSS
1,893
star
2

micronaut-microservices-poc

Very simplified insurance sales system made in a microservices architecture using Micronaut
Java
487
star
3

java-cqrs-intro

Examples of implementation CQRS with Event Sourcing - evolutionary approach
Java
200
star
4

dotnet-cqrs-intro

Examples of implementation CQRS with Event Sourcing - evolutionary approach
C#
140
star
5

camunda-dotnetcore-poc

Proof of Concept project that shows how we can use Camunda BPMN Platform in .NET Core applications.
C#
67
star
6

azure-functions-billing

Azure Functions v2 with .NET Core - billing in serverless architecture.
C#
61
star
7

claim-reporter-pwa-poc

Example PWA application with Angular 6 and backend with Node
TypeScript
38
star
8

aws-lambda-billing

AWS Lambda with Micronaut and without any framework - billing in serverless architecture.
Kotlin
31
star
9

micronaut-spring-performance-tests

Micronaut vs Spring - build time, startup time, heap size, used heap size comparision and Gatling load tests.
Java
19
star
10

blockchain-multichain

Application for proposals using blockchain with MultiChain.
Java
19
star
11

ddd-aggregates-example

This is example of modelling DDD aggregates based on PPPDDD book.
Java
18
star
12

ngx-formly-playground

Project with list of Angular Formly exercises. Every next exercise add new feature to the previous one.
TypeScript
17
star
13

personal-insurance-flutter-poc

Flutter project example covering concerns commonly encountered in business apps.
Dart
16
star
14

city-information-bot

Chatbot that can answer the question: "What time is it and what is the weather like in Chicago (or any other city)"?
TypeScript
9
star
15

web-components-poc

Web Components Demos/Examples with Angular/Vue.
TypeScript
7
star
16

microsoft-bot-framework-poc

Our experiments with a Microsoft Bot Framework and LUIS cognitive service.
JavaScript
6
star
17

medical-claims-ddd-example

Java
5
star
18

mlpclassifier-notebook

[ASC Meetup #2] Przykład użycia sieci neuronowych do klasyfikowania branży towaru w procesie kredytu ratalnego
Jupyter Notebook
5
star
19

camunda-modeler-plugin-documentation-generator

This plugin facilitates to generate process diagram docx documentation for Camunda 8 BPMN diagrams.
TypeScript
3
star
20

xamarin-insurance-sales-client

Simple insurance sales mobile client made in a Xamarin.Forms
C#
3
star
21

ddd-workshop-tpa

C#
3
star
22

dotnetcore-graphql-demo

Demo project showing how to quickly build GraphQL API with HotChocolate and Entity Framework
C#
2
star
23

angular-semantic-rwd-menu

RWD Menu with Angular and Semantic UI
TypeScript
2
star
24

coffee-society-accrual

Kotlin
1
star