Skip to content

fraktalio/fmodel-demos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Functional domain modeling - Examples

The word domain here means the area of interest in the business. When you are developing an information system to automate activities of that business, you’re modeling the business. The abstractions that you design, the behaviors that you implement, and the UI interactions that you build all reflect the business — together they constitute the model of the domain.

f(model)

These examples are demonstrating the usage of the fmodel library.

Library is written in Kotlin programing language by practicing functional style. It is a small library constructed out of generic data types that can be used to effectively model any stateful information system.

It is truly decoupling the pure declaration of our program logic from the runtime. And therefore, the runtime has the chance to see the big picture of our program and decide how to run and optimize it.

Examples

To demonstrate that pure declaration of our program logic is separated from the runtime target and infrastructure, we are going to practice onion architecture / ports and adapters in all examples.

onion architecture image

The arrows in the image are showing the direction of the dependency. Notice that all dependencies point inwards, and that Domain is not depending on anybody or anything.

Restaurant management system

Restaurant management system is:

  • managing restaurant menus and other information including location and opening hours
  • managing the preparation of orders at a restaurant kitchen

restaurant management - event model

We are going to run our unique core domain logic in different ways, by implementing different application and/or persistence layers:

Type Description Technology Scenario Domain Application Adapter
State stored information system Restaurant management Kotlin, Arrow, Reactive Spring Boot, R2DBC combined aggregate scenario - monolith aggregate fmodel domain fmodel application spring
Event-sourced information system Restaurant management Kotlin, Arrow, Reactive Spring Boot, Axon Framework on infra layer, and Axon Server combined aggregate scenario - monolith aggregate fmodel domain fmodel application axon, spring
Event-sourced information system - distributed Restaurant management Kotlin, Arrow, Reactive Spring Boot, Axon Framework on infra layer, and Axon Server distributed aggregate(s) fmodel domain fmodel application axon, spring
Event-sourced information system - distributed Restaurant management Kotlin, Arrow, Reactive Spring Boot, Axon Framework on application layer, and Axon Server distributed aggregate(s) fmodel domain axon axon, spring

References and further reading


Created with ❤️ by Fraktalio