Skip to content

[BCSD Lab] 박종범 4차시 미션 제출합니다. #76

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

Merged
merged 12 commits into from
Aug 17, 2025

Conversation

asa9874
Copy link

@asa9874 asa9874 commented Aug 12, 2025

4차시 미션 제출입니다.

  • 책임분리로 메서드 동작을 한눈에 보기 쉽게만드는것에 집중하여 작성하였습니다.

Copy link

@ImTotem ImTotem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

깔끔하네요 👍 👍 👍
질문 하나 적어두었어요! 의견 부탁드려요 :)

throw new IllegalArgumentException("실행 결과는 비어있을 수 없습니다.");
}
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newline :)

.limit(length)
.toList();
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newline :)


package util;

public class LadderVaildator {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

검증 로직의 위치는 사람마다 다른거 같아요.

지금까지 spring 사용해오던 방식대로는 validate 로직은 검증 대상(여기서는 Ladder)의 외부에 존재하는게 익숙한 것 같아요. 그런데 객체지향적으로 보면 검증 대상의 내부에 있는게 맞는 것 같아요.

개인적으로는 여러곳에서 범용적으로 사용되는 공통적인 validate 로직만 Validator로 분리하고, 나머지는 클래스 내부에 선언하는 방식을 선호해요.

validate의 위치에 대해 어떻게 생각하시나요? 의견이 궁금합니다!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저는 가능하면 분리하는 방향을 선호하는거같아요.
저는 validate로직을 쓸때 if 문-> throw 형식을 자주 사용해서 코드가 길어지는 편인데,
클래스 내부에 위치하게 되면 클래스 코드가 너무 길어보여서 읽기가 힘든느낌을 받은거같아요.

저도 생각해보니 짦게 검증로직이 나올때는 객체 안에 짧게 정의해두는거같은데, 여러 객체들이 있을때는
길어지는 검증로직이 나오는 객체가 있을때를 대비해서 일관성을 위해 검증로직이 있으면 객체마다 validate클래스를 각각만들어두는거같아요

@boorownie boorownie merged commit 1fba16d into next-step:asa9874 Aug 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants