Spring Boot Project 1주차 회고
1. Classes naming: 단수 또는 복수
- 생성자 매개변수가 많다면 빌더를 고려하라. (이펙티브 자바:아이템 2)
before
//DTO
public UsersForm mappingUsersForm() {
UsersForm usersForm = new UsersForm();
usersForm.setId(getId());
usersForm.setEmail(getEmail());
usersForm.setNickname(getNickname());
return usersForm;
}
//DTO
public ProfileForm mappingProfileForm() {
ProfileForm profileForm = new ProfileForm();
profileForm.setEmail(getEmail());
profileForm.setNickname(getNickname());
return profileForm;
}
//DTO
public ProfileSettingForm mappingProfileSettingFormWithPassword() {
ProfileSettingForm profileSettingForm = new ProfileSettingForm();
profileSettingForm.setEmail(getEmail());
profileSettingForm.setNickname(getNickname());
return profileSettingForm;
}
//Entity
public User createNewUser(JoinForm joinForm) {
User user = new User();
user.setNickname(joinForm.getNickname());
user.setEmail(joinForm.getEmail());
user.setPassword(joinForm.getPassword());
usersRepository.save(user);
return user;
}after
3. 객체의 책임과 역할
before
after
4.Spring Annotation
6. 네이밍
- 계층 별 네이밍 통일
before
after
7. URL
- Http Request Method 자체도 의미를 가진다.
- RESTful Web Service HTTP methods 더 이해하기 좋다.
before
url
method
기능
after
url
method
기능
- Idempotent Methods 멱등성
8. @Nested
@Nested- @Nestedannotation을 사용하여 중첩된 테스트 클래스를 만들 수 있습니다.
@Nestedannotation을 사용하여 중첩된 테스트 클래스를 만들 수 있습니다.before

after

Last updated