code
stringlengths
41
34.3k
lang
stringclasses
8 values
review
stringlengths
1
4.74k
@@ -0,0 +1,119 @@ +package christmas.validator; + +import christmas.domain.order.menu.Menu; +import christmas.dto.request.OrderRequest; +import christmas.util.InputUtil; +import christmas.exception.ErrorMessage; + +import java.util.Arrays; +import java.util.List; +import java.util.regex.Pattern; + +public class InputVa...
Java
현재 InputValidator 객체에서 사용되는 메소드들은 대부분 특정 도메인의 유효성 검사를 위해 사용되고 있는데 인스턴스 메소드로 사용하는건 어떠신가요??
@@ -0,0 +1,40 @@ +package christmas.domain.order.menu; + +import christmas.validator.OrderValidator; + +import java.util.Objects; + +public class Quantity { + + private final Integer quantity; + + private Quantity(Integer quantity) { + validate(quantity); + this.quantity = quantity; + } + + pu...
Java
큰 의미가 있는 것은 아니고, null 처리에 대비하여 Integer를 사용하게 되었습니다. 사실 입력값 검증 로직이 이미 있어서 null이 들어갈 일은 없을 것 같기도 하네요!
@@ -0,0 +1,119 @@ +package christmas.validator; + +import christmas.domain.order.menu.Menu; +import christmas.dto.request.OrderRequest; +import christmas.util.InputUtil; +import christmas.exception.ErrorMessage; + +import java.util.Arrays; +import java.util.List; +import java.util.regex.Pattern; + +public class InputVa...
Java
여태 크게 생각을 안 했던 부분인데, 아무래도 static을 붙여서 아무데서나 쓸 수 있게 하는 것보다는 필요한 곳에서만 불러와서 사용하는 편이 장점이 있겠네요! 좋은 의견 감사합니다 😄
@@ -0,0 +1,63 @@ +package christmas.controller; + +import christmas.domain.PromotionService; +import christmas.domain.order.Day; +import christmas.domain.order.Order; +import christmas.dto.response.DiscountPreviewResponse; +import christmas.view.InputView; +import christmas.view.OutputView; + +import java.util.function...
Java
아...! 제가 인텔리제이의 메소드 분리 단축키인 option + command + v를 자주 사용하는데, 그 과정에서 자동으로 static 메소드로 선언된 것 같습니다. 전부 지워야겠네요 😂
@@ -0,0 +1,40 @@ +package christmas.domain.order; + +import christmas.validator.OrderValidator; + +import java.util.Objects; + +public class Day { + + private final Integer day; + + private Day(Integer day) { + validate(day); + this.day = day; + } + + public static Day create(Integer day) { + ...
Java
각 VO에서 이루어지는 검증을 한 군데에서 모아 관리하면 편리할 것이라 생각하였는데, 말씀주신 것처럼 캡슐화가 깨지는 문제도 있을 뿐더러 OrderValidator 객체가 비대해진다면 결국에 로직을 분리해야할 것이고 이러면 한 곳에서 관리할 수 있다는 장점 또한 사라질 것 같습니다. 결국에는 제일 관련성이 깊은 VO 내부에서 유효성 검사를 하는 것이 맞겠네요! 좋은 조언 감사합니다 😄
@@ -0,0 +1,74 @@ +package christmas.domain.order; + +import christmas.domain.order.menu.Menu; +import christmas.domain.order.menu.Quantity; +import christmas.dto.request.OrderRequest; +import christmas.dto.response.OrderResponse; +import christmas.util.InputUtil; +import christmas.validator.OrderValidator; + +import ja...
Java
저도 지금 봤네요ㅋㅋㅠㅠ private 선언해야 되는데 까먹은 것 같습니다 🤣
@@ -0,0 +1,70 @@ +package christmas.domain.order.menu; + +import java.util.Arrays; +import java.util.Map; + +public enum Menu { + + // 기타 + NONE("없음", 0, MenuType.NONE), + + // 에피타이저 + MUSHROOM_SOUP("양송이 스프", 6_000, MenuType.APPETIZER), + TAPAS("타파스", 5_500, MenuType.APPETIZER), + CAESAR_SALAD("시저 샐러드...
Java
메뉴 Enum에도 이런 식으로 인터페이스를 적용할 수 있는데 생각하지 못했네요! 참고하겠습니다...!
@@ -0,0 +1,67 @@ +import { Button, Form, Input, Select, Space } from 'antd'; +import { REVIEW_CYCLE_FORM_NAMES, REVIEW_CYCLE_RULES } from './constants'; +import useMembers from '@apis/review/useMembers'; +import { ReviewCycleRequest } from '@apis/review/type'; +import { ReviewCycle } from '@apis/review/entities'; + +in...
Unknown
요기 `form`은 없어도 될 것 같아요~
@@ -0,0 +1,67 @@ +import { Button, Form, Input, Select, Space } from 'antd'; +import { REVIEW_CYCLE_FORM_NAMES, REVIEW_CYCLE_RULES } from './constants'; +import useMembers from '@apis/review/useMembers'; +import { ReviewCycleRequest } from '@apis/review/type'; +import { ReviewCycle } from '@apis/review/entities'; + +in...
Unknown
오 이런 방식으로 타이핑 하면 `initialValues`에 대한 타입을 따로 만들어주지 않아도 되고 좋네요 👍
@@ -0,0 +1,17 @@ +import { Rule } from 'antd/lib/form'; + +export const REVIEW_CYCLE_FORM_NAMES = { + name: 'name', + reviewees: 'reviewees', + question: { + title: 'title', + description: 'description', + }, +} as const; + +export const REVIEW_CYCLE_RULES: Record<string, Rule[]> = { + reviewCycleName: [{ re...
TypeScript
요기 상수는 따로 빼신 이유가 뭘까요? `Form.Item`의 `name` 외에는 사용되지 않는 것 같은데 `label`처럼 바로 넣어도 좋아보여요! 아니면 label, name, rule을 하나로 묶어도 좋을 것 같구요! 가볍게 드는 생각 남겨봅니다~
@@ -0,0 +1,90 @@ +import { API_PATH } from '@apis/constants'; +import { useQuery } from '@apis/common/useQuery'; +import { ReviewCycle } from './entities'; +import { ReviewCycleRequest, ReviewCycleResponse } from './type'; +import { useDelete, usePost, usePut } from '@apis/common/useMutation'; +import { get } from 'lod...
TypeScript
[질문] `trigger`를 바로 넘기지 않고 함수로 넘겨주는 이유는 타입을 고정시키기 위함일까요?
@@ -0,0 +1,37 @@ +import useModal from 'hooks/useModal'; +import { Headline4 } from 'styles/typography'; +import ReviewCycleForm from '../ReviewCycleForm'; +import { message } from 'antd'; +import { useCreateReviewCycle, useGetReviewCycles } from '@apis/review/useReviewCycles'; + +function useReviewCycleCreateModal() {...
Unknown
요런 식으로 기존 `modal`을 확장하는 훅으로 만들어도 좋을 것 같아요~ ```suggestion return { ...modal, render, }; ```
@@ -0,0 +1,25 @@ +import { DeleteOutlined } from '@ant-design/icons'; +import { useDeleteReviewCycle, useGetReviewCycles } from '@apis/review/useReviewCycles'; +import { message } from 'antd'; + +function DeleteButton({ entityId }: { entityId: number }) { + const { refetchReviewCycle } = useGetReviewCycles(); + const...
Unknown
[질문] `e.stopPropagation()`의 의도가 무엇인가요?
@@ -0,0 +1,10 @@ +import { Member, ReviewCycle } from './entities'; + +export type ReviewCycleRequest = { + name: ReviewCycle['name']; + reviewees: Member['entityId'][]; + title: string; + description: string; +}; + +export type ReviewCycleResponse = Pick<ReviewCycle, 'entityId'>;
TypeScript
[제안] 이것과 entities의 타입을 일부 공통으로 사용해볼 수는 없으려나요? 같은 맥락을 담고 있는 타입인데 맥락이 아예 분리되어서 나중에 유지보수할 때 주의해야겠다는 생각이 드네요
@@ -0,0 +1,67 @@ +import { Button, Form, Input, Select, Space } from 'antd'; +import { REVIEW_CYCLE_FORM_NAMES, REVIEW_CYCLE_RULES } from './constants'; +import useMembers from '@apis/review/useMembers'; +import { ReviewCycleRequest } from '@apis/review/type'; +import { ReviewCycle } from '@apis/review/entities'; + +in...
Unknown
[적극] ui를 렌더링하기 위한 buttonProps가 객체형태로 내려가면 나중에 유지보수차원에서 어려움이 있을 것 같은데 방법이 없으려나요?? confirmButtonProps나 deleteButtonProps는 Form이라는 맥락에서는 안에 들어가도 될 것 같다고 판단할 수도 있으나 실제 렌더하는 쪽에서는 prop을 꺼내쓰는 차원에 불과해서 어떻게든 분리가 되면 좋겠다는 생각이 들어요.
@@ -0,0 +1,28 @@ +import { faker } from '@faker-js/faker'; +import { personList } from '@mocks/auth/data'; +import { v4 as uuidv4 } from 'uuid'; + +const personCount = personList.length; + +export const reviewCycleList = Array.from({ length: 10 }, (_, i) => ({ + entityId: uuidv4(), + name: faker.lorem.words(), + cre...
TypeScript
`faker` 라이브러리 적절히 잘 쓰시네요 👍
@@ -0,0 +1,25 @@ +import { DeleteOutlined } from '@ant-design/icons'; +import { useDeleteReviewCycle, useGetReviewCycles } from '@apis/review/useReviewCycles'; +import { message } from 'antd'; + +function DeleteButton({ entityId }: { entityId: number }) { + const { refetchReviewCycle } = useGetReviewCycles(); + const...
Unknown
[적극] 버튼인데 버튼이 아닌 컴포넌트가 된 것 같아요. 아이콘에 클릭이벤트를 다는 것에 대해서는 어떻게 생각하시나용? role=button이 되도록 해야하나 하는 판단이 드네요
@@ -0,0 +1,163 @@ +import { Person, personIDMap, personMap } from './../auth/data'; +import { API_PATH } from '@apis/constants'; +import { personList } from '@mocks/auth/data'; +import { HttpResponse, http } from 'msw'; +import { reviewCycleList } from './data'; +import { ReviewCycleRequest } from '@apis/review/type'; ...
TypeScript
여기는 스코프가 넓으니 `r`보다는 `reviewCycle`으로 네이밍 하는 것이 좋을 것 같아요~
@@ -0,0 +1,43 @@ +import { Button } from 'antd'; +import { RoundContent } from 'components/common/RoundContent'; +import useReviewCycleCreateModal from './ReviewCycleModals/useReviewCycleCreateModal'; +import ReviewCycleTable from './ReviewCycleTable'; +import useReviewCycleUpdateModal from './ReviewCycleModals/useRevi...
Unknown
[적극] 인스턴스는 camelcase가 되면 좋겠습니다!
@@ -0,0 +1,163 @@ +import { Person, personIDMap, personMap } from './../auth/data'; +import { API_PATH } from '@apis/constants'; +import { personList } from '@mocks/auth/data'; +import { HttpResponse, http } from 'msw'; +import { reviewCycleList } from './data'; +import { ReviewCycleRequest } from '@apis/review/type'; ...
TypeScript
`r`이 중복 변수라 여기는 `m`이 되었군요.. `r`을 `reviewCycle`로 바꾸면 여기는 `r`이어도 괜찮아보입니다. 혹은 좀 더 명확히 `reviewee`어도 좋겠구요! 취향 차이일 수 있겠지만 개인적으로는 한 줄 정도의 스코프일 때는 축약 변수 사용해도 크게 가독성을 해치지 않아 괜찮다고 생각해요~
@@ -0,0 +1,163 @@ +import { Person, personIDMap, personMap } from './../auth/data'; +import { API_PATH } from '@apis/constants'; +import { personList } from '@mocks/auth/data'; +import { HttpResponse, http } from 'msw'; +import { reviewCycleList } from './data'; +import { ReviewCycleRequest } from '@apis/review/type'; ...
TypeScript
[제안] 요대로 `push`를 하면 맨 뒤에 들어가게 돼서 최신순으로 보이지 않게 되더라구요~ 정렬을 한 번 해 주면 좋을 것 같습니다!
@@ -0,0 +1,10 @@ +import { Member, ReviewCycle } from './entities'; + +export type ReviewCycleRequest = { + name: ReviewCycle['name']; + reviewees: Member['entityId'][]; + title: string; + description: string; +}; + +export type ReviewCycleResponse = Pick<ReviewCycle, 'entityId'>;
TypeScript
음 아래처럼 타이핑하면 같은 맥락임이 잘 드러나려나요? ```ts export type ReviewCycleRequest = { name: ReviewCycle['name']; reviewees: Member['entityId'][]; title: string; description: string; }; export type ReviewCycleResponse = Pick<ReviewCycle, 'entityId'>; ```
@@ -0,0 +1,90 @@ +import { API_PATH } from '@apis/constants'; +import { useQuery } from '@apis/common/useQuery'; +import { ReviewCycle } from './entities'; +import { ReviewCycleRequest, ReviewCycleResponse } from './type'; +import { useDelete, usePost, usePut } from '@apis/common/useMutation'; +import { get } from 'lod...
TypeScript
이 부분은 SWR 기반의 인터페이스(trigger)를 감추고 인터페이스를 통일하기 위한 목적이었어요. 추후에 SWR을 tanstack-query 등 다른 라이브러리로 변경하더라도 동일하게 createReviewCycle 인터페이스를 사용하도록 해서 사용처에서는 코드를 수정할 필요가 없도록 하고자 했습니다.
@@ -0,0 +1,17 @@ +import { Rule } from 'antd/lib/form'; + +export const REVIEW_CYCLE_FORM_NAMES = { + name: 'name', + reviewees: 'reviewees', + question: { + title: 'title', + description: 'description', + }, +} as const; + +export const REVIEW_CYCLE_RULES: Record<string, Rule[]> = { + reviewCycleName: [{ re...
TypeScript
해당 form의 요소가 어떻게 구성되어 있는지 한눈에 파악하기 쉽지 않을까 했었는데, 하나의 객체로 묶는게 나았으려나 싶군요!
@@ -0,0 +1,25 @@ +import { DeleteOutlined } from '@ant-design/icons'; +import { useDeleteReviewCycle, useGetReviewCycles } from '@apis/review/useReviewCycles'; +import { message } from 'antd'; + +function DeleteButton({ entityId }: { entityId: number }) { + const { refetchReviewCycle } = useGetReviewCycles(); + const...
Unknown
현재 테이블 onRowClick 시 리뷰 사이클 수정 모달이 열리도록 이벤트를 등록해두었는데요, 삭제 버튼 시에는 이벤트 전파를 막도록 했습니다.
@@ -0,0 +1,25 @@ +import { DeleteOutlined } from '@ant-design/icons'; +import { useDeleteReviewCycle, useGetReviewCycles } from '@apis/review/useReviewCycles'; +import { message } from 'antd'; + +function DeleteButton({ entityId }: { entityId: number }) { + const { refetchReviewCycle } = useGetReviewCycles(); + const...
Unknown
넵 button으로 감싸는게 좋겠군요. > 반영했습니다! [refactor: 삭제 버튼 구조 변경](https://github.com/lemonbase-labs/journee-on-boarding-project/pull/7/commits/2201091e80c11c71bb97c3cf131410067cb04478)
@@ -0,0 +1,67 @@ +import { Button, Form, Input, Select, Space } from 'antd'; +import { REVIEW_CYCLE_FORM_NAMES, REVIEW_CYCLE_RULES } from './constants'; +import useMembers from '@apis/review/useMembers'; +import { ReviewCycleRequest } from '@apis/review/type'; +import { ReviewCycle } from '@apis/review/entities'; + +in...
Unknown
아하.. 저는 직관적이라고 생각했는데, 유지보수 차원에서 어떤 어려움인지 혹은 어떻게 분리되어야 하는지 좀 더 설명해주실 수 있을까요? 실제로 현재 레몬베이스 모달 훅인 useBasicModal도 비슷한 패턴으로 사용하고 있는데, 저는 유지보수 차원에서 어려움이 있어서 개선해야 한다고 생각하진 않았어서요!
@@ -0,0 +1,43 @@ +import { Button } from 'antd'; +import { RoundContent } from 'components/common/RoundContent'; +import useReviewCycleCreateModal from './ReviewCycleModals/useReviewCycleCreateModal'; +import ReviewCycleTable from './ReviewCycleTable'; +import useReviewCycleUpdateModal from './ReviewCycleModals/useRevi...
Unknown
네!! 반영했습니다! [refactor: 인스턴스 camelcase로 수정](https://github.com/lemonbase-labs/journee-on-boarding-project/pull/7/commits/3a4fecb79aa6c1a53951900d79c308af0a87d940)
@@ -0,0 +1,90 @@ +import { API_PATH } from '@apis/constants'; +import { useQuery } from '@apis/common/useQuery'; +import { ReviewCycle } from './entities'; +import { ReviewCycleRequest, ReviewCycleResponse } from './type'; +import { useDelete, usePost, usePut } from '@apis/common/useMutation'; +import { get } from 'lod...
TypeScript
오호 인터페이스 통일 목적! 이해했습니다~ 고렇다면 같은 파일 [L87](https://github.com/lemonbase-labs/journee-on-boarding-project/pull/7/files#diff-3ab91e36eb619267b0f18915f2e642a8452aece2c4e8220b0bce854dc2e8d68eR87)에 `deleteReviewCycle: trigger`는 요 처리가 누락된 것 같아 같이 반영하면 좋을 것 같아요~
@@ -0,0 +1,19 @@ +import { ShoppingCartIcon } from "../../assets"; +import { BaseButton } from "./BaseButton"; +import { StyledCartButtonImg, StyledCartCount, StyledContainer } from "./CartButton.styled"; + +interface CartButtonProps { + quantity: number; + onClick: () => void; +} + +export const CartButton = ({ quan...
Unknown
애플리케이션이 처음 실행됐을 때 fetch한 이후에는, 담기/빼기 버튼을 눌러도 productCount가 변경되지 않기 때문에 실시간으로 개수를 업데이트하지 못하는 것으로 이해했어요. prop으로 `productCount`값과 `updateProductCount` 함수를 만들어 CartActionButton로 넘겨주고, CartActionButton에서는 action이 일어나면 `updateProductCount`에 바뀐 개수를 CartButton으로 전달하면 업데이트할 수 있을 것 같아요!😊
@@ -0,0 +1,261 @@ +// +// LoginViewController_TVING.swift +// GO_SOPT_Seminar_Assingment +// +// Created by 김다예 on 2023/04/11. +// + +import UIKit + +import SnapKit +import Then + +struct TvingUserInfo { + var id: String? + var password: String? + var nickName: String? +} + +final class LoginViewController_...
Swift
어떤 TextField인지 명시 안해주고 editing이 시작된 textField에는 자동으로 적용되는구나 오 생각못했는데 배웠습니다 ㅎㅎ감사해요
@@ -0,0 +1,205 @@ +// +// LoginView.swift +// GO_SOPT_Seminar_Assingment +// +// Created by 김다예 on 2023/04/16. +// + +import UIKit + +class LoginView: UIView { + + // MARK: - Object Setting + + private let mainLabel = UILabel().then { + $0.text = "TVING ID 로그인" + $0.font = .tvingMedium(ofSize...
Swift
각각 좌우를 기준으로 하면 기기마다 차이가 좀 나타날 거 같아요! 가운데를 기준으로 묶을 수 있는 방법(stackview)도 좋을 거같아요 ㅎㅎ
@@ -0,0 +1,261 @@ +// +// LoginViewController_TVING.swift +// GO_SOPT_Seminar_Assingment +// +// Created by 김다예 on 2023/04/11. +// + +import UIKit + +import SnapKit +import Then + +struct TvingUserInfo { + var id: String? + var password: String? + var nickName: String? +} + +final class LoginViewController_...
Swift
UIView를 따로 빼니까 확 코드가 짧아졌네요 저도 다음엔 이런식으로 해봐야겠습니다 감사합니다 ㅎㅎ
@@ -0,0 +1,261 @@ +// +// LoginViewController_TVING.swift +// GO_SOPT_Seminar_Assingment +// +// Created by 김다예 on 2023/04/11. +// + +import UIKit + +import SnapKit +import Then + +struct TvingUserInfo { + var id: String? + var password: String? + var nickName: String? +} + +final class LoginViewController_...
Swift
target함수 따로 뺀 거 짱이에여 배워갑니다
@@ -0,0 +1,261 @@ +// +// LoginViewController_TVING.swift +// GO_SOPT_Seminar_Assingment +// +// Created by 김다예 on 2023/04/11. +// + +import UIKit + +import SnapKit +import Then + +struct TvingUserInfo { + var id: String? + var password: String? + var nickName: String? +} + +final class LoginViewController_...
Swift
우와 키보드 처리까지 !! 짱이군여
@@ -0,0 +1,261 @@ +// +// LoginViewController_TVING.swift +// GO_SOPT_Seminar_Assingment +// +// Created by 김다예 on 2023/04/11. +// + +import UIKit + +import SnapKit +import Then + +struct TvingUserInfo { + var id: String? + var password: String? + var nickName: String? +} + +final class LoginViewController_...
Swift
왕 구조체로 묶어주는 거 까지!
@@ -0,0 +1,261 @@ +// +// LoginViewController_TVING.swift +// GO_SOPT_Seminar_Assingment +// +// Created by 김다예 on 2023/04/11. +// + +import UIKit + +import SnapKit +import Then + +struct TvingUserInfo { + var id: String? + var password: String? + var nickName: String? +} + +final class LoginViewController_...
Swift
구조체에서 변수들을 ""로 초기화하는 것보다 옵셔널 처리해두는게 어떨까요? 나중에 구조체 변수에 값을 넣다보면, 변수가 실제로 값이 없는 상태인지 아니면 의도적으로 빈 값으로 초기화된 것인지를 구분하기 어렵다고 생각해서 저는 ?(옵셔널)을 사용해보면 좋을것 같아요! `var id: String?` 이런 식으로요
@@ -0,0 +1,261 @@ +// +// LoginViewController_TVING.swift +// GO_SOPT_Seminar_Assingment +// +// Created by 김다예 on 2023/04/11. +// + +import UIKit + +import SnapKit +import Then + +struct TvingUserInfo { + var id: String? + var password: String? + var nickName: String? +} + +final class LoginViewController_...
Swift
스위프트에서 접근 제어자를 따로 선언하지 않으면 internal 접근이 기본이라고 해요! open-> public -> internal -> file-private -> private 으로 갈 수록 제한적인 접근자인데 서로 다른 모듈끼리 접근하는 상황이 아니라면 굳이 public을 선언하여 접근 수준을 약하게 할 필요 없다고 생각하는데 어떻게 생각하세용? https://zeddios.tistory.com/383
@@ -0,0 +1,261 @@ +// +// LoginViewController_TVING.swift +// GO_SOPT_Seminar_Assingment +// +// Created by 김다예 on 2023/04/11. +// + +import UIKit + +import SnapKit +import Then + +struct TvingUserInfo { + var id: String? + var password: String? + var nickName: String? +} + +final class LoginViewController_...
Swift
public이 서로 다른 모듈에서도 접근할 수 있도록하는 접근 제어라고 하네요. 모듈이 생소해서 찾아보니 "Xcode의 각 빌드 대상"을 모듈이라고 하더라고요. 프로젝트 파일이라고 저는 이해했어요!
@@ -0,0 +1,261 @@ +// +// LoginViewController_TVING.swift +// GO_SOPT_Seminar_Assingment +// +// Created by 김다예 on 2023/04/11. +// + +import UIKit + +import SnapKit +import Then + +struct TvingUserInfo { + var id: String? + var password: String? + var nickName: String? +} + +final class LoginViewController_...
Swift
?? 방식으로 옵셔널 언랩핑하는것도 좋지만! 가독성을 위해 if let 이나 guard let을 쓰면 더 좋을것 같아요~
@@ -0,0 +1,205 @@ +// +// LoginView.swift +// GO_SOPT_Seminar_Assingment +// +// Created by 김다예 on 2023/04/16. +// + +import UIKit + +class LoginView: UIView { + + // MARK: - Object Setting + + private let mainLabel = UILabel().then { + $0.text = "TVING ID 로그인" + $0.font = .tvingMedium(ofSize...
Swift
버튼 컴포넌트들에만 lazy를 넣어주셨는데 addTarget에서 (노란색)워닝을 피하기 위해서 넣은거죠..? 버튼 이벤트 연결 방식중에 addTarget 방식 외에도 addAction 방식도 있어요! addAction 방식을 사용하면 버튼 이벤트 연결 함수에 @objc도 붙이지 않아도 되고, 워닝을 피하기 위한 lazy도 안써도 됩니다! 가독성 측면이랑, 최대한 objc 요소를 제외하고 UIKit 통일성을 위해 addAction 방식도 알고 있으면 좋을것 같아요! 아래는 addAction 방식으로 버튼 이벤트 연결한 예시 코드에요! priva...
@@ -0,0 +1,205 @@ +// +// LoginView.swift +// GO_SOPT_Seminar_Assingment +// +// Created by 김다예 on 2023/04/16. +// + +import UIKit + +class LoginView: UIView { + + // MARK: - Object Setting + + private let mainLabel = UILabel().then { + $0.text = "TVING ID 로그인" + $0.font = .tvingMedium(ofSize...
Swift
이건 제가 자주 사용하는 방식인데 addSubviews 할 때 가로로 길게 쓰는것 보다 아래 코드처럼 세로로 늘리는게 가독성에 좋더라고요. 물론 코드 줄은 늘어나지만요! 각자 선호하는 스타일이 있는것 같은데 조심스레.. 제안해봅니다 ㅎㅎ view.addSubviews(toolBarView, titleLabelStackView, houseImageView, homeGroupLabel, ...
@@ -0,0 +1,45 @@ +// +// WelcomeViewController.swift +// GO_SOPT_Seminar_Assingment +// +// Created by 김다예 on 2023/04/12. +// + +import UIKit + +final class WelcomeViewController: BaseViewController { + + // MARK: - Property + + private let mainView = WelcomeView() + + // MARK: - Target + + priva...
Swift
제가 최근에 생각 없이 버튼 이벤트 연결 함수 호출을 viewWillAppear 쪽에서 했다가... 문제가 생겼는데 viewDidLoad에 너무 잘 해두셨네요 ^~^
@@ -0,0 +1,261 @@ +// +// LoginViewController_TVING.swift +// GO_SOPT_Seminar_Assingment +// +// Created by 김다예 on 2023/04/11. +// + +import UIKit + +import SnapKit +import Then + +struct TvingUserInfo { + var id: String? + var password: String? + var nickName: String? +} + +final class LoginViewController_...
Swift
더 이상 상속되지 않는 클래스라면 final 키워드 붙이면 좋을것 같아요!
@@ -0,0 +1,261 @@ +// +// LoginViewController_TVING.swift +// GO_SOPT_Seminar_Assingment +// +// Created by 김다예 on 2023/04/11. +// + +import UIKit + +import SnapKit +import Then + +struct TvingUserInfo { + var id: String? + var password: String? + var nickName: String? +} + +final class LoginViewController_...
Swift
여기서 didSet을 사용해서 코드를 작성하면 좋을거 같아용 아래 대충 예시를 적었는데 저 자신도 didSet을 잘 활용하지 못해서 @meltsplit @seungchan2 확인 부탁드립니다 ```Swift public var nickName: String = “" { didSet { guard let nickName = nickNameBottomSheet.nickNameTextFeild.text else { return } self.nickName = nickName } ...
@@ -0,0 +1,261 @@ +// +// LoginViewController_TVING.swift +// GO_SOPT_Seminar_Assingment +// +// Created by 김다예 on 2023/04/11. +// + +import UIKit + +import SnapKit +import Then + +struct TvingUserInfo { + var id: String? + var password: String? + var nickName: String? +} + +final class LoginViewController_...
Swift
옵셔널 처리에 대해 공부하는건 분명 나중에 좋은 자산이 될거에여!
@@ -0,0 +1,261 @@ +// +// LoginViewController_TVING.swift +// GO_SOPT_Seminar_Assingment +// +// Created by 김다예 on 2023/04/11. +// + +import UIKit + +import SnapKit +import Then + +struct TvingUserInfo { + var id: String? + var password: String? + var nickName: String? +} + +final class LoginViewController_...
Swift
버튼 활성화와 정규식에 맞는지 확인하는 부분을 나눠주면 더 좋을거 같아요 버튼 활성화는 -> textFeild에 글이 차 있을 경우 -> textFeildDidChange를 사용하면 좋을거 같고 정규식 확인 -> 버튼을 눌렀을 때 -> 버튼에 addTarget을 해서 확인해주는 toastMessage나 print문을 찍어주는게 좋을거 같습니다~
@@ -0,0 +1,119 @@ +// +// AddNickNameBottomSheetUIView.swift +// GO_SOPT_Seminar_Assingment +// +// Created by 김다예 on 2023/04/15. +// + +import UIKit + +import SnapKit +import Then + +final class AddNickNameBottomSheetUIView: UIView { + + let bottomSheetHeight = UIScreen.main.bounds.height / 2 + + let ...
Swift
접근 제어자를 활용할때는 내가 해당 내용을(? 명칭이 애매함) 사용할 최소한의 범위로 사용하는게 좋아요! 만약 해당 파일에서만 사용할 component라면 private으로 바꾸는것도 좋겠죠?
@@ -0,0 +1,205 @@ +// +// LoginView.swift +// GO_SOPT_Seminar_Assingment +// +// Created by 김다예 on 2023/04/16. +// + +import UIKit + +class LoginView: UIView { + + // MARK: - Object Setting + + private let mainLabel = UILabel().then { + $0.text = "TVING ID 로그인" + $0.font = .tvingMedium(ofSize...
Swift
어쩐지 레이아웃 잡으면서도 이게 맞나.. 싶었슴미다 스택뷰로 다시 짜봤어요!!!!!!
@@ -0,0 +1,261 @@ +// +// LoginViewController_TVING.swift +// GO_SOPT_Seminar_Assingment +// +// Created by 김다예 on 2023/04/11. +// + +import UIKit + +import SnapKit +import Then + +struct TvingUserInfo { + var id: String? + var password: String? + var nickName: String? +} + +final class LoginViewController_...
Swift
bottomSheet 때문에 어쩌다보니.. 장단점이 있는 것 같아요!!! 코드는 진짜 간결해졌죵
@@ -0,0 +1,261 @@ +// +// LoginViewController_TVING.swift +// GO_SOPT_Seminar_Assingment +// +// Created by 김다예 on 2023/04/11. +// + +import UIKit + +import SnapKit +import Then + +struct TvingUserInfo { + var id: String? + var password: String? + var nickName: String? +} + +final class LoginViewController_...
Swift
bottomSheet를 올리려고 사용했는데 이게 맞는지는 멀겠ㅅ네영..ㅋㅋ
@@ -0,0 +1,261 @@ +// +// LoginViewController_TVING.swift +// GO_SOPT_Seminar_Assingment +// +// Created by 김다예 on 2023/04/11. +// + +import UIKit + +import SnapKit +import Then + +struct TvingUserInfo { + var id: String? + var password: String? + var nickName: String? +} + +final class LoginViewController_...
Swift
담엔 리뷰 바로 달러갈게용~😋
@@ -0,0 +1,177 @@ +@import '../../../styles/variable.scss'; + +@mixin flex { + display: flex; + justify-content: center; + align-items: center; +} + +@mixin login-input { + width: 266px; + height: 36px; + border: $boxBorder; + background-color: #fafafa; + color: #a4a4a4; + border-radius: 2px; + margin-bottom:...
Unknown
- index.js에서 import하기 때문에 여기서는 안하셔도 됩니다.
@@ -0,0 +1,177 @@ +@import '../../../styles/variable.scss'; + +@mixin flex { + display: flex; + justify-content: center; + align-items: center; +} + +@mixin login-input { + width: 266px; + height: 36px; + border: $boxBorder; + background-color: #fafafa; + color: #a4a4a4; + border-radius: 2px; + margin-bottom:...
Unknown
- mixin 사용해주신 것 좋습니다. - 다른 분들까지 사용하실 수 있는 부분이라고 생각되시면 variables.scss로 옮겨서 진행해 주세요.
@@ -0,0 +1,177 @@ +@import '../../../styles/variable.scss'; + +@mixin flex { + display: flex; + justify-content: center; + align-items: center; +} + +@mixin login-input { + width: 266px; + height: 36px; + border: $boxBorder; + background-color: #fafafa; + color: #a4a4a4; + border-radius: 2px; + margin-bottom:...
Unknown
- nesting 해주세요. - 또 태그를 이용한 속성 주시는 것은 지향해 주시고 className을 활용해 주세요.
@@ -1,7 +1,138 @@ -import React from 'react'; +import React, { useState } from 'react'; +import { useNavigate, Link } from 'react-router-dom'; -function Login() { - return <div>Gaeul Login</div>; -} +const Login = () => { + const [inputValues, setInputValues] = useState({ + userId: '', + password: '', + }); ...
JavaScript
- 불필요한 주석은 삭제해 주세요.
@@ -1,7 +1,138 @@ -import React from 'react'; +import React, { useState } from 'react'; +import { useNavigate, Link } from 'react-router-dom'; -function Login() { - return <div>Gaeul Login</div>; -} +const Login = () => { + const [inputValues, setInputValues] = useState({ + userId: '', + password: '', + }); ...
JavaScript
- 태그를 사용해 주시고 className은 해당 컴포넌트로 해주세요.
@@ -1,7 +1,138 @@ -import React from 'react'; +import React, { useState } from 'react'; +import { useNavigate, Link } from 'react-router-dom'; -function Login() { - return <div>Gaeul Login</div>; -} +const Login = () => { + const [inputValues, setInputValues] = useState({ + userId: '', + password: '', + }); ...
JavaScript
- return 안쪽은 render와 관련된 부분이라 로직은 최대한 함수 영역에 작성해 주세요.
@@ -1,7 +1,138 @@ -import React from 'react'; +import React, { useState } from 'react'; +import { useNavigate, Link } from 'react-router-dom'; -function Login() { - return <div>Gaeul Login</div>; -} +const Login = () => { + const [inputValues, setInputValues] = useState({ + userId: '', + password: '', + }); ...
JavaScript
- navigate는 조건이 있을 때 사용하시면 됩니다. - 그게 아니라면 말씀하신 것 처럼 Link 컴포넌트를 활용하셔도 됩니다.
@@ -0,0 +1,100 @@ +@import '../../../styles/variable.scss'; + +p { + font-family: 'Roboto'; + letter-spacing: 0.2px; +} + +.Main { + background-color: $backGroundColor; + + .main { + display: flex; + justify-content: center; + padding-bottom: 100px; + + .main-right { + width: 250px; + height: ...
Unknown
- body는 다른 페이지에도 영향을 줄 수 있겠네요 - 필요한 부분이라면 common.scss에서 진행되거나 팀원들과 논의 후 진행하시면 됩니다.
@@ -0,0 +1,100 @@ +@import '../../../styles/variable.scss'; + +p { + font-family: 'Roboto'; + letter-spacing: 0.2px; +} + +.Main { + background-color: $backGroundColor; + + .main { + display: flex; + justify-content: center; + padding-bottom: 100px; + + .main-right { + width: 250px; + height: ...
Unknown
- 컴포넌트를 분리하셨다면 해당 css도 분리하셔서 진행하시는 게 가독성에도 좋겠네요.
@@ -0,0 +1,82 @@ +import React, { useState } from 'react'; +import CommentList from './CommentList'; + +const Feeds = ({ feedData }) => { + const [input, setInput] = useState(''); + const [inputList, setInputList] = useState([]); + + const post = event => { + event.preventDefault(); + setInputList(inputList.co...
JavaScript
- className은 컴포넌트명과 같게 해주세요.
@@ -0,0 +1,82 @@ +import React, { useState } from 'react'; +import CommentList from './CommentList'; + +const Feeds = ({ feedData }) => { + const [input, setInput] = useState(''); + const [inputList, setInputList] = useState([]); + + const post = event => { + event.preventDefault(); + setInputList(inputList.co...
JavaScript
- alt는 유저가 보는 텍스트 입니다. - 유저 입장에서 작성해 주세요.
@@ -0,0 +1,82 @@ +import React, { useState } from 'react'; +import CommentList from './CommentList'; + +const Feeds = ({ feedData }) => { + const [input, setInput] = useState(''); + const [inputList, setInputList] = useState([]); + + const post = event => { + event.preventDefault(); + setInputList(inputList.co...
JavaScript
- onKeyup 보다는 변수로 동적 관리를 하면 좋을 것 같습니다. - 변수를 만들어 동적으로 관리한다면 state가 없어도 되겠네요.
@@ -0,0 +1,82 @@ +import React, { useState } from 'react'; +import CommentList from './CommentList'; + +const Feeds = ({ feedData }) => { + const [input, setInput] = useState(''); + const [inputList, setInputList] = useState([]); + + const post = event => { + event.preventDefault(); + setInputList(inputList.co...
JavaScript
- form 태그 안에 있다면 버튼에는 따로 onClick을 부여하지 않으셔도 됩니다.
@@ -0,0 +1,36 @@ +package rentcar.domain; + +public class Avante extends Car { + + private static final String NAME = "Avante"; + private static final double DISTANCE_PER_LITER = 15; + private static final String VALIDATE_TRIP_DISTANCE_MESSAGE = "[ERROR] 여행거리는 0 이상입니다."; + + private double tripDistance; + +...
Java
Car (추상) 클래스의 하위 구현체들은 모두 이 로직이 반복되고 있어요. 👀 반복되는 코드를 Car 클래스에 구현하면 반복되는 코드를 줄일 수 있을 것 같아요. 🤗
@@ -0,0 +1,36 @@ +package rentcar.domain; + +public class Avante extends Car { + + private static final String NAME = "Avante"; + private static final double DISTANCE_PER_LITER = 15; + private static final String VALIDATE_TRIP_DISTANCE_MESSAGE = "[ERROR] 여행거리는 0 이상입니다."; + + private double tripDistance; + +...
Java
`0`이 어떤 숫자인지 상수로 추출하여 의미를 명확하게 해주면 좋을 것 같아요. 🤗
@@ -0,0 +1,7 @@ +package rentcar.domain; + +public interface Reportable { + + String generateReport(); + +}
Java
인터페이스 활용 👍👍
@@ -0,0 +1,92 @@ +package blackjack.controller; + +import blackjack.domain.card.CardFactory; +import blackjack.domain.card.Deck; +import blackjack.domain.report.GameReports; +import blackjack.domain.request.DrawRequest; +import blackjack.domain.request.UserNamesRequest; +import blackjack.domain.user.Dealer; +import bla...
Java
`collectingAndThen` 함수는 저도 몰랐는데, 유용한 것 같아요! 🤭👍
@@ -0,0 +1,92 @@ +package blackjack.controller; + +import blackjack.domain.card.CardFactory; +import blackjack.domain.card.Deck; +import blackjack.domain.report.GameReports; +import blackjack.domain.request.DrawRequest; +import blackjack.domain.request.UserNamesRequest; +import blackjack.domain.user.Dealer; +import bla...
Java
`BlackJack` 클래스는 Controller의 용도로 사용하려는 것 같으나 비즈니스 로직이 상당수 존재하는 것 같아요. 🤔 Controller는 상태 값을 가지지 않아야해요. 👀 `BlackJackController` 클래스와 비즈니스 모델인 `BlackJack` 클래스로 분리해볼 수 있을 것 같아요. 🤗
@@ -0,0 +1,34 @@ +package blackjack.domain.card; + +public enum Number { + + ACE(1, "A"), + TWO(2, "2"), + THREE(3, "3"), + FOUR(4, "4"), + FIVE(5, "5"), + SIX(6, "6"), + SEVEN(7, "7"), + EIGHT(8, "8"), + NINE(9, "9"), + TEN(10, "10"), + JACK(10, "J"), + QUEEN(10, "Q"), + KING(10,...
Java
enum 클래스명이 `ACE, JACK, QUEEN, KING`을 포함하는 의미라고 볼 수 있을까요? 🤔 `Type` or `CardType`과 같은 네이밍은 어떨까요? 😃
@@ -0,0 +1,34 @@ +package blackjack.domain.card; + +public enum Number { + + ACE(1, "A"), + TWO(2, "2"), + THREE(3, "3"), + FOUR(4, "4"), + FIVE(5, "5"), + SIX(6, "6"), + SEVEN(7, "7"), + EIGHT(8, "8"), + NINE(9, "9"), + TEN(10, "10"), + JACK(10, "J"), + QUEEN(10, "Q"), + KING(10,...
Java
객체의 상태 값을 외부로 호출하는 메서드는 `getter` 메서드를 정의해주세요. 😃 getter, setter와 같은 관습적인 메서드 생성이 낯설거나 어렵다면 `⌘ + N` 단축키를 통해서 이런 메서드들을 쉽게 생성할 수 있어요. 🤗
@@ -0,0 +1,35 @@ +package blackjack.domain.card; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class CardFactory { + + public static CardFactory INSTANCE; + + private CardFactory() { + } + + public static CardFactory getInstance() { + if (INSTANCE == ...
Java
Deck으로 쓰이는 카드들은 카드의 형태와 갯수들이 정해져있고 재사용할 확률이 높다고 생각해요. 😃 미리 만들어뒀다가 필요한 시점에 재사용해보면 어떨까요? 🤗 [참고 자료](https://tecoble.techcourse.co.kr/post/2020-06-24-caching-instance/)
@@ -0,0 +1,22 @@ +package blackjack.domain.card; + +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; + +public class Deck { + + private final Queue<Card> deck; + + public Deck(List<Card> cards) { + this.deck = new LinkedList<>(cards); + } + + public Card spreadCard() { + ...
Java
저는 Stack이 조금 더 카드 게임에 어울린다고 생각하는데, Queue도 좋은 접근인 것 같아요. 🤗 `spreadCard` 메서드에서는 deck이 비어있는 경우에 대한 예외 처리도 할 수 있을 것 같아요. 😃
@@ -0,0 +1,42 @@ +package blackjack.domain.card; + +import blackjack.domain.score.ScoreCalculator; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class CardBundle { + + private static final int BLACK_JACK_SCORE = 21; + + private final List<Card> cards; + + private...
Java
CardBundle.`empty()` 로도 충분히 의미가 전달되는 것 같아요. 😃
@@ -0,0 +1,42 @@ +package blackjack.domain.card; + +import blackjack.domain.score.ScoreCalculator; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class CardBundle { + + private static final int BLACK_JACK_SCORE = 21; + + private final List<Card> cards; + + private...
Java
`CardBundle` 객체는 **카드의 점수를 합산하는 역할**을 수행한다고 생각해요. 🤔 `ScoreCalculator` enum class 내부 코드는 매우 흥미롭게 봤어요. 😃 👍 하지만 `AceScoreStrategy`, `DefaultScoreStrategy`의 내부 코드를 보았을 때, 이런 식으로 (카드 점수 합산) 전략을 구분하여 구현하는 것보다 카드 점수 합산 로직이 필요한 `CardBundle 객체 내부`에 직접 구현하는 것이 더 응집성이 높다고 생각해요. 😃 지금의 코드에서 `점수를 합산`하는 기능을 파악하기가 어려운 것 같아요...
@@ -0,0 +1,51 @@ +package blackjack.domain.report; + +import java.util.Objects; + +public class GameReport { + + private final String name; + private final GameResult result; + + public GameReport(String name, GameResult result) { + this.name = name; + this.result = result; + } + + public S...
Java
GameReport 객체의 `동등성`을 정의할 필요가 있나요? 🤔 혹시 필요한 위치가 있을까요? 👀 (제가 못 찾는 걸까요? 🙄)
@@ -0,0 +1,52 @@ +package blackjack.domain.report; + +import blackjack.domain.card.CardBundle; +import java.util.Arrays; + +public enum GameResult { + + WIN(1, "승"), + DRAW(0, "무"), + LOSE(-1, "패"); + + private final int result; + private final String message; + + GameResult(int result, String message...
Java
getter (getter 역할을 하는 메서드), setter, compareTo, toString 등의 메서드는 클래스의 최하단에 위치시켜주세요!
@@ -0,0 +1,52 @@ +package blackjack.domain.report; + +import blackjack.domain.card.CardBundle; +import java.util.Arrays; + +public enum GameResult { + + WIN(1, "승"), + DRAW(0, "무"), + LOSE(-1, "패"); + + private final int result; + private final String message; + + GameResult(int result, String message...
Java
두 CardBundle (사실상 두 번째, 파라미터로 받는 CardBundle은 Dealer의 CardBundle로 고정되는 것 같아요. 👀)을 받아서 `게임 결과`를 반환하는 역할은 `Dealer`의 역할이라고 볼 수 있지 않을까요? 🤔 (그러면 첫 번째 파라미터와 두 번째 파라미터의 순서를 잘못 대입한다거나 하는 실수를 막을 수도 있을 것 같아요. 😃)
@@ -0,0 +1,45 @@ +package blackjack.domain.request; + +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +public class UserNamesRequest { + + private static final String USER_NAME_DELIMITER = ","; +...
Java
이 유효성 검증 로직은 블랙잭 도메인 모델에 꼭 필요한 유효성 검증인 것 같아요. 👀 먼저 Player의 상태 값인 원시 값 name을 포장해보면 어떨까요? 🤗
@@ -0,0 +1,55 @@ +package blackjack.domain.user; + +import blackjack.domain.card.Card; +import blackjack.domain.card.CardBundle; +import java.util.List; + +public class Player { + + protected final CardBundle cardBundle; + private final String name; + + public Player(String name) { + validateName(name);...
Java
String의 `isEmpty` 함수를 대신 사용해보면 어떨까요? 😃 ```suggestion if (name == null || name.trim().isEmpty()) { ```
@@ -0,0 +1,33 @@ +package blackjack.domain.user; + +import blackjack.domain.report.GameResult; +import blackjack.domain.report.GameReport; + +public class Dealer extends Player { + + private static final int DEALER_MUST_DRAW_SCORE = 16; + + public Dealer() { + super("딜러"); + } + + public GameReport c...
Java
Dealer가 온전한 Player 클래스를 바로 상속받았기 때문에 어떤 메서드를 재정의해야 하는지 파악하기 어려운 것 같아요. 🤔 공통으로 사용하는 메서드는 그대로 사용할 수 있게 하되, 하위 구현체에 따라 달라지는 기능들은 `추상 메서드`로 정의해서 하위 구현체에서는 재정의를 강제하도록 하면 좋지 않을까요? 😃
@@ -0,0 +1,33 @@ +package blackjack.domain.user; + +import blackjack.domain.report.GameResult; +import blackjack.domain.report.GameReport; + +public class Dealer extends Player { + + private static final int DEALER_MUST_DRAW_SCORE = 16; + + public Dealer() { + super("딜러"); + } + + public GameReport c...
Java
GameReport 객체의 상태 값으로 Player의 이름을 받는게 아니라 `Player`를 가지면 어떨까요? 🤔
@@ -0,0 +1,82 @@ +package blackjack.view; + +import static blackjack.domain.user.Players.START_CARD_INIT_SIZE; + +import blackjack.domain.report.GameReports; +import blackjack.domain.card.Card; +import blackjack.domain.user.Player; +import blackjack.domain.user.Players; +import java.util.List; +import java.util.stream....
Java
`findOnlyPlayers`와 `findDealer`는 비즈니스 로직이기 때문에 Model의 영역이라고 볼 수 있어요. 👀 Controller에서 두 메서드를 호출한 뒤, 메서드 파라미터로 그 결과 값들을 전달받도록 변경해주세요! 🙏
@@ -0,0 +1,34 @@ +package blackjack.domain.card; + +public enum Number { + + ACE(1, "A"), + TWO(2, "2"), + THREE(3, "3"), + FOUR(4, "4"), + FIVE(5, "5"), + SIX(6, "6"), + SEVEN(7, "7"), + EIGHT(8, "8"), + NINE(9, "9"), + TEN(10, "10"), + JACK(10, "J"), + QUEEN(10, "Q"), + KING(10,...
Java
저는 `getXXX`과 같은 네이밍이 오히려 내부 속성을 노출한다고 생각해서 `의미있는 네이밍의 메서드를 사용하는게 더 낫지 않을까?` 라는 생각으로 메서드의 네이밍을 작성해보았는데 해당에 대해서도 `getXXX`으로 통일하는게 더 좋을까요?
@@ -0,0 +1,42 @@ +package blackjack.domain.card; + +import blackjack.domain.score.ScoreCalculator; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class CardBundle { + + private static final int BLACK_JACK_SCORE = 21; + + private final List<Card> cards; + + private...
Java
`empty()`도 괜찮은 네이밍이라고 생각했지만, 해당 번들이 비어있다는 의미(`isEmpty()`)와 유사하게 해석될 수도 있다고 생각했습니다.
@@ -0,0 +1,51 @@ +package blackjack.domain.report; + +import java.util.Objects; + +public class GameReport { + + private final String name; + private final GameResult result; + + public GameReport(String name, GameResult result) { + this.name = name; + this.result = result; + } + + public S...
Java
아 처음에 GameReports의 `Set`을 의도하고 구현했는데 지금은 불필요한 메서드라고 생각되어 삭제하겠습니다!
@@ -0,0 +1,18 @@ +package subway.config; + +import lombok.extern.slf4j.*; +import org.springframework.http.*; +import org.springframework.web.bind.annotation.*; + +@Slf4j +@RestControllerAdvice +public class GlobalExceptionHandler { + + @ExceptionHandler(RuntimeException.class) + public ResponseEntity<ErrorRespon...
Java
에러 공통 처리를 잘 해주셨네요! 😊 예외종류에 따라 로깅레벨을 적절하게 분리해서 로그를 남기는 것도 좋을 거 같은데 어떻게 생각하시나요? logging level 관련해서는 아래 내용을 참고해 주시면 감사하겠습니다. 예) log.error("Unexpected exception occurred: {}", e.getMessage(), e); ○ DEBUG : 개발단계에서부터 활성화.프로세스의처리순서/흐름을분석하는데 도움이 되는 정보 등 ○ INFO : 디버깅정보외에 프로세스설정 / 기동에 관련한 정보 등 ○ WARN : 오류상황은 아니지만,...
@@ -1,13 +1,13 @@ package subway.line; import lombok.*; +import subway.*; +import subway.line.section.*; import javax.persistence.*; @Entity @NoArgsConstructor(access = AccessLevel.PROTECTED) -@AllArgsConstructor(access = AccessLevel.PRIVATE) -@Builder @Getter public class Line { @@ -21,13 +21,27 @@ publ...
Java
`@Embedded 을 이용해 도메인 로직을 잘 분리해 주셨군요! 👍
@@ -0,0 +1,49 @@ +package subway.line.section; + +import lombok.*; +import org.springframework.stereotype.*; +import org.springframework.transaction.annotation.*; +import subway.*; +import subway.line.*; + +@Service +@Transactional +@RequiredArgsConstructor +public class SectionService { + + private final StationSer...
Java
해당 함수는 SectionService 에서만 사용하는 것으로 보여지는데 static 으로 선언한 이유가 있을까요? 😊
@@ -0,0 +1,81 @@ +package subway.line.section; + +import lombok.*; +import subway.*; + +import javax.persistence.*; +import java.util.*; + +@Embeddable +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public class Sections { + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "line", cascade = CascadeType.ALL, orpha...
Java
매개변수 타입은 Station 인데 변수 명은 section 이여서 혼동이 있어 보여요! 😊
@@ -0,0 +1,55 @@ +package subway.given; + +import io.restassured.response.*; +import org.springframework.http.*; + +import java.util.*; + +import static io.restassured.RestAssured.*; + +public class GivenLineApi { + + public static final String LINE_PATH = "/lines"; + public static final String BG_COLOR_600 = "bg...
Java
Map 으로 만들어서 넘기기 보다는 DTO 로 만들어도 좋지 않을까요? ☺️
@@ -0,0 +1,171 @@ +package subway.line.section; + +import io.restassured.response.*; +import org.junit.jupiter.api.*; +import org.springframework.boot.test.context.*; +import org.springframework.test.annotation.*; + +import java.util.*; + +import static io.restassured.RestAssured.*; +import static org.assertj.core.api....
Java
`@DirtiesContext` 를 활용해 테스트 격리를 해 주셨군요! 👍 `@DirtiesContext` 는 컨텍스트를 다시 로드하기 때문에 테스트 속도가 오래 걸린다는 단점이 있습니다! 이 부분은 한번 고민해 보시면 좋을 거 같습니다 😊
@@ -0,0 +1,171 @@ +package subway.line.section; + +import io.restassured.response.*; +import org.junit.jupiter.api.*; +import org.springframework.boot.test.context.*; +import org.springframework.test.annotation.*; + +import java.util.*; + +import static io.restassured.RestAssured.*; +import static org.assertj.core.api....
Java
예외 시나리오에 대해 테스트를 잘해주셨네요! 👍
@@ -0,0 +1,21 @@ +import React from 'react'; + +class InputBox extends React.Component { + // eslint-disable-next-line no-useless-constructor + constructor(props) { + super(props); + } + render() { + const { name, type, placeholder, recivedValue } = this.props; + return ( + <input + name={name}...
JavaScript
이부분 왜 주석처리하셨나요? 이렇게 안쓰는 코드를 주석처리해서 남겨두면 다른사람도 이 코드가 어디에 쓰이는건가 해서 모두 못지우고 결국 아무 쓸모 없지만 계속 전해 내려가는 주석코드가 됩니다 필요없는 코드는 삭제해주세요! 커밋만 잘 남겨두면 다시 돌아올 수 있으니까 과감하게 지워도 됩니다!
@@ -0,0 +1,21 @@ +import React from 'react'; + +class InputBox extends React.Component { + // eslint-disable-next-line no-useless-constructor + constructor(props) { + super(props); + } + render() { + const { name, type, placeholder, recivedValue } = this.props; + return ( + <input + name={name}...
JavaScript
```suggestion const {name, type, placeholder, recivedValue} = this.props; return ( <input name={name} type={type} placeholder={placeholder} onChange={recivedValue} /> ); ``` 구조분해할당해서 쓰면 좀 더 깔끔하겠네요
@@ -0,0 +1,85 @@ +import React from 'react'; +import { withRouter } from 'react-router-dom'; +import InputBox from './InputBox/InputBox'; +import './JaehyunLogin.scss'; + +class JaehyunLogin extends React.Component { + constructor(props) { + super(props); + + this.state = { + userName: '', + password: ...
JavaScript
import 순서 맞춰주세요
@@ -0,0 +1,85 @@ +import React from 'react'; +import { withRouter } from 'react-router-dom'; +import InputBox from './InputBox/InputBox'; +import './JaehyunLogin.scss'; + +class JaehyunLogin extends React.Component { + constructor(props) { + super(props); + + this.state = { + userName: '', + password: ...
JavaScript
peer review에 학습자료로 제공된 리팩토링 체크리스트 확인해보시면 됩니다.
@@ -0,0 +1,85 @@ +import React from 'react'; +import { withRouter } from 'react-router-dom'; +import InputBox from './InputBox/InputBox'; +import './JaehyunLogin.scss'; + +class JaehyunLogin extends React.Component { + constructor(props) { + super(props); + + this.state = { + userName: '', + password: ...
JavaScript
[공식문서 React로 사고하기](https://ko.reactjs.org/docs/thinking-in-react.html#step-3-identify-the-minimal-but-complete-representation-of-ui-state) 를 보시면 어떤 값들이 state가 되어야하는지에 대해 적혀있습니다. > 각각 살펴보고 어떤 게 state가 되어야 하는 지 살펴봅시다. 이는 각 데이터에 대해 아래의 세 가지 질문을 통해 결정할 수 있습니다 > 1. 부모로부터 props를 통해 전달됩니까? 그러면 확실히 state가 아닙니다. > 2. 시간이 지...
@@ -0,0 +1,85 @@ +import React from 'react'; +import { withRouter } from 'react-router-dom'; +import InputBox from './InputBox/InputBox'; +import './JaehyunLogin.scss'; + +class JaehyunLogin extends React.Component { + constructor(props) { + super(props); + + this.state = { + userName: '', + password: ...
JavaScript
주석 삭제해주세요~