Open1

翻訳: Eager Read Derivation

きょきょ

CQRS

CQRSとは、コマンドクエリ責任分離の略である。私がこのパターンについて初めて聞いたのは、グレッグ・ヤングによる説明だった。CQRSの核心は、情報を更新するモデルと、情報を読み取るモデルで別のモデルを使用するという考え方である。幾らかの状況において、分離を行うことには価値があるが、ほとんどのシステムにおいてはCQRSがリスキーな複雑さを持ち込むことに気をつける必要がある。

CQRS stands for Command Query Responsibility Segregation. It's a pattern that I first heard described by Greg Young. At its heart is the notion that you can use a different model to update information than the model you use to read information. For some situations, this separation can be valuable, but beware that for most systems CQRS adds risky complexity.

情報システムとやり取りを行う場合の一般的なアプローチは、それをCRUDデータストアとして扱うことである。つまり、我々はレコードを作成し、読み取り、更新し、削除するというレコード構造のメンタルモデルを持っているということである。もっとも単純なケースにおいては、システムとのやりとりはこれらのレコードを保存し、取得するのみである。

The mainstream approach people use for interacting with an information system is to treat it as a CRUD datastore. By this I mean that we have mental model of some record structure where we can create new records, read records, update existing records, and delete records when we're done with them. In the simplest case, our interactions are all about storing and retrieving these records.

As our needs become more sophisticated we steadily move away from that model. We may want to look at the information in a different way to the record store, perhaps collapsing multiple records into one, or forming virtual records by combining information for different places. On the update side we may find validation rules that only allow certain combinations of data to be stored, or may even infer data to be stored that's different from that we provide.