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
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
110
hybrid-cloud-seminar.pdf
shihyuho
0
130
JCConf 2021 Access Kubernetes API in Java
shihyuho
0
150
JCConf 2020 Observing in Microservices
shihyuho
0
880
iThome Kubernetes Summit 2018
shihyuho
0
78
JCConf 2016 zookeeper
shihyuho
0
89
Other Decks in Technology
See All in Technology
どうして今サーバーサイドKotlinを選択したのか
nealle
0
140
BPaaSで進むAIオペレーションの現在地 AI実装が効く領域とスケーラビリティの選定と実装
kentarofujii
0
220
AI Agentをシステムに組み込む前にゆるく向き合ってみる
hayama17
0
180
AIエージェントとPhysical AIが拓く製造業の変革(ハノーバーメッセリキャップ)
iotcomjpadmin
0
190
「ビジネスがわかるエンジニア」とは何か?
ryooob
0
420
攻撃者がいなくてもAIエージェントはインシデントを起こす
nomizone
0
160
そこにあるから地図ができる~位置を示す"モノ"を愉しむ~ - Interface 2026年6月号GPS特集オフ会 / interface_202606_GPS_offline
sakaik
1
140
4人目のSREはAgent
tanimuyk
0
310
40代で“やっとエンジニアになれた”――閉じた学びを開き、空の青さを知る / 20260628 Naoki Takahashi
shift_evolve
PRO
4
1.4k
事業会社は今こそSWEを高給で雇ってWebシステムを内製しよう
masaokb
0
110
從觀望到全公司落地:AI Agentic Coding 導入實戰 — 流程整合與安全治理
appleboy
0
240
WebGIS AI Agentの紹介
_shimizu
0
600
Featured
See All Featured
Side Projects
sachag
455
43k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
180
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.5k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
760
Code Review Best Practice
trishagee
74
20k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
400
Prompt Engineering for Job Search
mfonobong
0
360
Why Our Code Smells
bkeepers
PRO
340
58k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
260
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
150
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.3k
Between Models and Reality
mayunak
4
360
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 🙌