下午念什麼
  • NEW!
    NEW!  Connect Ideas Across Notes
    Save time and share insights. With Paragraph Citation, you can quote others’ work with source info built in. If someone cites your note, you’ll see a card showing where it’s used—bringing notes closer together.
    Got it
        • 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
          • Owners
          • Signed-in users
          • Everyone
          Owners Signed-in users Everyone
        • Write
          • Owners
          • Signed-in users
          • Everyone
          Owners 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 No publishing access yet

        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.

        Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

        Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

        Explore these features while you wait
        Complete general settings
        Bookmark and like published notes
        Write a few more notes
        Complete general settings
        Write a few more notes
        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
      • 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 Help
    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
    Owners
    • Owners
    • Signed-in users
    • Everyone
    Owners Signed-in users Everyone
    Write
    Owners
    • Owners
    • Signed-in users
    • Everyone
    Owners 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 No publishing access yet

    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.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    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
    # 第4章 分離領域 * 恭喜我們~進入PART II 模型驅動設計的建構區塊 * 接下來三個章節介紹不同的**模式語言** * CH4 本章重點:***Layered Architecture*** 分層架構 * 不囉唆看圖↓ ↓ ↓ ![](https://i.imgur.com/d5gXLfk.png) * DDD軟體設計風格「責任驅動設計」RDD(Responsibility-driven Design) * 目的:「領域物件」「系統中的其他功能」分離,已達到降底耦合,讓程式**更有彈性,更容易維護或更貼近業務需求與目標**。 --- ## Layered Architechture * Overview: 什麼是分層架構 -> 分層架構如何組成 -> 有哪些優劣 ### 1. 什麼是分層架構 * Also known as N-tier architecture 多層架構 * 將系統依據功能關係分成每一個layer,每個layer提供服務給更上層,因此最底層為核心服務,為整個系統所使用。 * 目的? * 透過職責分離,建立能夠處理複雜任務的程式 * 每一層的職責分離,不應該跨層互動,每層之間的關係只能是上下互動 ![](https://i.imgur.com/XKuG9XM.png) ![](https://i.imgur.com/94zJz3K.png) * 什麼時候用? * 當一個系統需要將開發切割成若干team去開發每一層的功能時 * 需要多層級的安全控管時 * 怎麼分?分幾層? --- ### 2. 分層架構如何組成 ![](https://i.imgur.com/GAaJ2wc.png) * DDD * 大多數架構使用以四個概念層,且Model-Driven Design的關鍵是把領域層分離出來 * 內聚性Cohesive: 每一層內分別進行設計,並指依賴於下層 * 低耦合Coupling: 使用標準的架構模式,只是上層進行鬆散的耦合 * 獨立性isolation: 各層連接方式只要能夠保持獨立性,那麼這些方式都是可接受的 * 畫重點:**分層模式中的一個重點在於對不同角色進行隔離,而隔離的目標是,當一層中進行更改時,通常不應該影響到非相關依賴層。** | 本書定義 | 其他常見名稱 | 描述 | | ------------ | ------------------------- | -------------------------------------------------------- | | 使用者介面層 | 表示層 | 負責向使用者顯示資訊(包含另一個電腦系統、使用者介面) | | 應用層 | -------- | 定義軟體要完成的任務,指揮表達領域概念的物件來解決問題 | | 領域層 | 模型層 | 業務軟體核心:負責「業務概念、業務狀態以及業務細則」 | | 基礎設施層 | -------- | 為上層提供通用技術能力System Support (OS, database etc.) | * 其他範例 * [Sample1: Presentation Layer/Business Layer/Data Layer/Common Layer](https://raychiutw.github.io/2019/%E9%9A%A8%E6%89%8B-Design-Pattern-2-%E8%BB%9F%E9%AB%94%E5%88%86%E5%B1%A4%E8%A8%AD%E8%A8%88%E6%A8%A1%E5%BC%8F-Software-Layered-Architecture-Pattern/) ![](https://i.imgur.com/GURIevl.png) * [Sample2: Presentation Layer/Business Layer/Data Layer](https://blog.johnwu.cc/article/software-layered-architecture-pattern.html) ![](https://i.imgur.com/NRjZ6I4.png) * DDD提出實際案例 作者Eric舉了一個網上銀行轉帳的例子。使用者可以選擇兩個帳號,並輸入金額執行轉帳。在應用層開啟事務,並呼叫領域層Account物件的credit和debit方法。技術設施層提供事務管理能力和資料持久化 ![](https://i.imgur.com/SA5a5Fi.png) --- ### 3. 有哪些優劣 * 好處? 1. 各層**設計清晰** * 使領域層能將重點放在如何表達領域模型上,而不需要考慮其他例如儲存問題、管理應用程式任務等內容,使結構清晰,更容易捕捉基本業務知識。) * 程式邏輯很線性,資料流主要就是從上到下或是從下往上 3. 各層獨立更容**易維護** * 可測試性,分層明確,在單元測試中其他層更容易被模擬 5. Separation of Concerns 關注點分離 * 每一層中的組件只處理與該層相關的邏輯 7. 有助分散式系統(distributed system)部署程式 (?? * 缺點? 1. 團隊素質要求 * 團隊成員須對Model-Driven Design & Layered Architechture 有一定了解,否則要先經歷艱辛學習過程。 3. 不要殺雞用牛刀 * 即使克服種種困難,有專業素質團隊以及專家配合,也只是完成簡單系統 ## The SMART UI 智慧使用者介面模式 > 又稱「反模式」讓你認清為什麼Why以及何時When需要使用像是Layered Architecture這樣的模式來分離出領域層 ![](https://i.imgur.com/XFPxFCO.png) * 優點 * 效率高 * 對工程師要求不高 * 原型和產品快速開發可以彌補需求分析方面的不足 * 模組按照功能来分割,可以相對精準安排小模組交付的日期。額外擴充簡單功能相對容易 * 關聯式資料庫很好的提供了資料整合 * 可適用第四代語言工具(4GL Tools) * 在應用程式交接之後,如果實在無法理解某一模組,可以直接重寫。因为模組之間没有共享的東西,所以修改只会影響本模組。 * 缺點 * 不透過資料庫,難以整合應用程式模組 * 沒有對行為重用,也沒有業務問題的抽象,假如要用到相關業務規則,皆須重複這些規則 * 限於簡單的應用程式模組,複雜的會讓你無所適從 --- ## 名詞解釋 * 第四代語言工具:(4th Generation Language ,簡稱 4GL)是使用者導向的語言,它和程序式程式語言最大的不同,在於它是以程式的「目的」為設計重心,而非如第三代語言以「過程」為法則,因此「要做什麼?」比「如何做?」更重要,程式設計師只需寫出「要做什麼?」,無需瞭解電腦是如何去執行的,例如: 4GL 比第三代語言缺少了控制性及設計彈性,執行速度也比較慢,然而其易學易用的特性畢竟非第三代語言所能比擬,因此至今在資料庫處理的領域裡, 4GL 仍然保有一片天空,例如結構化查詢語言(structured query language,SQL)就是典型的代表實例。 * [分散式系統](https://morosedog.gitlab.io/technology-20200228-tech-5/): 分散式系統是一組電腦,透過網路相互連接傳遞訊息與通訊後並協調它們的行為而形成的系統。[組件之間彼此進行互動以實現一個共同的目標。把需要進行大量計算的工程資料分割成小塊,由多台電腦分別計算,再上傳運算結果後,將結果統一合併得出資料結論的科學。

    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
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    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