The Template

A template is a simple and yet potent tool. The simple idea is to pass data type as a parameter, so we don’t need to write the same code for different data types. For example, a software company may need sort() for different data types. Rather than writing and maintaining the multiple codes, we can write one sort() and pass data type (String or Number) as a parameter.

Usually, a software company1 needs more than just a simple sort(). It requires a template for modeling the flow of information in any business.

The Flow

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 flow

To illustrate the flow better, we can use event modeling.

event modeling

The ‘FModel library’2 is offering implementation of this flow in a very general way. The flow 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). Check out the concrete example here.

This is a foundation for all software we write to support our own business. It started as inspiration and evolved in the software library we share with you for your benefit. The idea is straightforward, and it can be implemented in almost any modern programming language which possesses a type system. Check out the TypeScript version of the library here.

Specification by example

Specification by example is a collaborative approach to defining requirements, which you should be focusing on. These specifications will just run within our abstract and general flow, guaranteeing the correctness of the program. Essentially, you need both generalization and specialization to design an information system effectively.

The Event Modeling exercise result is a blueprint of the overall solution, describing the system and how it changes over time.

event modeling blueprint

By pivoting the blueprint by 90 degrees, you would practice specification by example to collaborate on the scenarios in more detail.

specification by example

By following this approach, you will be able to postpone important design decisions. This is a sign of good and cost-effective architecture.

In the following blog posts, we are going to discuss these decisions in more detail.

  1. you are a Software Company! 

  2. FModel can be used as a library, or as an inspiration, or both. It provides just enough tactical Domain-Driven Design patterns, optimised for Event Sourcing and CQRS. 

© 2023 fraktalio d.o.o.