Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] 익명 내부 클래스의 실제 활용 빈도 #7

Open
sojeongw opened this issue Jan 22, 2020 · 4 comments
Open

[Question] 익명 내부 클래스의 실제 활용 빈도 #7

sojeongw opened this issue Jan 22, 2020 · 4 comments
Labels
question Further information is requested

Comments

@sojeongw
Copy link

sojeongw commented Jan 22, 2020

Topic

실제로 현업에서는 익명 내부 클래스를 자주 쓰나요?
여러분은 익명 내부 클래스를 어떻게 생각하나요?

Detail

3장 [템플릿]은 컨텍스트 메소드에서 바로 전략 클래스를 생성할 때
익명 내부 클래스를 활용하는 방법을 소개하고 있습니다.

스프링을 하면서 여러 샘플 코드를 봤지만 익명 내부 클래스는 잘 보지 못한 것 같아요.
아무래도 가독성이 떨어지고 초심자는 사용하기 어려운 문제 때문에 잘 사용하지 않는 걸까요?
아니면 제가 좋은 예제를 그동안 접하지 못한 것일까요?

여러분의 익명 내부 클래스에 대한 생각은 어떠한지도 궁금합니다.

제 경우, 처음에는 학부 때 개념적으로만 접한 내용이라 복잡해서 많이 당황했습니다.
하지만 서너번 읽다보니 한 번 쓰고 말 내용에는 유용할 것 같다는 생각이 들더라구요.

다만, 누군가와 코드를 공유하고 협업해야 한다면 그 실용성이 얼마나 될지 의문입니다.
그저 제가 익숙하지 않은 탓일까요? 익숙한 고수들은 익명 내부 클래스를 더 선호할까요?

@sojeongw sojeongw added the question Further information is requested label Jan 22, 2020
@als95
Copy link

als95 commented Jan 22, 2020

저도 학부 때 익명 클래스는 재사용하기 힘들어서 가급적 사용하지 말라고 배웠었습니다.
익명 클래스를 실제로 많이 사용하는지, 사용한다면 어떠한 주의 사항이 있는지도 궁금합니다!

@zeroFruit
Copy link
Member

그래서 1.8에 람다라는 것이 등장한 것으로 알고 있습니다!

@sojeongw
Copy link
Author

답변 감사합니다 :)

@boohyunsik
Copy link

boohyunsik commented Jan 26, 2020

람다를 활용하여 밥 먹듯이 씁니다!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants