Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
値と属性の話
Search
Akira Suenami
May 12, 2022
350
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
値と属性の話
Akira Suenami
May 12, 2022
Transcript
13 slides
値と属性 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
ご清聴ありがとうございました。
More Decks by Akira Suenami
See All by Akira Suenami
設計手法を「道具」として使いこなすために
a_suenami
4
910
可変性を制する設計: 構造と振る舞いから考える概念モデリングとその実装
a_suenami
9
2.8k
オブジェクト指向考古学 〜人類は再びDCIの夢を見るか〜
a_suenami
5
3.7k
トランザクションスクリプトはどこから来たのか トランザクションスクリプトは何者か トランザクションスクリプトはどこへ行くのか #sekkeinight
a_suenami
14
7.2k
ドメインモデラーにとって受託開発であることは制約なのか?
a_suenami
1
1.6k
異なるモデリングパラダイムから見るモデリングの勘所 #ooc_2020
a_suenami
2
3.5k
マルチパラダイムモデリング 〜異なるモデリングパラダイムから見るモデリングの勘所〜 #PHPerKaigi
a_suenami
0
4.1k
“ユーザーファースト”の功罪 〜分析と実験によるアーキテクチャ設計〜 #bpstudy
a_suenami
4
1.6k
ドメインモデルのつくり方 #5000dai
a_suenami
16
5.1k
Featured
See All Featured
Documentation Writing (for coders)
carmenintech
77
5.6k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
2
990
Ruling the World: When Life Gets Gamed
codingconduct
0
440
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
580
Reality Check: Gamification 10 Years Later
codingconduct
0
2.4k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Technical Leadership for Architectural Decision Making
baasie
4
650
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.8k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.9k
The agentic SEO stack - context over prompts
schlessera
0
1k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
380
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.2k