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
DDD-4layers
Search
nozawa
December 22, 2024
Programming
2
15
DDD-4layers
ジャンケンアドカレを読んでDDD×4層に入門したので、
ありがちな悪いアーキテクチャと比較しながら理解をアウトプットしました。
nozawa
December 22, 2024
Tweet
Share
More Decks by nozawa
See All by nozawa
IoC-DI-DIContainer
yuunozawa
0
5
cool-URI-dont-change
yuunozawa
2
6
about-script-language
yuunozawa
2
5
ansible-demo
yuunozawa
2
9
ansible-learning
yuunozawa
2
3
event-loop
yuunozawa
2
3
AWS-cloud-practitioner
yuunozawa
2
3
Other Decks in Programming
See All in Programming
return文におけるstd::moveについて
onihusube
1
1.3k
Monixと常駐プログラムの勘どころ / Scalaわいわい勉強会 #4
stoneream
0
300
Compose UIテストを使った統合テスト
hiroaki404
0
110
GitHubで育つ コラボレーション文化 : ニフティでのインナーソース挑戦事例 - 2024-12-16 GitHub Universe 2024 Recap in ZOZO
niftycorp
PRO
0
260
暇に任せてProxmoxコンソール 作ってみました
karugamo
2
740
ブラウザ単体でmp4書き出すまで - muddy-web - 2024-12
yue4u
3
500
Findy Team+ Awardを受賞したかった!ベストプラクティス応募内容をふりかえり、開発生産性向上もふりかえる / Findy Team Plus Award BestPractice and DPE Retrospective 2024
honyanya
0
110
LLM Supervised Fine-tuningの理論と実践
datanalyticslabo
7
1.5k
これでLambdaが不要に?!Step FunctionsのJSONata対応について
iwatatomoya
2
3.8k
アクターシステムに頼らずEvent Sourcingする方法について
j5ik2o
4
380
MCP with Cloudflare Workers
yusukebe
2
230
KubeCon + CloudNativeCon NA 2024 Overviewat Kubernetes Meetup Tokyo #68 / amsy810_k8sjp68
masayaaoyama
0
270
Featured
See All Featured
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Testing 201, or: Great Expectations
jmmastey
41
7.1k
RailsConf 2023
tenderlove
29
940
Facilitating Awesome Meetings
lara
50
6.1k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.4k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Designing Experiences People Love
moore
138
23k
Reflections from 52 weeks, 52 projects
jeffersonlam
347
20k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Transcript
ᖒ %%%✖ͷৼΓฦΓ ษڧձ༻
%%%✖ͷৼΓฦΓ wֶशͷ͖͔͚ͬ Ϟνϕʔγϣϯ wͳͥ%%%✖ΛબͿͷ͔ w࣮ફͯ͠Έͯͷॴײ
͖͔͚ͬ ݁ɿδϟϯέϯΞυΧϨΛಡΈɺͩΒ͚ͳΞʔΩςΫνϟͷվળʹ׆͔ͤΔͱࢥͬͨ IUUQTRJJUBDPNBEWFOUDBMFOEBSKBOLFO
ҙࣝᶃΞʔΩςΫνϟ w 4QSJOHGSBNFXPSL .7$ τϥϯβΫγϣϯεΫϦϓτ w ϨΠϠʔ͕શ͔͘Βͳ͍ Αͬͯɺґଘͷ͖͕ཧ͞Εͳ͍
w ೝෛՙ͕ߴ͍ ΞʔΩςΫνϟ͕͋ΔΑ͏Ͱͳ͍ͨΊ࡞ΓΛ ΔͨΊʹ࣮Λ͏͔͠ͳ͍ ͖͔͚ͬ TSDNBJOKBWB cDPOUSPMMFS cFOUJUZ cTFSWJDF cGPSN cSFQPTJUPSZ cNPEFM cFYDFQUJPO cʜ TSDNBJOXFC cQBHFTը໘ cʜ
ҙࣝᶄ4FSWJDF w υϝΠϯ͕ࣝ݁ू͍ͯ͠Δ ӬଓԽͷ੍ɺϧʔϧ͜͜ w ࠷Մಡੑ͕͍ ಛʹ%50ͷॲཧͪΐͬͱͨ͠6*ͷؔ৺͝ͱͰ ͳͷʹΫϥεͷେΛΊ͍ͯͨΓ͢Δ w ෳࡶੑͱͬͱઓ͑Δͱײ͡Δ
͖͔͚ͬ !4FSWJDF QVCMJDDMBTT4FSWJDF\ !"VUPXJSFE QSJWBUF0UIFS4FSWJDFPUIFS4FSWJDF !"VUPXJSFE QSJWBUF3FQPTJUPSZSFQPTJUPSZ QVCMJD'PSNTFU'PSN%BUF 'PSNGPSN \ GPSNTFU.PEFM SFQPTJUPSZHFU%BUB#Z*E GPSNHFU*E ݸผͰ6*߹ͷͭΊͭΊ GPSNTFU*UFN SFUVSOGPSN ^ QVCMJD'PSNJOTFSU 'PSNGPSN \ JOTFSU༻ͷFOUJUZ ʹͭΊͭΊ .PEFMNPEFMOFX.PEFM JEͷ࠾൪͜͜Ͱ͢Δ NPEFMTFU*E SFQPTJUPSZHFU/FYU*E ^ ^
ҙࣝᶅ&OUJUZ .PEFM w ςʔϒϧσʔλήʔτΣΠ 3%#ͷςʔϒϧͱରɻ&OUJUZग़ྗ͘Μతͳ&YDFMϚ Ϋϩ͕͋ͬͨΓ͢Δ w +0*/ͷଟ͍ෳࡶͳΫΤϦ.PEFMΛ ͏ ςʔϒϧσʔλήʔτΣΠͷฐͩͱࢥ͏ɻ001త
Ͱͳ͘ઃܭΛݟ͑ʹ͘͘͢ΔݪҼͩͱݸਓతʹࢥͬ ͍ͯΔ w &OUJUZͱ.PEFM͕ͨ͘͞Μ͋Δ ςʔϒϧ ΧϥϜͷ6*දࣔͷͨΊʹ&OUJUZΛܧঝͯ͠ ࠩͷΧϥϜͨ͠.PEFM͕࡞ΒΕ͍ͯΔ͜ͱ͕ཧ ༝ͩͱࢥ͍ͬͯΔ ͖͔͚ͬ !&OUJUZ QVCMJDDMBTTB5CMJNQMFNFOUT4FSJBMJ[BCMF\ !*E !$PMVNO OBNFlJEz QSJWBUFMPOHJE ҎԼɺશϑΟʔϧυʹର͢Δ4FUUFS (FUUFS QVCMJDMPOHHFU*E \ SFUVSOJE ^ QVCMJDWPJETFU*E MPOHJE \ UIJTJEJE ^ ^
ҙࣝᶆ3FQPTJUPSZ w ΦϨΦϨ+%#$ϥούʔ w σʔλࢦΦϒδΣΫτࢦ &OUJUZର3FQPTJUPSZ w υϝΠϯ͕ࣝ࿙Εग़͍ͯΔ VQEBUFʓʓͰݸผΞοϓσʔτͨ͠Γෳࡶͳ༷ Λෳࡶͳ42-Ͱؤுͬͯղܾ͢ΔͳͲ
w SFQPTJUPSZ ӬଓԽͷӅṭ Ͱͳ͍ Α͏ͳ 42-ϑΝΠϧΛಡΜͰ͍Δ͠Լखͨ͠Β42-Λ ॻ͍͍ͯΔɻ%"0ύλʔϯ ͖͔͚ͬ !3FQPTJUPSZ QVCMJDDMBTT3FQPTJUPSZ\ !"VUPXJSFE QSJWBUF+ECD.BOBHFSKECD.BOBHFS QVCMJD-JTU.PEFMHFU)PHF#Z*E .PEFMN \ SFUVSOKECD.BOBHFSHFU3FTVMU CFBODMBTT lTRMQBUIz N ^ QVCMJDJOUJOTFSU .PEFMN \ SFUVSOKECD.BOBHFSJOTFSU lTRMQBUIz N ^ ^
͖͔͚ͬ·ͱΊ w ϨΠϠʔ͝ͱͷ࠴ͱґଘΛ͖ͬΓͤͯ͞ೝతෛՙΛ͍ͨ͘͠ w Ϋϥε͝ͱͷ࠴Λ͖ͬΓ͍ͤͨ͞ FOUJUZͰ͍͔ۤ͠ΒNPEFM͏ͱ͔ݏ w ͬͱΦϒδΣΫτࢦΛಥ͖٧Ί͍ͨ ݸਓతཉٻ
w ͰͲ͏ͬͯίʔυʹམͱ͍͍ͤͷʁ ɹɹ ɹɹ͡ΌΜ͚ΜΞυϕϯτΧϨϯμʔʹग़ձ͍ ɹɹܰྔ%%%ͱ ϨΠϠʔυΞʔΩςΫνϟ ͕ྑͦ͞͏ͩͱؾͮ͘ IUUQTRJJUBDPNBEWFOUDBMFOEBSKBOLFO
ͳͥ%%%✖͔ ݁ɿδϟϯέϯΞυΧϨͱদԬ͞ΜʹΑΔೖํ๏Λ৴པ͍ͯ͠Δ͔Β
ͳͥ%%%✖͔ w ʮ%%%ઓུతઃܭͱઓज़తઃܭ͕͋ΔΑ͏ͩʯ w ʮઓུతઃܭυϝΠϯΤΩεύʔτͱͷର͕ॏཁͰݸਓͰݶք͕͋Δͳʯ w ʮઓज़తઃܭ͚ͩؤுΔܰྔ%%%ΞϯνύλʔϯͬͯݴΘΕΔͷ͔ʯ w ʮΞϯνύλʔϯͳΒΔҙຯͳ͍ͷͰʁʯ
দԬ͞Μl%%%ͷϞ デ Ϧϯ グ ͱԿͳͷ͔ɺͦͯ͠ ど ͏ίʔ ド ʹམͱ͢ͷ͔z w ΈΜͳܰྔ%%%Ͱ࢝Ί͍ͯΔʂ
ͳͥ%%%✖͔ w ʮܰྔ%%%Ͱ࢝Ί͍͍ͯΒ͍͠ɺͰΞʔΩςΫνϟຊʹͰ͍͍ͷ͔ ʯ দԬ͞Μl৽ଔʹΘΔυϝΠϯۦಈઃܭͷΞʔΩςΫνϟઆ໌z ̐%%%ೖʹྑͦ͞͏
ॴײ ݁ɿʮΞʔΩςΫνϟτϨʔυΦϑͰ͋ΔʯΛ࣮ײͨ͠
ྑ͍ͱײ͡Δ໘ w ύοͱݟͯͱΘ͔Δ͜ͱͰೝ ෛՙԼ͕ͬͨͱࢥ͏ w ϨΠϠʔ͝ͱʹ4FSWJDFΛׂͰ ͖ͨ w 4FSWJDF&YDFQUJPOΛͰΓ ͚ͯߟ͑ΒΕΔΑ͏ʹͳͬͨ
ྫ͑SFRVFTUQBSBNTʹର͢Δྫ֎ "QQMJDBUJPOɺυϝΠϯͷ੍্ͷྫ֎ EPNBJOɺͳͲ ॴײ ΞʔΩςΫνϟฤ TSDNBJOKBWB cBQQMJDBUJPOTFSWJDF cEPNBJO cNPEFM cTFSWJDF cFYDFQUJPO cJOGSBTUSVDUVSF cSFQPTJUPSZ cQSFTFOUBUJPO cFYDFQUJPO cBQJ cEUP
ѱ͍ͱײ͡Δ໘ ఆ w 4FSWJDFͷ࠴ͷʹΉ ͜Ε%PNBJO4FSWJDF "QQMJDBUJPO4FSWJDF w ϨΠϠʔؒͷσʔλͷड͚͠ ʹΉ
BQQMJDBUJPO4FSWJDFͰQSFTFOUBUJPOͷEUPʹ σʔλΛ٧ΊΔʁґଘͷ͖߹ͬͯΔ ॴײ ΞʔΩςΫνϟฤ TSDNBJOKBWB cBQQMJDBUJPOTFSWJDF cEPNBJO cNPEFM cTFSWJDF cFYDFQUJPO cJOGSBTUSVDUVSF cSFQPTJUPSZ cQSFTFOUBUJPO cFYDFQUJPO cBQJ cEUP
ྑ͍ͱײ͡Δ໘ w &OUJUZ͕ΦϒδΣΫτࢦ͍ͯ͠Δײ FOUJUZͷৼΔ͍ͱͯ͠ఏڙ͞ΕΔϝιου͔Βঢ়ଶ Λมߋ TFUUFSͷ༻ Λ͢Δͷ001ͩͳͱࢥ͏ w &OUJUZΛಡΊ͍͍ͱ͍͏҆৺ײ อकۀʹෳࡶͳΫΤϦͷղಡؚ͕·Ε͍ͯͳ͍͜ͱ
͕อূ͞Ε͍ͯΔ͜ͱਫ਼ਆӴੜ্ྑ͍ w $234ͰNPEFMΫϥε ෳࡶͳ SFQPTJUPSZ͔Βͷղ์ SFQPTJUPSZΛԚ͢ݪҼෳࡶͳRVFSZͰӬଓԽͰͳ ͘6*ͷ߹͔ͩΒׂΓͬͯRVFSZ4FSWJDFΛ࡞Δͱ͍ ͏ߟ͑ํଥੑ͕͋Δͱࢥ͏ ॴײ %%%ฤ @Entity class Task { @Id @GeneratedValue private Long id; private TaskStatus taskStatus; private String name; private int postponeCount; private static final int POSTPONE_MAX_COUNT = 3; /* * ίϯετϥΫλɿ ΤϯςΟςΟ࡞࣌ͷෆม݅Λදݱ */ public Task(String name, LocalDate dueDate) { if (name == null || dueDate == null) { throw new IllegalArgumentException("ඞਢ"); } this.name = name; this.taskStatus = TaskStatus.UNDONE; this.postponeCount = 0; } }
ѱ͍ͱײ͡Δ໘ ఆ w ΠϯϐʔμϯεϛεϚονͷղফ ͕໘͍͘͞ w ूͷΓํ͕%#ͷϞσϦϯά ʹҾͬுΒΕΔ w σʔλΞΫηεͷύϑΥʔϚϯε
ѱͦ͏ ॴײ %%%ฤ !3FQPTJUPSZ QVCMJDDMBTT3FQPTJUPSZ*NQMJNQMFNFOUT3FQPTJUPSZ\ !"VUPXJSFE 1SJWBUF.PPE.BQQFSQPTU.BQQFS QVCMJDWPJETBWF 1PTUQPTU \ QPTU.BQQFSTBWF NPPE -JTU4USJOHJETNPPEHFU.PPE*E TUSFBN fi MUFS MJLF NPPEHFU-JLFT DPOUBJOT MJLF DPMMFDU $PMMFDUPSTUP-JTU -JTU-JLFMJLFTMJLF.BQQFS fi OE#Z*E JET MJLFTGPS&BDI M\ MJLF.BQQFSTBWF M ^ ^ ^
Ҏ্Ͱ͢ ۜͷؙ͕ཉ͍͠