https://github.com/mylotto0626/Sparta_Spring_todoApp
GitHub - mylotto0626/Sparta_Spring_todoApp: 스파르타 내일배움캠프 스프링 숙련 주차 개인과제 레포지토리
스파르타 내일배움캠프 스프링 숙련 주차 개인과제 레포지토리. Contribute to mylotto0626/Sparta_Spring_todoApp development by creating an account on GitHub.
github.com
📌 피드백 받은 내용
1) TodoService에서 의존시 Autowired 방식 말고 @RequiredArgsConstructor 의 롬복방식으로 final 객체로 안전하게 선언할 수 있도록 변경
2) API설계시 단수보다는 복수로 설계 예시) /api/todo -> /api/todos
3) Entity에서는 setter를 지양하자
➡️ 명확한 값의 의도 파악이 어려움, 캡슐화 원칙의 위배, 객체의 불변성 위배 등 이유가 존재
예시)
@Builder public Todo(Long todoId, User user, String title, String content, LocalDateTime createdAt, LocalDateTime updatedAt, String weather, Set<Comment> comments, Set<User> assignedUsers) {
this.todoId = todoId;
this.user = user;
this.title = title;
this.content = content;
this.createdAt = createdAt;
this.updatedAt = updatedAt;
this.weather = weather;
this.comments = comments;
this.assignedUsers = assignedUsers;
}
4) updatedAt, createAt 해당 엔티티 필드는 별도의 공통 엔티티로 만들어서 다른 엔티티들이 상속받아서 사용할 수 있게!
public class BaseEntity {
@Column(nullable = false)
private LocalDateTime createdAt;
@Column(nullable = false)
private LocalDateTime updatedAt;
}
public class Todo extends BaseEntity { ... }
5) Exception 처리는 별도의 Custom Exception 처리 방식
잘한점
Optional을 통해 NPE 방지를 잘 했고, 10단계까지 단계별 구현을 완료.
공부해야 할 점
✅ 비지니스 로직에 대한 validation 체크, 예외처리
✅ 로직들에 대한 주석처리
✅ README가 더 상세하게 정리 되었다면 더욱 좋은 코드!
오늘 한 일
✅ Spring 숙련 주차 강의 마저 듣기
✅ 포트폴리오 정리 사이트를 업데이트 했다
포트폴리오 | My Site 1
About Me. This is your About section. Every website has a story and users want to hear yours. This is a great opportunity to give a full background on who you are and what your site has to offer. Double click on the text box to edit the content and add all
www.tj-dev.com
'내배캠_Java 6기' 카테고리의 다른 글
20241014 ~ 20241018 스프링 심화주차 트렐로 프로젝트 팀원 kpt 회고 (1) | 2024.10.18 |
---|---|
20241011 캠프 플러스 심화 주차 개인과제 트러블슈팅/회고 (1) | 2024.10.11 |
20240821_캠프 6주차 3일 스프링 숙련과제 시작 (0) | 2024.08.22 |
20240820_캠프 6주차 2일_TIL_Spring 입문 JPA 공부중 (0) | 2024.08.20 |
20240813_캠프 5주차 2일_스프링 개인과제 (0) | 2024.08.14 |