woowacourse / tecoble-comments

0 stars 0 forks source link

tecoble/post/2020-04-28-ask-instead-of-getter/ #6

Open utterances-bot opened 4 years ago

utterances-bot commented 4 years ago

getter를 사용하는 대신 객체에 메시지를 보내자 | javable

getter는 멤버변수의 값을 호출하는 메소드이고, setter는 멤버변수의 값을 변경시키는 메소드이다.

https://woowacourse.github.io/tecoble/post/2020-04-28-ask-instead-of-getter/

hojinDev commented 4 years ago

글을 재밌게 잘 쓰시네요.

오타인것 같아 제보합니다. findMaxPositionCar 선언했는데 getMaxPositionCar 를 호출하고 있습니다.

hojinDev commented 4 years ago

오타 제보 findMaxPositionCar 선언했는데 getSameCars 를 호출합니다.

또 하나 오타는 아닌데

return cars.stream()
            .filter(car -> car.isSamePosition(maxPositionCar))
            .map(Car::getName)
            .collect(Collectors.toList());

여기서

return cars.stream()
            .filter(maxPositionCar::isSamePosition)
            .map(Car::getName)
            .collect(Collectors.toList());

이렇게 사용 안하신 이유가 궁금합니다.

YerinCho commented 4 years ago

굳이 메소드 참조를 사용하지 않은 이유는... 크게 이유는 없어요. 메소드 참조를 사용하는게 코드 보기 더 편하겠네요. 오타 제보와 댓글 감사합니다.☺️👍

jinan159 commented 2 years ago

좋은글 감사합니다~👍👍 잘보고가요!!

0chil commented 2 years ago

검색했다가 잘보고 갑니다. 좋은 글 잘보고 가요!

charlesuu commented 1 year ago

프리코스 피드백 통해서 왔는데 내용 정말 좋네요!! 감사합니당

bearjun05 commented 1 year ago

한번도 생각해 보지 못한 주제라 왜 그래야 하는지 이해하는데 시간이 좀 걸렸지만, 좋은 내용 얻어 간 것 같습니다 감사합니다!

constant94-dev commented 7 months ago

프리코스를 진행하면서 getter 를 사용하지 않는다 의도를 고민하고 있었는 데 이런 내용이 있었네요. 글 공유 감사합니다!