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
0
160
JCConf 2022 - Using ArchUnit to test your architecture
Using ArchUnit to test your architecture
Shihyu Ho
October 15, 2022
Tweet
Share
More Decks by Shihyu Ho
See All by Shihyu Ho
JCConf 2024 Jib
shihyuho
0
93
hybrid-cloud-seminar.pdf
shihyuho
0
110
JCConf 2021 Access Kubernetes API in Java
shihyuho
0
130
JCConf 2020 Observing in Microservices
shihyuho
0
840
iThome Kubernetes Summit 2018
shihyuho
0
75
JCConf 2016 zookeeper
shihyuho
0
80
Other Decks in Technology
See All in Technology
OCHaCafe S11 #2 コンテナ時代の次の一手:Wasm 最前線
oracle4engineer
PRO
2
150
AI駆動AI普及活動 ~ 社内AI活用の「何から始めれば?」をAIで突破する
oracle4engineer
PRO
1
110
SRE NEXT 2026 CfP レビュアーが語る聞きたくなるプロポーザルとは?
yutakawasaki0911
1
410
Oracle Cloud Infrastructure IaaS 新機能アップデート 2025/12 - 2026/2
oracle4engineer
PRO
0
160
2026-03-11 JAWS-UG 茨城 #12 改めてALBを便利に使う
masasuzu
2
400
AWSの資格って役に立つの?
tk3fftk
2
360
JAWSDAYS2026 [C02] 楽しく学ぼう!AWSとは?AWSの歴史 入門
hiragahh
0
170
フロントエンド刷新 4年間の軌跡
yotahada3
0
480
WebアクセシビリティをCI/CDで担保する ― axe DevTools × Playwright C#実践ガイド
tomokusaba
2
110
Goのerror型がシンプルであることの恩恵について理解する
yamatai1212
1
180
Tebiki Engineering Team Deck
tebiki
0
27k
最強のAIエージェントを諦めたら品質が上がった話 / how quality improved after giving up on the strongest AI agent
kt2mikan
0
190
Featured
See All Featured
Are puppies a ranking factor?
jonoalderson
1
3.1k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Paper Plane
katiecoart
PRO
0
48k
Agile that works and the tools we love
rasmusluckow
331
21k
RailsConf 2023
tenderlove
30
1.4k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
0
460
Technical Leadership for Architectural Decision Making
baasie
3
290
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
210
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.4k
Test your architecture with Archunit
thirion
1
2.2k
30 Presentation Tips
portentint
PRO
1
250
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
260
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 🙌