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
190
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
Transcript
34 slides
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 🙌
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
180
JCConf 2020 Observing in Microservices
shihyuho
0
970
iThome Kubernetes Summit 2018
shihyuho
0
92
JCConf 2016 zookeeper
shihyuho
0
120
Other Decks in Technology
See All in Technology
自動計装なしでECSサービスをApplication Signalsに載せるまで
ota1022
2
480
PR 生成AIガバナンスの全体像がわかる本
yoshimura_datam
0
120
フルTypeScript × AI駆動開発で開発量が数倍に (JSConf JP 2026 スポンサーLT:NCDC株式会社)
keitaibaraki
0
550
ワークフローからハーネスへ — Web フレームワークの作者たちが AI エージェントに向かう理由
azukiazusa1
4
3.5k
NutanixへのSSHアクセスの今後について
shadowhat
0
190
Agent Routerで作るマルチテナント 推論基盤 #CNDW2026 / Building Multi-Tenant Inference Platform with Agent Router #CNDW2026
everpeace
5
650
猫でもわかるKiro初心者編(2026年11月版)
kentapapa
1
120
新規事業開発でのAWS活用成功談&失敗談! 〜新規事業開発を専門に行うRelicならではのAWS活用〜
amixedcolor
1
160
データ界隈LT祭の運営のふりかえり
yoshimura_datam
0
100
生成AIによる情報システムへのインパクト (2026年11月版)
taka_aki
0
130
Ignite 2026 Security
babaneko
0
110
一口馬主の募集馬をAIで診断してみた
yoshimura_datam
0
110
Featured
See All Featured
Skip the Path - Find Your Career Trail
mkilby
1
300
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
1
320
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.9k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
7.1k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
370
Paper Plane
katiecoart
PRO
6
55k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
440
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.3k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
1
680
A designer walks into a library…
pauljervisheath
211
25k
What the history of the web can teach us about the future of AI
inesmontani
PRO
3
840
Raft: Consensus for Rubyists
vanstee
143
7.9k