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
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
140
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
Oracle Cloud Infrastructure IaaS 新機能アップデート 2025/12 - 2026/2
oracle4engineer
PRO
0
170
猫でもわかるKiro CLI(AI 駆動開発への道編)
kentapapa
0
260
Sansanでの認証基盤内製化と移行
sansantech
PRO
0
580
スクリプトの先へ!AIエージェントと組み合わせる モバイルE2Eテスト
error96num
0
190
Postman v12 で変わる API開発ワークフロー (Postman v12 アップデート) / New API development workflow with Postman v12
yokawasa
0
140
Scrumは歪む — 組織設計の原理原則
dashi
0
200
20260311 技術SWG活動報告(デジタルアイデンティティ人材育成推進WG Ph2 活動報告会)
oidfj
0
360
非情報系研究者へ送る Transformer入門
rishiyama
15
8.9k
OCI技術資料 : コンピュート・サービス 概要
ocise
4
54k
CyberAgentの生成AI戦略 〜変わるものと変わらないもの〜
katayan
0
270
組織全体で実現する標準監視設計
yuobayashi
3
500
PMとしての意思決定とAI活用状況について
lycorptech_jp
PRO
0
140
Featured
See All Featured
Everyday Curiosity
cassininazir
0
170
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
150
How to build a perfect <img>
jonoalderson
1
5.3k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
9.9k
Producing Creativity
orderedlist
PRO
348
40k
The Spectacular Lies of Maps
axbom
PRO
1
630
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
450
Technical Leadership for Architectural Decision Making
baasie
3
300
We Are The Robots
honzajavorek
0
200
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.9k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.5k
Rails Girls Zürich Keynote
gr2m
96
14k
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 🙌