GNU social JP
  • FAQ
  • Login
GNU social JPは日本のGNU socialサーバーです。
Usage/ToS/admin/test/Pleroma FE
  • Public

    • Public
    • Network
    • Groups
    • Featured
    • Popular
    • People

Conversation

Notices

  1. Embed this notice
    WanCW (wancw@g0v.social)'s status on Sunday, 25-Jun-2023 12:28:20 JST WanCW WanCW

    【網摘】該不該用、怎麼用 Repository pattern? https://youtu.be/01lygxvbao4

    1. 只在「改變狀態」的時候用 Repository ,它負責讀、寫整包 Aggregate。application 只操作 Aggregate root,用以確保「商業邏輯」(invariants)

    2. 讀取的部分直接操作 ORM、DB 即可 ⬅️ 每個 use case 需要的資料都不一樣,要嘛是每個 use case 除了在 service 也必須在 repository 有一個對應 function;要嘛是寫一個很萬用的 repository 抽象層。但 query 不會變更系統狀態,我們可以用比較簡單的方式做就好。

    3. 「改變狀態」跟「純查詢」的架構明顯不同,應該分開在不同 service 實作。

    In conversation Sunday, 25-Jun-2023 12:28:20 JST from g0v.social permalink

    Attachments

    1. Should you use the Repository Pattern? With CQRS, Yes and No!
      The repository pattern is polarizing. Some developers swear you should always use it to abstract data access logic while others think it's unnecessary if you...

    Feeds

    • Activity Streams
    • RSS 2.0
    • Atom
    • Help
    • About
    • FAQ
    • TOS
    • Privacy
    • Source
    • Version
    • Contact

    GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.

    Creative Commons Attribution 3.0 All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.