GithubHelp home page GithubHelp logo

object's People

Contributors

kimkyunghun3 avatar cherrishred avatar

Stargazers

Kaui avatar

object's Issues

Objects 1장, 2장

1. Invitation 타입

  • TDA ( Tell, Don't Ask )
  • private(set) 프로퍼티로 표현 vs method로 표현
private(set) var fee: Int
  • 프로퍼티에 직접 접근 -> 캡슐화 제대로 되지 않음 -> 좋지 않은 것 같다.
private let fee: Int

func getFee() -> Int {
    return self.fee
}
  • 프로퍼티 완전은닉, 메서드로만 값 얻음 -> 더 좋은 것 같다.

2. 프로퍼티가 let인데 옵셔널이면 nil로 초기화해야 한다.

3. init

  • 클래스에서
    init(amount: Int, invitation: Invitation?) {
        self.amount = amount
        self.invitation = invitation
    }
    
    convenience init(amount: Int) {
        self.init(amount: amount, invitation: nil)
    }

convenience initdesignated init을 꼭 호출해야 한다.
아래 코드와 달리 코드 중복을 막을 수 있다.

  • 구조체에서
    init(amount: Int, invitation: Invitation) {
        self.amount = amount
        self.invitation = invitation
    }

    init(amount: Int) {
        self.amount = amount
        self.invitation = nil
    }
  • 구조체는 convenience init 사용 불가

4. [배열], ... 사용법의 차이 구별

  • 메서드 내부에서는 ...가 배열로 바꾸지만 인자로 전달할 때 다르다.
  • 배열은 인자 1개, ...는 인자 0개 이상을 전달하는 것

5. TicketSeller와 TicketOffice간의 관계에 대해 의견을 나눔, 누가 누구를 가지는 것이 맞는가? (vs Audience와 Bag의 관계)

6. 자율성과 결합도간의 트레이드 오프

7. p.68 개념적 결합으로 생기는 문제가 무엇인가?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.