Lee kyun heang
    • 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
    # Lust3r & Jason PR 작성 위는 제목입니다. 아래부터 작성하세요. ---- ## 🤔 고민과 해결 ### Lust3r - Protocol과 function, Dictionary, Singleton 등 학습 내용이었지만 확실히 알지 못해 코드로 표현하는데 있어 힘들었지만 천천히 시간을 갖고 개념을 이해하니 처음보다는 사용하는데 익숙해졌습니다. - 중복되는 코드를 어떻게 뺄 수 있을까에 대해 고민을 했었는데, 메서드화 하거나 foreach, switch를 통해 공통되는 부분을 따로 빼서 작업할 수 있음을 배웠습니다. ### Jason - SOLID를 학습하고 DIP(의존성 역전 윈칙)를 사용해보고싶었습니다. 하여 아래와 같이 코드를 구현해보았습니다. 사용하면서 예시와 동일하게 올바르게 사용했다고 생각이 드는데 제이크가 보시기에는 어떠실까요?? 올바르게 사용했는지 궁금합니다🤔..!! ```Swift // 인스턴스 생성하여 대입? let calculator = Calculator() let juiceMaker = JuiceMaker(calculator: calculator) // 호출부? struct JuiceMaker: Makeable { let fruitStore = FruitStore.shared let calculator: Computable init(calculator: Computable) { self.calculator = calculator } // 구현부 struct Calculator: Computable { func add(number1: Int, number2: Int) -> Int { return number1 + number2 } func subtract(number1: Int, number2: Int) -> Int { return number1 - number2 } func compare(type: FruitList, isRemainCount: Bool) -> Bool { if isRemainCount == false { switch type { case .strawberry: print(StockError.notEnoughStrawberryStock) case .banana: print(StockError.notEnoughBananaStock) case .kiwi: print(StockError.notEnoughKiwiStock) case .pineApple: print(StockError.notEnoughPineAppleStock) case .mango: print(StockError.notEnoughMangoStock) } } return isRemainCount } } ``` - [프로젝트에 관하여..] 이번 프로젝트를 진행하면서 짝프로그래밍으로 커밋을 번갈아가며 진행하려고했었습니다. 처음에 설계부터 진행하는데 저의 경우에는 조금 선행학습을 한 부분이 있어서 코드 구현에 대해서는 대부분 저의 표현방식으로 많이 녹아들어있습니다...😅 그래도 최대한 Lust3r와 같이 진행하려고하다보니 기능별로 구현하는데 이해를 하고나서 작성하다보니 이번 Step1의 진행사항이 느렸지만 최대한 같이 맞추어가보려고 노력하였습니다. 커밋의 순서를 보았을때 불편하게 보이실 수도 있다고 생각되어 회고처럼 작성하였습니다. ## 🙋🏻 질문 거리 ### Lust3r - 각 역할을 명확히 하고 결합도를 낮추기 위해 메서드를 따로 빼내고, 파일화 하는 과정이 있었습니다. 한 파일에 모든 코드가 있는 것보다는 한 눈에 보기도 편하고 관리하기에도 좋았습니다. 하지만 여러 메서드를 불러오는 경우에는 한 로직을 관리하기 위해 그 메서드가 들어 있는 여러 파일들을 전부 확인을 해야하는 소요가 있었습니다. 작은 프로젝트에서도 이정도 규모인데 큰 프로젝트의 경우엔 이렇게 분리하다보면 파일이 배는 더 많을 것으로 생각됩니다. 그런 상황에서 기존 코드를 유지보수 할 때 쉽게 알아보는 팁같은 것이 있을까요? ### Jason - 이번에 코드를 작성하면서 반복되는 부분을 되도록 Dictionary의 Key값을 사용하여 해결해보려고 하였습니다. 하여 처음에는 `requestTo(single:)`메서드와 `requestTo(mix:)`메서드를 어떠한 값을 `FruitList`와 `FruitSingleJuice, MixJuice`에 case를 추가하여도 로직에 변경이 없도록 해보려고 하였습니다! 구현하면서 궁금했던 부분은 아무래도 Switch-Case 구문을 너무 많이 사용하는 느낌이 들어 반복되는 Switch-Case를 줄여보고싶었는데 현재까지의 역량으로는 좋은 방법이 떠오르지않아 질문드립니다! 개인적인 해결방법으로는 메서드의 프로퍼티와 반환값을 묶어서 사용하면 어떨까?? 했었는데 아무래도 하나의 기능에 너무 많은 기능이 들어가게되면 SRP(단일 책임 원칙)에 위배되는 것 같다고 생각이 들었습니다.

    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