📑
scrapbook
  • Introduction
  • 1. Concept
  • 1.1 EAI
  • 1.2 ESB
  • 1.3 EAI v.s. ESB
  • 1.4 SOA
  • 1.5 RESTful
  • 1.6 Microservices
  • 1.7 Microservice v.s. SOA
  • 1.8 Maintain HTTP State
  • 1.8.1 Cookie
  • 1.8.2 Session
  • 1.9 Put, Add, and Set
  • 1.10 Public Key & Private Key
  • 1.11 Message Digest & Hash Function
  • 1.12 Diffie - Hellman Key Exchange
  • 1.13 About IoC
  • 1.14 About AOP
  • 1.15 Spring - Pros and Cons
  • 1.16 Spring - Prototype in Singleton
  • 1.17 HTTP v.s. SPDY
  • 1.18 HTTP/2
  • 1.19 Securing REST Services
  • 1.20 Conway's Law
  • 1.21 大型網站架構演化發展歷程
  • 1.22 Java Generics
  • 1.23 MySQL HA經驗談
  • 2. Questions & Solutions
  • 2.1 海底撈幾根針
  • 2.2 塞不進去
  • 3. Relational Database
  • 3.1 SQL Join Type
  • 3.2 SQL Injection
  • 3.3 MySQL CHAR v.s. VARCHAR
  • 4. NoSQL
  • 4.1 CAP Theorem, ACID v.s. BASE
  • 4.2 Two-Phase-Commit
  • 4.3 RDB v.s. NoSQL
  • 4.4 Structured, Unstructured and Semi-structured Data
  • 4.5 Shard v.s. Replica
  • 4.6 ArrayList v.s. LinkedList
  • 4.7 HashSet v.s. TreeSet
  • 4.8 HashMap v.s. TreeMap
  • 4.9 ArrayList v.s. Vector
  • 4.10 HashMap v.s. HashTable
  • 4.11 Statement, PreparedStatement and CallableStatement
  • 4.12 Overflow of Digits
  • X. JVM
  • X.1 JVM System Threads
  • X.2 Garbage Collection
Powered by GitBook
On this page

Was this helpful?

1.15 Spring - Pros and Cons

Spring現在確實是Java圈子中的當紅框架, 但沒有東西是完美的, 我想這邊就整理一下自己認為的pros/cons.

Pros

  • Component跟container之間的解耦

  • Component跟dependency之間的解耦

  • 提供了一種管理物件的機制, 把可以把中間層有效地組織起來, 就像膠水一樣

  • 有利於培養code on interface的習慣

  • 目的之一是為了寫出易於測試的程式

  • 一致的資料存取介面

  • 非侵入性(non-intrusive), 讓你的application對Spring的依賴盡可能的減到最小程度

  • 消除許多軟體工程中常見的對singleton的過度使用

  • 較為輕量級的解決方案

  • IoC將建立物件的職責從程式中抽離到了框架中, 如setter/constructor injection

Cons

  • IoC, AOP這類的技術, 立意都是想將原本位於application中的hard-code邏輯抽出並且移至配置文件中(或其他形式), 大部分人都覺得這是在提高可維護性, 但若從以下幾點來看的話, 也許是缺點, 尤其是當你面對一個陌生的系統, 或是專案人員變動頻繁的情形:

    • 中斷了application的邏輯, 使程式變得不完整, 不直觀. 單從source無法完全把握application的所有行為

    • 將原本應該寫成code的邏輯變成了configuration, 可能會增加出錯的機會與負擔

    • 有時候你會發現維護程式竟然比維護config file還要輕鬆, 畢竟config多了之後, 程式的邏輯性跟可讀性多少都會降低一些

  • 有一種說法叫"overbean", 就是你什麼東西都要把它變成bean, 太過頭反而會有點亂

Previous1.14 About AOPNext1.16 Spring - Prototype in Singleton

Last updated 5 years ago

Was this helpful?