Joe Hsu
    • 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
    • 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
    • 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
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
  • 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
    1
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # How to rewrite, a bit at a time ###### tags: `ddd` ###### 參考: [How to rewrite, a bit at a time - Sabrina Leandro - DDD Europe 2019](https://tinyurl.com/y4jnmhso) ## 如何開始計劃 有些專案像 monolithic 系統, 把很多功能放在一起, 沒有把物件做很清楚的抽象化. 或者是區分成太多的 feature, 抽象化的物件太細過於複雜. ![](https://i.imgur.com/tpJ78vy.png) ### How to start it? 對於這些現有的複雜系統, 要如何使用 DDD 的技巧來改善呢? 首先要針對幾個問題, 來判別改善的時機跟方法是否正確? ### Is it the right time? 當目前的 product 專案對於 business 是有價值的, 是值得花時間投資在上面去改善它. ### Is it the right reason? 確保自己有良好的理由去改善一個舊有的專案的架構. 如果對於這個專案的 business case 的需求不了解, 最好要先去了解它在進行改寫. 還有一個重點就是公司要能夠有足夠的資源, 人力和時間提供你來改善它. ### How to sell it? 找到一個好的 business case 可以有效地訂出一個明確的目標, 當之後要決定一些決定性的問題也可以幫助你決定. 展現如果專案改善後, 可以有哪些好的益處? 例如, 大幅改善測試流程的效率, 新的框架更好開發之類. #### Make Pain visible 列出專案目前遭遇的問題, 不需要太深的技術細節, 但是需要讓其他人看得出來遇到的點, 幫助其他人理解, 願意花時間與資源來改善它. 在不斷的溝通下建立出一套對於此專案的通用的語言, 讓技術與非技術人員可以理解彼此的想法. ## 如何執行 首先需要在團隊中討論出未來改善的架構是如何? 一開始不需要太深的細節, 只需要對於訂出一些準則與改善流程, 確保團隊人員都知道最後的要達成的目標, 其餘細節會隨著改善的時間推進來持續反覆檢視與修正. ![](https://i.imgur.com/RlVdE3I.png) ### 流程 #### scratch ![](https://i.imgur.com/7YJGAdO.png) 一個 team 繼續維護就有的專案, 另一個 team 進行改寫, 直到新的專案改寫完成, 舊有的專案就可以丟棄了. 但是這種開發流程有很多問題. 因為這樣的開發只有在完成新的應用出來, 價值才會被顯現出來. 而且有可能在開發過程, 公司新的方針改變有可能需要回頭修正與改寫, 需要花費許多的時間. #### stranger **strangler fig** 是一種寄生植物, 以附生來開始它的生長,然後通過根莖的成長成為獨立生活的植物,並採用擠壓、攀抱、纏繞等方式盤剝寄樹營養,剝奪寄樹的生存空間,從而殺死寄樹. ![](https://i.imgur.com/SaIOwBa.jpg) 作者用這種植物作為比喻, 來解釋另一種開發流程: ![](https://i.imgur.com/FupEIDF.png) 繼續維護原有的專案, 慢慢把裡面重要的 feature 抽出來改寫. 每改完一個 feature 舊專案都能使用其帶來的優點. 直到所有 feature 更改完成, 舊有的專案也已經變成新的改良的專案了. 這種開發流程也是演講者所推薦的,下面用兩張圖來解釋: ![](https://i.imgur.com/URxmEaq.png) 針對 customers 的 feature 進行改寫 new/customers並且進行相關測試. ![](https://i.imgur.com/Dctt7G9.png) 經過完整的測試後, 就可以直接轉移到使用新的 customers 功能. 接下來就是依照這個過程不斷的改良舊專案. :::info 1. 建立要改善的功能 2. 驗證 3. 取代舊有功能 4. 刪除舊有的功能 5. 回到第一步 ::: ### Cut features to move faster 檢視功能的重要性讓開發更快推進. 必要的功能 ,有時間可以做的功能, 無用的功能直接移除. 有時刪掉直接重寫還比較快. * Must haves: main proportion * Should haves: if there's time * Won't haves: remove completely :::warning If we were starting over, what would we build today, Knowing what we know now? ::: 再重複這些過程中, 我們應該知道我們現在在幹嘛. ## 改善的過程 ### How to run it :::info Do one thing at a time ::: 找出專案的問題點, 以此制定一個主要的目標, 並有一個實際的計畫去完成它. **1. Find the biggest blocker 2. Remove it completely 3. Repeat** 和業務團隊與客戶了解哪些是必要的功能, 哪些不必要可以移除. ### complete feature :::success **經過漫長的改善終於完成改善計畫, 別忘了好好慶祝** ::: ![](https://i.imgur.com/jPutgas.png) 演講者團隊設計師還設計出幾個有趣的徽章, 給完成項目的團隊員工. ## 如何完結 ### 如何不再需要改寫 * **Make the cost visible** 當程式開始運行後, 別忘了還需要繼續維護. 維護也是需要花費精力, 所以需要定時和 PM 討論哪些功能需要繼續維護, 哪些可以屏除. ![](https://i.imgur.com/TVXzazd.png) 我覺得這點很重要, 就是沒用的 code 要刪掉, 而不是註解放在那邊, 那些通常會讓程式碼變得更難被解讀. 有些過渡期的 feature 和產品需要被移除也是常見的. * **Make it part of your day-to-day** 保持每天持續檢視專案與小小改善, 這樣就不會又需要重新改寫. :::success A refactor a day keeps rewrite away! ::: * **A little bit and often** * **Get used to inconsistencies** 使用 version control 工具去不斷改善 code, 要習慣code 在 merge 後有時會有不一致的情況發生,去解決 code 的衝突.

    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