藥不藥來當工程師
一個不務正業的藥師,誤打誤撞來當了前端工程師。斜槓工程師的人生!
nodejs
2026
使用 Observer Pattern 重構複雜的資料上傳流程 - 以 PrimaryAPI 與 BackupService 整合為例
2026-01-12
2026-01-14
在後端開發中,我們常遇到需求不斷疊加,導致原本單純的類別(Class)變成了「上帝類別(God Class)」,職責混雜且難以測試。最近我在處理一個將資料上傳到 PrimaryAPI(主要資料平台)與 BackupService(備份服務)的功能時,就遇到了「堆疊式複雜度」的問題。本文將分享如何利用 Observer Pattern(觀察者模式)1 與 Mediator Pattern(中介者模式)2 來優化架構,達成高內聚低耦合的設計。
Blog Archive
2026 (3)
一月 (3)
從 100 行 Regex 到 Lucene Parser:複雜驗證邏輯的重構之路
使用 Observer Pattern 重構複雜的資料上傳流程 - 以 PrimaryAPI 與 BackupService 整合為例
在 Cloud Run 被 OOM 教訓的一課:用 Stream 把記憶體從 O(N) 降到 O(1)
2025 (4)
十二月 (3)
TypeScript 5.5+ Inferred Type Predicates:告別手動標註 `item is string`
Nuxt3 中 $fetch 與 axios 在模組頂層的差異
Import Alias:~ vs @ 在不同框架的慣例
一月 (1)
旅遊規劃網站電腦版居然是 Vue dev mode!?
2024 (4)
十二月 (1)
Nuxt3 Nested Routes 與 active class
三月 (1)
參與高股息 ETF 除息前行情
二月 (2)
macOS 合併 Google Drive 壓縮下載
2024 新年新希望 重啟部落格
2021 (1)
六月 (1)
台股上市上櫃處置股 Google 行事曆 (每日更新)
2020 (1)
十月 (1)
利用 Nuxt.js 與 nuxt/content 搭建部落格 (1)
Tags
typescript (5)
nuxt (4)
vue (4)
vue3 (4)
隨筆 (4)
nuxt3 (3)
google (2)
javascript (2)
stock (2)
vue-router (2)
台股 (2)
$fetch (1)
00713 (1)
00878 (1)
00919 (1)
00929 (1)
00939 (1)
00940 (1)
ETF (1)
ast (1)
axios (1)
backend (1)
bash (1)
bigquery (1)
cloud run (1)
design-pattern (1)
finlab (1)
google calendar (1)
google drive (1)
jamstack (1)
lucene (1)
mac (1)
memory leak (1)
next.js (1)
node.js (1)
nodejs (1)
nuxt content (1)
nuxt2 (1)
observer-pattern (1)
ofetch (1)
oom (1)
parser (1)
peg.js (1)
pinia (1)
python (1)
react (1)
refactoring (1)
regex (1)
stream (1)
type-predicates (1)
type-safety (1)
validation (1)
vue2 (1)
旅遊 (1)
日本 (1)
閒聊 (1)
高股息 (1)
高股息 ETF (1)