Repositoryによる抽象化の理想と現実/Ideal and reality of abstraction by Repository
Kibelaのマルチテンシーを解説します。 #railsdm 2017 の資料です。
DDDでは 集約 = トランザクション境界 でなければならないので、 複数の集約をまたがるデータの永続化処理は結果整合性になる。 なぜ集約をまたいでトランザクションをかけてはいけないのかというと、 集約で「データの一貫性の境界」を表現するため。 なので、集約同士はデータの一貫性を保証しない = 結果整合性 ということになる。 集約がトランザクション境界ではない場合はどうなるのかというと、「データの一貫性の境界」がドメインレイヤで表現できなくなる。 あるときは 集約A, 集約B が一緒のトランザクションで登録され、 あるときは 集約A, 集約B, 集約C が一緒のトランザクションで登録される、というケースがあると、 「データの一貫性の境界」はアプリケーションレイヤのトランザクション開始から終了までのコードで表現されてしまうので、 それぞれの集約がどの粒度で一貫性を保たれるのかが分からなくなる
この記事のモチベーション RDB(Relational DataBase)の歴史は長く、ノウハウも蓄積されている。 関係代数という学問もあるなどアカデミックにも研究されており、 国家資格である「データベーススペシャリスト」も、ほとんどこのRDBのことを扱うなど、 RDBは一定の体系が確立した技術と言える。 一方で、2010年ごろより広まったNoSQL、特にドキュメント指向DBに関しては、 当然ながらRDBに比べると未成熟な段階であろう。 また主観だが、NoSQLは、スケーラビリティといった物理的側面にfocusが当たることが多かったのではと思う。 一方で、論理的側面 = モデリング に関して、および物理的側面と論理的側面のトレードオフの関係について、 議論されつくされているとは言えない。 本稿では、DDD(ドメイン駆動設計)というプログラミングの論理的側面の手法を、 各DBがいかに扱えるか
This browser is no longer supported. Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support. Context In many applications, the business logic accesses data from data stores such as databases, SharePoint lists, or Web services. Directly accessing the data can result in the following: Duplicated code A higher potential for programming errors Weak
Finite-state machine (FSM) is a wonderful model of computation that has many practical applications. One of my favorites is turning business logic into simple FSMs. For example consider the following requirements for an order management system: Orders must not ship before they are paid. Orders can be canceled, but only if they haven’t shipped yet. An order that has already been paid, needs to be r
な、なるほど...!? いや、みんなちょっと誤解してるんじゃないか? よーし、お父さん、みんながSTIを使いたくなるようにちょっと頑張っちゃうぞ! STIとは STIは、単一の継承階層に所属するクラス群を、ただひとつのテーブルを使って永続化する手法です。 PofEAA Railsのドキュメントを漁ると、次のような記述が見つかります。 http://api.rubyonrails.org/classes/ActiveRecord/Inheritance.html Note, all the attributes for all the cases are kept in the same table. Read more: www.martinfowler.com/eaaCatalog/singleTableInheritance.html このリンク先は、リファクタリングで有名なMarti
Software multitenancy is a software architecture in which a single instance of software runs on a server and serves multiple tenants. Systems designed in such manner are "shared" (rather than "dedicated" or "isolated"). A tenant is a group of users who share a common access with specific privileges to the software instance. With a multitenant architecture, a software application is designed to pro
12.1 目的:パフォーマンスを最適化する パフォーマンスの最適化にはインデックスが重要だよね。 インデックスを使おう。 参考:Qiita - MySQL InnoDBのIndex 12.2 アンチパターン:闇雲にインデックスを使用する さあ、インデックスを使ってみよう! しかし、もしもインデックスに対する正しい知識が無いと以下の3パターンにハマりがち。 インデックスを全く使わない。 「インデックス怖い!!オーバーヘッド怖い!!」 インデックスを全テーブルに定義する。 「インデックスがあれば絶対に安心だ(フラグ」 インデックスを適切に定義していても、SQLがクソ。 「無敵のインデックスでなんとかしてくださいよぉ〜〜〜〜!!」 以下、それぞれについて詳しく見て行きましょう。 12.2.1 ケース1:インデックス恐怖症 インデックス恐怖症の患者たちは、何かと「オーバーヘッドが〜オーバーヘッドが
ECパッケージ Magento で使われているEAVモデルについて、自分なりに理解できているか確認の意味も込めてまとめます。 誤りなど気づいた方がいらしたら、是非つっこんでください。 まずよくあるユーザーテーブル ▼customer_table id name birthday address 1 sasakure 1984/12/03 tokyo shibuya 2 tarou 2002/01/22 kanagawa kawasaki これをEAVモデルにすると下記のようになります。 まずはEntity ▼entities_table id 1 2 Entityは「実態」とか「実在」という意味です。 この場合「ユーザ」を表します。 最低でもidだけあればEntityとして充分です。 次にAttribute ▼attributes_table id attributes_name 1 na
The EAV data described above is comparable to the contents of a supermarket sales receipt (which would be reflected in a Sales Line Items table in a database). The receipt lists only details of the items actually purchased, instead of listing every product in the shop that the customer might have purchased but didn't. Like the clinical findings for a given patient, the sales receipt is a compact r
データ・モデル文脈の全貌: データモデルは、格納されるべき情報 の詳細を提供し、その最終プロダクトが、コンピュータ・ソフトウエアの自作または購入の意思決定を支援する、アプリケーションまたは、機能仕様の準備のための、コンピュータのソフトウエア・コードの生成であるとき主に使うものである。図は、ビジネスプロセスモデリングとデータモデルの間の相互作用の例である[1]。 データモデルは、アプリケーション設計のための計画として使うソフトウェア工学の抽象モデルの1つである。班・要員間の意思疎通のための事業データの文書化、組織化、そして特にデータの格納方法や利用方法のために利用される。 Hoberman(2009)によれば、「データモデルは、組織内での意思疎通を改善し、それによってより柔軟で安定したアプリケーション環境に導く、真の情報の部分集合を正確に説明するシンボルとテキストの集合を使う、事業とIT専門
Repository by Edward Hieatt and Rob Mee Mediates between the domain and data mapping layers using a collection-like interface for accessing domain objects. For a full description see P of EAA page 322 A system with a complex domain model often benefits from a layer, such as the one provided by Data Mapper (165), that isolates domain objects from details of the database access code. In such systems
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く