Kimn
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    --- ###### tags: `Design Pattern` --- # 參考資料、問題 - [Java设计模式详解,全网最全23种Java设计模式(图解+框架源码分析+实战)](https://www.bilibili.com/video/BV1Np4y1z7BU?p=34&share_source=copy_web) - [从零开始学习Java设计模式 | 结构型模式篇:代理模式](https://liayun.blog.csdn.net/article/details/119358132) - [图解23种设计模式(TypeScript版)](https://segmentfault.com/a/1190000022886186) - [Typescript 命令模式(Command)](https://www.jianshu.com/p/b16d9d90544d) - [『设计模式实战』【TypeScript + JavaScript】](https://www.bilibili.com/video/BV1Py4y1D7TA?p=3) - [设计模式。 语言实现:Java、TypeScript](https://github.com/FantZero/Design-Pattern) - [一文讀懂七大設計原則及GoF 23種設計模式](https://codingnote.cc/zh-tw/p/83149/) - [程式如何正確撰寫 ?】物件導向程式設計 - SOLID 設計原則 : SRP、OCP、LSP、ISP、DIP](https://ithelp.ithome.com.tw/articles/10257015) - [報告](https://docs.google.com/presentation/d/1sqNd2HkITo0ixahK-8nMcR0OVQxMKIf3WOGvhNxHW7o/edit?usp=sharing) - [todolist](https://www.bilibili.com/video/BV1Jy4y1z7S3?p=1) - [设计模式超简单的解释!](https://github.com/guanguans/design-patterns-for-humans-cn) - [混合使用太香了:策略设计模式+工厂模式+模板方法模式](https://www.bilibili.com/video/BV1b5411a7oa/?spm_id_from=333.788.recommend_more_video.18) - [9种设计模式在Spring中的运用,一定要非常熟练!](https://mp.weixin.qq.com/s?__biz=Mzg3MzU2Njk3MA==&mid=2247492808&idx=2&sn=228741e123cfbafbe722711312289765&scene=19&ascene=7&devicetype=android-26&version=28000244&nettype=WIFI&lang=zh_TW&exportkey=CQwu3LKxpDxTQleEyELaHxE%3D&pass_ticket=1WFcZcmu%2FzoRryXZaMQXoV84XswLemz7kRUb9tdZZc5k4CxLzehRXm8PF9%2FMTDP%2B&wx_header=1) - [JDK中涉及的设计模式总结](https://blog.csdn.net/caoxiaohong1005/article/details/79961539?spm=1001.2014.3001.5501) # 整理 - 一句話歸納七大設計原則: | **設計原則** | **一句話歸納** | **目的** | |:-------------------- |:---------------------------------------------------- |:-------------------------------------------- | | 開閉原則(OCP) | 對擴展開放,對修改關閉 | 減少維護帶來新的風險 | | 依賴倒置原則(DIP) | 高層不應該依賴底層,儘可能的依賴抽象 | 更利於程式碼結構的升級擴展 | | 單一職責原則(SRP) | 一個類只做一件事 | 便於理解,提高程式碼可讀性 | | 介面隔離原則(ISP) | 一個介面只做一件事 | 功能解耦,高聚合、低耦合 | | 迪米特法則(LoD) | 不該知道的不要知道 | 只和朋友交流,不和陌生人說話,減少程式碼臃腫 | | 里氏替換原則(LSP) | 子類重寫方法的功能發生改變,不應該影響父類方法的含義 | 防止繼承泛濫 | | 合成復用原則(CARP) | 盡量使用組合實現程式碼復用,而不使用繼承 | 降低程式碼耦合 | - 一句話歸納創建型設計模式: | 設計模式 | 一句話歸納 | 目的 | 生活案例 | 框架源碼舉例 | |:--------------------- |:------------------------------ |:---------------- |:--------:| ------------------------------------ | | 工廠模式(Factory) | 產品標準化,生產更高效 | 封裝創建細節 | 實體工廠 | LoggerFactory、Calender | | 單例模式(Singleton) | 只有一個對象 | 保證獨一無二 | CEO | BeanFactory、Runtime | | 原型模式(Prototype) | 拔一根猴毛,吹出千萬個 | 高效創建對象 | 克隆 | ArrayList、PrototypeBean | | 建造者模式(Builder) | 高配中配與低配,想選哪配就哪配 | 開放個性配置步驟 | 選配 | StringBuilder、BeanDefinationBuilder | - 一句話歸納結構型設計模式: | **設計模式** | **一句話歸納** | **目的** | **生活案例** | **框架源碼舉例** | |:----------------------- |:---------------------------------------------- |:------------------ |:------------:|:--------------------------------------------------------- | | 代理模式(Proxy) | 沒有資源沒時間,得找媒婆來幫忙 | 增強職責 | 媒婆 | ProxyFactoryBean、JdkDynamicAopProxy、CglibAopProxy | | 門面模式(Facade) | 打開一扇門,走向全世界 | 統一訪問入口 | 前台、導診台 | JdbcUtils、RequestFacade | | 裝飾器模式(Decorator) | 他大舅他二舅都是他舅 | 靈活擴展、同宗同源 | 煎餅 | BufferedReader、InputStream | | 享元模式(Flyweight) | 優化資源配置,減少重複浪費,開源節流 | 共享資源池 | 全國社保聯網 | String、Integer、ObjectPool | | 組合模式(Composite) | 人在一起叫團伙(聚合),心在一起叫團隊(組合) | 統一整體和個體 | 組織架構樹 | HashMap、SqlNode | | 適配器模式(Adapter) | 適合自己的,才是最好的 | 兼容轉換 | 電源適配 | AdvisorAdapter(Spring AoP)、HandlerAdapter(SpringMVC) | | 橋接模式(Bridge) | 從現實連接抽象 | 不允許用繼承 | 橋 | DriverManager | # 問題 - 破壞 反射破解單例模式(29~33 聽不懂跳過) - P58 59 60 JDK CGLIB代理跳過(好像都 JAVA的) - 動態代理 Proxy 方法 [MDN Proxy](https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Proxy) - 61 - 69 JDK 源碼分析 - decorator 能不能用 @ 去寫 - 組合模式 定義結構聽不太懂 P82 - JS 沒有 List,只能用 private menuComponentList = new Map<string, MenuComponent>(); 來寫 - map 不太會用 - Type 'AbstractBox | undefined' is not assignable to type 'AbstractBox'. ==Ans:加 if 判斷 undefined== - Object is possibly 'undefined'. - console.log(box1?.getShape()); ==Ans:加問號可以解決 or 在前一步攔截 undefined== - typescript 沒有 final method - ts 沒有 afterPropertiesSet 做不到將 class 交給 spring 管理 ![](https://i.imgur.com/Tqfqpho.png) - 裝飾器說明

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully