HiIamJack
    • 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
    • Engagement control
    • 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 Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control 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
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    Design Pattern-類型有哪些 === # 前言 * 此技術文件及超連結記錄著Udemy上Dmitri Nesteruk的Design Patterns in Modern C++的一些學習筆記,並試著給出一些基本範例。 * 程式基本範例我通常盡量會想一些比較通俗的例子好理解,如果一時之間想不到會借助一下ChatGPT # 介紹 * 針對程式語言中常出現的問題所提出的解決方法,名詞術語由Erich Gamma等人在1990年代從建築設計領域引入到電腦科學的。通常有以下三中類型 * Creational Pattern 創建型模式 * 用於描述如何建立物件 * Structural Pattern 結構型模式 * 描述了在保持原結構的彈性和效能下,如何將類別或物件透過複合(composition)、繼承(inheritance)的方式,建構出更大更複雜的架構。 * Behavioral Pattern 行為型模式 * 描述物或類別之間的使用,例如管理物件、物件間的協作 # Creational Pattern 創建型模式 | Pattern Name |應用 |舉例 | -------------------------------------------------- |-------------------------------|-------------------------- |[Builder](https://hackmd.io/5CFWptesRdGVVs8IP_tVyw) |創建物件且簡化參數介面 | I15,I15 Pro, I15Plus規格設定 |[Factory](https://hackmd.io/HLmgbI0XQ7KQT9yc7Ydl8g) |創建特定規格的物件 | 特定形狀的肉品製作 |[Prototype](https://hackmd.io/9KOgUsCuRFSuOSq-c5Ql2A)|創建新物件時直接複製以創造的物件內容 | new一個車的class並複製後再做修改 |[Singleton](https://hackmd.io/EwmEZoSzR3WwB6w6FS0Edg)|實體化的類別在程式中唯一的時候 | 資料庫,實體化性能開銷較大的class # Structural Pattern 結構型模式 | Pattern Name | 應用 |舉例 | ----------------------------------------------------|-----------------------------------|----------------- |[Adapter](https://hackmd.io/h2Eojn2CQHewD4TN1vcHpA) |不同類別需轉換數據或方法時 |匯率轉換、電壓 |[Bridge](https://hackmd.io/mBaKePEeRVm4uBvpCAFpSw) |降低繼承及區分對內對外的實作細節 |電腦或手機使用特定OS |[Composite](https://hackmd.io/mfNd_AlKSSmZshnPySI8DA)|用來處理樹狀結構的資料 |資料夾、書本目錄子章節、Tree的leave跟node |[Decorator](https://hackmd.io/ccDhxD1PTT2-qErJWGGhLg)|為物件添加額外屬性 |奶茶添加珍珠、布丁 |[Facade](https://hackmd.io/HfZYieYHQhqs8Hb7ASqd6Q) |用於簡化對外的API窗口|一鍵設置功能 |[Flyweight](https://hackmd.io/KbQ4hA1ESCqycCGW3vIjDA)|盡量減少相同物件的建立以減少記憶體開銷 |遊戲腳色開發 |[Proxy](https://hackmd.io/Z51-5CLSSC2YHQbz814ebg) |將原方法做轉介 |電視盒轉介電視頻道的影片、請人代購 # Behavioral Pattern 行為型模式 | Pattern Name | 應用 |舉例 | ------------------------------------------------------------------| ----------------------|------------- |[Observer](https://hackmd.io/_onm1d7QQqyFraDGD2TAEA) | 一對多的狀態或資訊更新 |youtube影片更新 |[State](https://hackmd.io/CtALz-G2Q8Wz7ufqAm6xMA) | 狀態切換即執行動作 |遊戲腳色狀態變化 |[Strategy](https://hackmd.io/eVZBB2TASl60xo3RB1wntA) | 透過物件的選取來決定應對方式|付錢(現金,信用卡,QR code) |[Chain of Responsibility](https://hackmd.io/qgCyRM4FTJ-HRX-znavXXw)| 多個對象處理一個請求 |登機手續、學校畢業手續 |[Command](https://hackmd.io/YQPd9H-VTYeaiq4AILsf4Q) | 維護及執行一系列的請求 |遙控器控制設備 |[Interpreter](https://hackmd.io/UaZtBTb1QV6uqFdofPyZuQ?both) | 語法規則建立 |四則運算 |[Iterator](https://hackmd.io/w0om4D4lRXKNwyIJpToRBw) | 訪問及操作特定資料結構 |遍歷tree、list、vector... |[Mediator](https://hackmd.io/fJxW3_6PSpmJf_7Of8nCcA?both) | 減少相同類別的依賴關係 |聊天室、塔台 |[Memento](https://hackmd.io/rG1Gj7QZQGy5WoMysbw1ow) | 用來記錄之前的狀態且可回復 |遊戲進度儲存及讀取 |[Template](https://hackmd.io/RoHpS19_RG6Pgq1-9bNL3w) | 透過繼承來擴展方法 |食譜順序 |[Visitor](https://hackmd.io/fYIzKW_kRMKsJKfBi1aPQQ) | 數據結構穩定的情況下訪問不同元素| 程式訪問不同形狀類別並互叫現在是什麼形狀、訪可來學校遇到不同人 github : https://github.com/GU-Lin/Design_Pattern_Practice source : https://ithelp.ithome.com.tw/articles/10320610?sc=rss.iron ###### tags : `Catalog` `DesignPattern`

    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