Domain Modeling


by example

FModel - Kotlin   |   FModel - TypeScript   |   FModel - Java   |   FModel - Rust

Domain modeling is the process of creating a model or representation of a specific domain or subject area. This model is typically used to represent the key concepts and relationships within the domain, and to facilitate communication and understanding among stakeholders.

One of the key benefits of domain modeling is that it helps to clarify and refine the understanding of a domain. By creating a model, stakeholders are able to identify any gaps or ambiguities in their understanding of the domain, and work to resolve them. This can be especially useful in complex domains where there may be many different stakeholders with different perspectives and priorities.

Another benefit of domain modeling is that it can help to identify opportunities for optimization or improvement within the domain. By understanding the relationships and dependencies between different concepts, stakeholders can identify areas where changes or improvements may have a significant impact.

There are a few key considerations to keep in mind when creating a domain model. First, it's important to ensure that the model accurately reflects the domain and the relationships between the concepts within it. This may require research and consultation with domain experts.

Second, it's important to ensure that the model is intuitive and easy to understand for stakeholders. This may require the use of clear and concise language, as well as the use of visual elements such as diagrams to aid comprehension.

Finally, it's important to ensure that the model is flexible and able to adapt to change. As the understanding of the domain evolves over time, the model should be updated to reflect this.

Event modeling

There are numerous techniques to discover a domain. Event Storming is a particularly interesting one. It is a workshop format for quickly exploring business domains, engaging both Domain Experts and Software Developers.

Event modeling adopts Event Storming sticky notes. The final piece was the UI/UX aspects to complete what more resembles a movie story board (white board - or digital white board). While Event Storming focuses in discovering the problem space, Event Modeling creates a blueprint for a solution.

flow

It is a scenario-based and UX-driven approach to defining requirements, and there is nothing abstract or general in this discovery process. It is a specification by example.

Domain Model = Event Model + Software Model

Our clear and transparent approach, refined over time, tackles challenges in ways others haven't even considered. This process produces measurable outcomes that drive business success and forms the backbone of our consultancy engagements, guiding teams from discovery to deployment.

Example 1: Financial Accounting

Accounting is absolutely essential to the financial domain. It serves as the backbone of financial management, providing crucial insights into the financial health of individuals, businesses, and organizations. Without accounting, it would be nearly impossible to track income, expenses, assets, and liabilities accurately. It plays a pivotal role in decision-making processes, financial reporting, compliance with regulations, and overall strategic planning.

The language of business transactions around the world is Debit/Credit.

accounting

Two-phase transfer is a perfect primitive for atomic transfers across different systems (first put in a Pending state and then either Accepted or Rejected), where accounts may enforce net balance limits, such as debits may not exceed credits, or credits may not exceed debits.

accounting fmodel

We delve into the tactical design and its translation into source code. We observe that the accounting domain model is composed of an `account` and a `transfer`, orchestrated by an `accounting` saga. Commands labeled in red are private and not exposed directly to users.

accounting fmodel

100% accurate historical record

With event sourcing, we delve deeper by capturing every decision or alteration as an event. Each new transfer or modification to the account state is meticulously documented, providing a comprehensive audit trail of all financial activities. This affords you a 100% accurate historical record of your financial domain, enabling you to effortlessly traverse back in time and review the state of all accounts at any given moment.

Example 2: Order Management

Order management refers to the process of receiving, tracking, and fulfilling customer orders efficiently and accurately. It's a critical component of any business that sells products or services. The order management system (OMS) is the software or platform that facilitates these tasks.

order management

Here's an overview of the key aspects of the order management domain/system:

  • Order Entry: The process begins when a customer places an order, either through an online store, over the phone, via email, or through other channels. The OMS captures all relevant information about the order, including the items ordered, quantities, pricing, shipping address, and payment details.
  • Order Processing: Once an order is received, the OMS processes it according to predefined business rules. This may involve verifying inventory availability, checking pricing and discounts, applying promotions or coupons, calculating taxes and shipping charges, and confirming payment authorization.
  • Inventory Management: The OMS maintains real-time visibility into inventory levels across warehouses, distribution centers, and stores. It updates inventory quantities as orders are received and fulfilled, helping to prevent stockouts and overstock situations.
  • Order Fulfillment: After processing, the OMS orchestrates the fulfillment of the order. This may involve tasks such as picking items from inventory, packing them into shipping containers, generating shipping labels, and coordinating with carriers for delivery.
  • Shipping and Logistics: The OMS interfaces with shipping carriers and logistics providers to facilitate the transportation of orders from the distribution center to the customer's doorstep. It generates tracking information that allows customers to monitor the status of their shipments in real-time.
  • Order Tracking and Status Updates: Throughout the order lifecycle, the OMS provides visibility into the status of orders for both customers and internal stakeholders. This includes order confirmation emails, shipment notifications, and updates on any delays or issues that may arise.
blueprint

Demos

Explore many demos on our Github Repositories.

Software Model / FModel

On a higher level of abstraction, any information system is responsible for handling the intent (Command) and, based on the current State, produce new facts/decisions (Events). The system’s new State is then evolved out of these Events. You repeat these steps.

the template

The ‘FModel library’ is offering implementation of this template in a very general way. The template is parametrized with C, E, and S parameters. The responsibility of the business is to specialize in their case by specifying concrete Commands, Events, and State. For example, Commands=CreateOrder, AddItemToOrder; Events=OrderCreated, ItemAdded, State=Order(with list of Items).

The output of the event modeling process (a blueprint) can be simply translated into a software components/model by using FModel libraries as a template.

The goal is to use productivity-oriented programming language features to accelerate development of compositional, safe and ergonomic applications.

Kotlin


flow

Learn

TypeScript


flow

Github

Rust


flow

Github

Platform = Domain Model + Infrastructure

Empower your operations with a tailored platform that excels in executing, running, and orchestrating applications, while seamlessly integrating your domain models. Whether you need to run your models as Postgres extensions, at the edge, or in a serverless environment, our flexible options have you covered. Achieve more with less effort and lead the way in automating your information flow and business processes.

Let's Get In Touch!


Ready to start your next project with us? That's great!


© 2024 fraktalio.com | All Rights Reserved