Almin

Almin

  • Docs
  • API
  • Blog
  • Help
  • GitHub

›Introduction

Introduction

  • Getting Started
  • Components of Almin
  • Principles
  • Hello World

Tutorial

  • Example projects
  • Counter Tutorial
  • Todo App tutorial

Guides

  • Logging
  • Nesting UseCase
  • Performance profile
  • Strict mode
  • UseCase LifeCycle
  • TypeScript

Troubleshooting

  • UseCase is already released

Appendix

  • GLOSSARY

API

  • API Index
  • Context
  • Dispatcher
  • DispatcherPayloadMeta
  • LifeCycleEventHub
  • Store
  • StoreGroup
  • UseCase
  • UseCaseContext
  • UseCaseExecutor
Edit

Principles

This document describes almin's principles:

CQRS

Command and Query Responsibility Segregation(CQRS) is a pattern.

"CQRS is simply the creation of two objects where there was previously only one. The separation occurs based upon whether the methods are a command or a query (the same definition that is used by Meyer in Command and Query Separation: a command is any method that mutates state and a query is any method that returns a value)." -- CQRS, Task Based UIs, Event Sourcing agh! | Greg Young

CQRS separates "one" model to "two" models. CQRS has two models that are Command(Write) model and Query(Read) model.

For example, Flux's store is a "one" model, but it is also Write and Read model.

In Flux

Flux architecture defines Stores role.

Stores contain the application state and logic. -- Stores

It means that Store is a single model, but has two task - state and logic.

  • On Application Layer: Store has application state
  • On Domain Layer: Store has business logic

Flux Layering

Complexity

The Complexity: N × M (multiplication)

Store is both Write stack and Read stack.

  • N: Store does logic and updates State(Write)
  • M: Store returns State for View(Read)

In Almin/CQRS

Almin separates Store's two task to one task. Store has only state role and Almin moves logic to domain model. (Domain model has business logic)

Flux Layering + CQRS

Additionally, Almin introduces domain model for logic role.

  • On Application Layer: Store has application state
  • On Domain Layer: Domain model has business logic

Almin Layering

Complexity

The Complexity: N + M (addition)

Domain model is write stack and Store is read stack.

  • N: Domain model does logic and updates State(Write)
  • M: Store returns State for View(Read)

Almin aims to reduce the complexity at large application.

Quote from Microsoft .NET - Architecting Applications for the Enterprise (2nd Edition) (日本語)

domain vs. cqrs

Related:

  • CQRS
  • CQRS Journey

Unit of work

Almin has a Unit of Work. It is a actual internal class and Almin applies Unit of Work pattern.

  • Unit of Work can stop unintended updating of StoreGroup
  • In other word, The user can control updating of StoreGroup while a series of UseCase is executing

The following figure describes it:

unit of work

← Components of AlminHello World →
Almin
Docs
Getting StartedTutorialAPI Reference
Community
User ShowcaseStack OverflowTwitter
GitHub
GitHubReleasesIssuesStar
Copyright © 2021 azu