Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
値と属性の話
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Akira Suenami
May 12, 2022
320
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
値と属性の話
Akira Suenami
May 12, 2022
More Decks by Akira Suenami
See All by Akira Suenami
可変性を制する設計: 構造と振る舞いから考える概念モデリングとその実装
a_suenami
9
2.6k
オブジェクト指向考古学 〜人類は再びDCIの夢を見るか〜
a_suenami
5
3.5k
トランザクションスクリプトはどこから来たのか トランザクションスクリプトは何者か トランザクションスクリプトはどこへ行くのか #sekkeinight
a_suenami
14
7k
ドメインモデラーにとって受託開発であることは制約なのか?
a_suenami
1
1.6k
異なるモデリングパラダイムから見るモデリングの勘所 #ooc_2020
a_suenami
2
3.4k
マルチパラダイムモデリング 〜異なるモデリングパラダイムから見るモデリングの勘所〜 #PHPerKaigi
a_suenami
0
4k
“ユーザーファースト”の功罪 〜分析と実験によるアーキテクチャ設計〜 #bpstudy
a_suenami
4
1.5k
ドメインモデルのつくり方 #5000dai
a_suenami
16
5k
ビジネスの構造を扱うアーキテクチャとユーザとの接点を扱うアーキテクチャ #builderscon
a_suenami
46
12k
Featured
See All Featured
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
530
Context Engineering - Making Every Token Count
addyosmani
9
940
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.5k
Are puppies a ranking factor?
jonoalderson
1
3.5k
How to build a perfect <img>
jonoalderson
1
5.6k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.5k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
150
Color Theory Basics | Prateek | Gurzu
gurzu
0
350
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.3k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
sira's awesome portfolio website redesign presentation
elsirapls
0
270
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
160
Transcript
値と属性 2022/05/12 第1回なんでもわちゃわちゃLT会 末並 晃 @a_suenami
自己紹介 • 末並 晃 @a_suenami • 生息している界隈: DDDとか、TDDとか、RDBとか • お仕事で使ってる技術スタック:
Rails, React, Java ◦ 最近は terraform おじさんです • 好きな RDBMS: PostgreSQL • 好きな制約: チェック制約 • 好きな焼肉の部位: ハラミ • 好きな(ry
インターネット上での立場
インターネット上での立場 ひたすら焼肉をタカられるという エンターテイメントをインターネットに提供し ています。 (焼肉を奢るとは言ってない)
今日話すこと • 「みんな、何でも値オブジェクトって言いすぎじゃない?」 • 値オブジェクトとは何か • 属性とは区別しようねという話 • アランケイとリッチヒッキーの議論は興味深い
None
値オブジェクト enum Currency { JPY, USD } class Money {
private Currency currency; private int amount; Money(final Currency currency, final int amount) { this.currency = currency; this.amount = amount; } Currency getCurrency() { return this.currency; } int getAmount() { return this.amount; } Money add(Money another) { if (this.currency != another.getCurrency()) { throw new IllegalArgumentException("通貨が異なります"); } return new Money(this.currency, this.amount + another.getAmount()); } }
値オブジェクト? class ProductUnitPrice { private Currency currency; private int amount;
ProductUnitPrice(final Currency currency, final int amount) { this.currency = currency; this.amount = amount; } Currency getCurrency() { return this.currency; } int getAmount() { return this.amount; } }
どうせこうなる ProductUnitPrice productUnitPrice = new ProductUnitPrice(Currency.JPY, 100); int quantity =
10; int totalPrice = productUnitPrice.getAmount() * quantity;
値と属性 識別子(ID) 値 属性
アランケイとリッチヒッキー
アランケイとリッチヒッキー https://news.ycombinator.com/item?id=11945722
ご清聴ありがとうございました。