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
JCConf 2022 - Using ArchUnit to test your archi...
Search
Shihyu Ho
October 15, 2022
Technology
180
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
130
hybrid-cloud-seminar.pdf
shihyuho
0
140
JCConf 2021 Access Kubernetes API in Java
shihyuho
0
170
JCConf 2020 Observing in Microservices
shihyuho
0
960
iThome Kubernetes Summit 2018
shihyuho
0
90
JCConf 2016 zookeeper
shihyuho
0
110
Other Decks in Technology
See All in Technology
LambdaWebFunctionsを試してみた / exploring-lambda-web-functions
koukihosaka
1
360
CTO Night|NotionのAIエージェントとFDE
kzkhykw1991
0
260
S3 Filesで挑む! 八戸せんべい汁の食べ頃問題
usanchuu
0
120
夫婦で子育てするための育児標準化
codmoninc
PRO
0
480
Kiro Crewで「みのるん式」仕事術やってみた
minorun365
PRO
3
880
AI駆動で「他アプリの音を加工できる」アプリを作った
satomasahiro2005
0
180
パスキーの自動テストはどこまでいけるのか
teamlab
PRO
0
290
AIカンパニーへの転換を支えた、エンジニアの仕事の再定義
kworkdev
PRO
2
1.3k
1つのリクエストを追って理解する - llm-dのP/D分離
akhino
1
180
AI導入は済んだ。次は統制を作り替える番だ_AI×開発組織 Summit 2026
techtekt
PRO
0
390
OptunaHub: ブラックボックス最適化のためのプラットフォーム
pfn
PRO
0
140
トークン化預金DCJPYの取り組みと活用ユースケース
finengine
0
180
Featured
See All Featured
How to build a perfect <img>
jonoalderson
1
6.1k
The Invisible Side of Design
smashingmag
301
52k
Scaling GitHub
holman
464
140k
brightonSEO & MeasureFest 2025 - Winning Strategies for Black Friday CRO & PPC - Christian Goodrich
cargoodrich
3
870
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
500
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
570
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
480
First, design no harm
axbom
PRO
2
1.3k
Making Projects Easy
brettharned
120
6.8k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
340
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
570
Game over? The fight for quality and originality in the time of robots
wayneb77
1
310
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 🙌