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
JCConf 2022 - Using ArchUnit to test your archi...
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Shihyu Ho
October 15, 2022
Technology
170
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
JCConf 2022 - Using ArchUnit to test your architecture
Using ArchUnit to test your architecture
Shihyu Ho
October 15, 2022
More Decks by Shihyu Ho
See All by Shihyu Ho
JCConf 2024 Jib
shihyuho
0
120
hybrid-cloud-seminar.pdf
shihyuho
0
130
JCConf 2021 Access Kubernetes API in Java
shihyuho
0
160
JCConf 2020 Observing in Microservices
shihyuho
0
930
iThome Kubernetes Summit 2018
shihyuho
0
79
JCConf 2016 zookeeper
shihyuho
0
99
Other Decks in Technology
See All in Technology
[RSJ26] AnoleVLA: Lightweight Vision-Language-Action Model with Deep State Space Models for Mobile Manipulation
keio_smilab
PRO
0
120
「重なり」は迎える側がつくる ― 人もAIエージェントも歓迎するプロダクトエンジニアリング ―
go0517go
PRO
0
140
Beyond the Hype: Practical AI for Your Oracle Database with MCP
thatjeffsmith
1
170
Backstageでつくるセルフサービスな社内開発基盤
kikunosuke75
1
210
GuardDuty 検知対応を DevOps Agent で効率化しようとしている話 / GuardDuty Investigations with DevOps Agent
masahirokawahara
1
150
データエンジニアの困りごとをDevinと一緒に解消する
10xinc
2
570
現場の暗黙知を継承するAIエージェント — 対話から生まれる長期記憶と Skills
atsukish
0
220
人気商品が「ちゃんと買える」をつくる ー ECの負荷改善
ykagano
1
190
AIエージェントの開発・提供におけるセキュリティリスクの論点と対策
flatt_security
1
370
Level Up Your CDK DX: 5 Tools I’ve Been Building
gotok365
2
180
DGX Sparkを2台使って いろいろ動かす話
sonoda_mj
1
110
AIで開発は速くなったのに、なぜ現場は楽にならないのか 〜あなたの組織のボトルネックを突き止めるワークショップ〜
jacopen
1
210
Featured
See All Featured
Crafting Experiences
bethany
1
270
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.8k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
Discover your Explorer Soul
emna__ayadi
2
1.3k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
400
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
760
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
230
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
590
Skip the Path - Find Your Career Trail
mkilby
1
210
Transcript
Using ArchUnit to test your architecture Matt Ho
About me - Hi, I'm Matt 👋 - 松凌科技 Architect
/ R&D - JCConf Speaker -
[email protected]
- https://github.com/shihyuho
放⼼, 這不是在講架構
本節在分享 架構已經在那了 && 該如何確保在持續開發/維運的過程中, 應⽤程式仍 然遵循著架構走
https://www.archunit.org/
ArchUnit Overview - 是⼀個測試套件, 整合了 JUnit 4, JUnit 5 等
- 良好的 Fluent API - 容易延伸擴充 - Apache-2.0 license
運作過程
起⼿式 決定從哪邊開始匯入 bytecodes
起⼿式 定義 Rules
起⼿式 ArchUnit 執⾏得到結果
起⼿式 - Rule Pattern ArchRuleDefinition.GIVEN_OBJECTS .that(). PREDICATE .should(). CONDITION
Controller 命名必須以 ‘Controller’ 結尾 Class Naming
Controller 命名必須以 ‘Controller’ 結尾 Class Naming
Class Naming Controller 命名必須以 ‘Controller’ 結尾
Class Naming Data Access 命名必須以 ‘Dao’ 結尾
Class Naming Data Access 命名必須以 ‘Dao’ 結尾
Class Naming Data Access 命名必須以 ‘Dao’ 結尾
Layered
Layered
Layered
Layered
Layered Architectures.layeredArchitecture() .layer(). PREDICATE .whereLayer(). CONDITION
Layered 定義 3 層 layer 定義依賴關係
General
Freeze - 套⽤在舊的系統中, 超多條違規改不動 ;-(
Freeze - 套⽤在舊的系統中, 超多條違規改不動 ;-( - 好吧, 那就現在開始的程式才檢查 :-)
Freeze - 套⽤在舊的系統中, 超多條違規改不動 ;-( - 好吧, 那就現在開始的程式才檢查 :-) FreezingArchRule.freeze(
ArchRuleDefinition.GIVEN_OBJECTS .that(). PREDICATE .should(). CONDITION )
Freeze
Code Smells
Long Parameter List https://refactoring.guru/smells/long-parameter-list
Large Class https://refactoring.guru/smells/large-class
Long Method https://refactoring.guru/smells/long-method
Recap - 起⼿式 - Naming Rules - Layers Rules -
General Rules - Freezing Rules - Custom Rules - Code Smells
Thank you 🙌