code
stringlengths
41
34.3k
lang
stringclasses
8 values
review
stringlengths
1
4.74k
@@ -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
제 경우 1월 새해 이벤트에 이벤트가 변경될 수 있다 가정해 Menu 인터페이스를 선언한 뒤 에피타이저, 메인, 디저트, 음료별로 ENUM 객체를 각각 따로 선언했습니다! 참고하시면 좋을 것 같아요! ``` java public interface Menu { int discount(int day); String getName(); int getPrice(); } ``` ``` java public enum Appetizer implements Menu { MUSHROOM_SOUP("양송이수프", 6...
@@ -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
int가 아닌 Integer로 선언해주시는 이유가 궁금합니다!🤔
@@ -0,0 +1,18 @@ +package christmas.domain.discount; + +import christmas.domain.order.Day; +import christmas.domain.order.Order; + +public interface Discount { + + public void calculateDiscountAmount(Order order, Day day); + + public void checkIsAvailableDiscount(Order order, Day day); + + public String getNam...
Java
다형성을 이용하는 정말 좋은 방법이네요 배우고갑니다!
@@ -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`는 요 처리가 누락된 것 같아 같이 반영하면 좋을 것 같아요~
@@ -1 +1,30 @@ -# java-lotto 게임 +# java-Lotto 게임 + +# 구현 기능 목록 + +- [x] 구입금액 입력받기 + - [x] 1000원 미만 입력 시 처리 + - [x] 1000의 배수 아닌 값 입력 시 처리 + - [x] 숫자가 아닌 값 (문자열) + - [x] 정상값 처리 + - [x] 공백 처리 +- [x] 구매 개수 구하기 +- [x] 랜덤 로또번호 구매 개수만큼 만들기 + - [x] defaultNumberSet 1번만 생성되도록 변경 + - [x] RandomLottoTest 상수 리...
Unknown
구현 기능 목록 작성 👍
@@ -10,6 +10,13 @@ repositories { dependencies { testImplementation('org.junit.jupiter:junit-jupiter:5.6.0') testImplementation('org.assertj:assertj-core:3.15.0') + + compileOnly 'org.projectlombok:lombok:1.18.20' + annotationProcessor 'org.projectlombok:lombok:1.18.20' + + testCompileOnly 'org.proj...
Unknown
롬복 플러그인을 활용하셨네요!
@@ -0,0 +1,24 @@ +package lotto.controller; + +import lotto.domain.dto.LottoResult; +import lotto.domain.dto.PurchaseInput; +import lotto.domain.dto.PurchaseResult; +import lotto.domain.dto.WinningLottoInput; +import lotto.service.LottoService; + +public class LottoController { + + private final LottoService lottoSe...
Java
MVC 패턴을 이용해 문제를 풀려고 시도하셨네요! 다만 Model - View - Controller 역할 분리가 명확하게 되어있지 않아 현재 Controller가 View를 직접 활용하는 방식으로 코드 구현이 되어있는데요. 각자의 역할과 책임은 무엇이고, 이를 어떻게 독립적으로 분리해낼 수 있을 지, 또 왜 그러하여야 하는지 고민해보시면 좋겠습니다. 현재는 `LottoController.start()` 는 `LottoApplication`의 main과 같은 역할로 보이네요.
@@ -0,0 +1,31 @@ +package lotto.view; + +import java.util.Arrays; +import java.util.List; +import java.util.Scanner; +import java.util.stream.Collectors; + +public class ConsoleInputView implements InputView { + + private static final String LOTTO_NUMBERS_INPUT_DELIMITER = ","; + + private final Scanner scanner =...
Java
과한(불필요한) 메서드 포장입니다.
@@ -0,0 +1,86 @@ +package lotto.view; + +import lotto.domain.*; +import lotto.domain.dto.LottoResult; + +public class ConsoleOutputView implements OutputView { + + private static final String ERROR_HEADER = "[ERROR] "; + + private void print(String contents) { + System.out.println(contents); + } + + ...
Java
line 9 to 13 너무 명확한 값들이 과하게 상수로 만들어졌습니다. 모든 literal value가 나쁜 것은 아닙니다. ^^;
@@ -0,0 +1,33 @@ +package lotto.service; + +import lotto.domain.*; +import lotto.domain.dto.LottoResult; +import lotto.domain.dto.PurchaseInput; +import lotto.domain.dto.PurchaseResult; +import lotto.domain.dto.WinningLottoInput; + +public class LottoService { + + public PurchaseResult purchase(PurchaseInput purchas...
Java
PurchaseCount 객체를 생성하는 이 시점에 유효성 검증이 해당 객체 생성자에서 진행되는데요, 컨트롤러 레이어에서 사용자의 입력 값의 유효성을 먼저 검증할 수 있지 않을까요? 고민해볼 거리: 유효성 검증은 어떤 레이어에서 진행되어야할까?
@@ -0,0 +1,19 @@ +package lotto.exception; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import lotto.domain.Lotto; + +@RequiredArgsConstructor +public enum ExceptionMessage { + + NON_NUMBER_INPUT("숫자를 입력해주세요."), + LESS_THAN_LOTTO_PRICE_INPUT_FOR_PURCHASE_MONEY("구입금액은 " + Lotto.PRICE + " 이상의 값...
Java
예외 메시지를 별도로 분리해서 한 곳에서 관리하고 있네요! 현재는 IllegalArgumentException만을 사용하고 메시지로 특정 예외에 대해서 처리하고 있는데요, 구체적인 CustomException을 만들고 상황에 따라 이를 던져 해당 Exception을 활용하는 방법도 생각해볼 수 있습니다.
@@ -0,0 +1,53 @@ +package lotto.domain; + +import lombok.Getter; + +import java.util.Objects; + +import static lotto.exception.ExceptionMessage.OUT_OF_BOUND_INPUT_FOR_LOTTO_NUMBER; + +public class LottoNumber { + + public static final int LOWER_BOUND = 1; + public static final int UPPER_BOUND = 45; + + @Getter...
Java
`isInteger` 는 직독하면 정수인가? 는 판단문입니다. 다만 내용을 보니 0~9까지 숫자 즉 음이 아닌 정수인지를 정규표현식을 이용해 판단하고 있네요. isNonNegativeInteger 정도로 더 정확하게 표현해보면 어떨까요? ```suggestion if (!isNonNegativeInteger(input)) { ```
@@ -0,0 +1,35 @@ +package lotto.domain; + +import lombok.Builder; +import lombok.Getter; + +import static lotto.exception.ExceptionMessage.LESS_THAN_LOTTO_PRICE_INPUT_FOR_PURCHASE_MONEY; +import static lotto.exception.ExceptionMessage.NON_MULTIPLE_OF_LOTTO_PRICE_INPUT_FOR_PURCHASE_MONEY; + +public class PurchaseCount {...
Java
`isInteger` 는 직독하면 정수인가? 는 판단문입니다. 다만 내용을 보니 0~9까지 숫자 즉 음이 아닌 정수인지를 정규표현식을 이용해 판단하고 있네요. isNonNegativeInteger 정도로 더 정확하게 표현해보면 어떨까요? ```suggestion if (!isNonNegativeInteger(input)) { ```
@@ -0,0 +1,35 @@ +package lotto.domain; + +import lombok.Builder; +import lombok.Getter; + +import static lotto.exception.ExceptionMessage.LESS_THAN_LOTTO_PRICE_INPUT_FOR_PURCHASE_MONEY; +import static lotto.exception.ExceptionMessage.NON_MULTIPLE_OF_LOTTO_PRICE_INPUT_FOR_PURCHASE_MONEY; + +public class PurchaseCount {...
Java
`notMatchesCondition` 표현이 모호하고 두 가지 서로 다른 일을 하고 있습니다. 1. 입력이 로또를 구매할 수 있는 최소 값(1000)미만인지 검증 2. 정확히 티켓 가격의 배수인지 검증 1의 상황을 2의 부분집합으로 생각하여 구현하신 것으로 추측되는데, 사용자에게 실패에 대한 더 정확한 에러를 구분하여 노출하는 것이 좋지 않을까요?
@@ -0,0 +1,17 @@ +package lotto.domain; + +import lombok.Builder; +import lombok.Getter; +import lotto.domain.dto.WinningLottoInput; + +public class WinningLotto extends Lotto { + + @Getter + private final LottoNumber bonusNumber; + + @Builder + public WinningLotto(WinningLottoInput winningLottoInput) throw...
Java
사용자 입력(InputView)에 대한 파싱과 검증이 서비스 레이어를 통과해 도메인 모델까지 침투했습니다. 이를 담당하는 영역인 컨트롤러 레이어에서 선작업을 모두 마무리지어야합니다. 가급적 도메인 모델은 사용자 입력 방식과 독립적이어야합니다. 어떤 뷰를 통해 접근하든 도메인은 그 자체로 문제 영역만을 표현하고 해결하는 레이어이어야합니다.
@@ -0,0 +1,53 @@ +package lotto.domain; + +import lombok.Getter; + +import java.util.Objects; + +import static lotto.exception.ExceptionMessage.OUT_OF_BOUND_INPUT_FOR_LOTTO_NUMBER; + +public class LottoNumber { + + public static final int LOWER_BOUND = 1; + public static final int UPPER_BOUND = 45; + + @Getter...
Java
LottoNumber를 생성할 때 String으로 생성할 필요가 있을까요? String type으로 받다보니 형변환까지 책임져야하는 상황이 되었네요.
@@ -0,0 +1,17 @@ +package lotto.domain; + +import lombok.Builder; +import lombok.Getter; +import lotto.domain.dto.WinningLottoInput; + +public class WinningLotto extends Lotto { + + @Getter + private final LottoNumber bonusNumber; + + @Builder + public WinningLotto(WinningLottoInput winningLottoInput) throw...
Java
반복문과 조건문을 중첩해서 로직이 복잡하네요. 더 나은 방식으로 리팩토링을 해야겠죠?
@@ -0,0 +1,55 @@ +package lotto.domain; + +import lombok.Getter; + +@Getter +public enum Prize { + + FIRST(6, false, 2000000000), + SECOND(5, true, 30000000), + THIRD(5, false, 1500000), + FOURTH(4, false, 50000), + FIFTH(3, false, 5000), + LOSE(2, false, 0); + + private final int matchNumbersCount...
Java
Enum 활용 👏
@@ -0,0 +1,35 @@ +package lotto.domain; + +import lombok.Getter; + +@Getter +public class PrizeCount { + + private int first; + private int second; + private int third; + private int fourth; + private int fifth; + + public void addPrize(Prize prize) { + if (prize == Prize.FIRST) { + ...
Java
이 클래스의 이름이 Prize**Count**이니 line 9 to 13 count 는 중복처럼 느껴지네요. 더 단순하게 네이밍해도 의미 전달에 무리 없어보입니다.
@@ -0,0 +1,17 @@ +package lotto.domain; + +import lombok.Builder; +import lombok.Getter; +import lotto.domain.dto.WinningLottoInput; + +public class WinningLotto extends Lotto { + + @Getter + private final LottoNumber bonusNumber; + + @Builder + public WinningLotto(WinningLottoInput winningLottoInput) throw...
Java
1. 네이밍에서 Condition과 같은 모호한 단어를 사용하면 좋지 않습니다. 더 구체적인 표현을 사용하도록 합시다. 2. find라는 표현과 get이라는 표현 사이에 미묘한 차이가 있습니다. 어떤 차이인지는 찾아서 공부하고 저에게도 공유해주세요.
@@ -0,0 +1,22 @@ +package lotto.domain; + +import lombok.Builder; +import lombok.Getter; + +public class LottoStatistics { + + @Getter + private final PrizeCount prizeCount; + private final PurchaseCount purchaseCount; + + @Builder + public LottoStatistics(PrizeCount prizeCount, PurchaseCount purchaseCou...
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
주석 삭제해주세요~
@@ -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
```suggestion const { name, value } = e.target; this.setState({[name]:value}); } ``` 계산된 속성명 사용해서 줄일 수 있어보입니다, passwordCheck, userIdCheck는 필요없는 값이니까 없애도 되보입니다. 그리고 check는 뭔가 체크박스가 체크되고 안되고 같지 않나요? isPasswordValid 등의 의미가 드러나고, boolean임을 알아볼 수 있는 네이밍을 해주세요
@@ -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
반복되는 UI로 보입니다, 상수데이터 + Array.map method 활용해서 표현해보세요
@@ -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
- `id` 보다는 `className` 을 활용해주시기 바랍니다. - HTML에서 `id` 는 문서 내에서 유일해야 합니다. 이러한 이유로 단일 요소를 다루는 경우 `id`를 사용할 수 있습니다. - 하지만 정말로 해당 요소에 대한 이벤트나 스타일 핸들링이 프로젝트 전체에서 단 한번만 사용 되는지 충분히 고민해야합니다. 일반적으로 컴포넌트는 재사용 될 수 있기 때문에 같은 요소가 여러번 생성될 수 있습니다. 이러한 이유로 보통의 경우에는 `className` 을 사용합니다.
@@ -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
inline-style보다 className을 동적으로 바꾸는 식으로 스타일링 해주세요
@@ -0,0 +1,20 @@ +import React from 'react'; + +class Content extends React.Component { + constructor(props) { + super(props); + } + + render() { + return ( + <li key={this.props.key} style={{ listStyle: 'none' }}> + <span style={{ fontWeight: 'bold', marginRight: '20px' }}> + {this.props....
JavaScript
state를 만들지 않을 경우 constructor 안해주셔도 됩니다!
@@ -0,0 +1,20 @@ +import React from 'react'; + +class Content extends React.Component { + constructor(props) { + super(props); + } + + render() { + return ( + <li key={this.props.key} style={{ listStyle: 'none' }}> + <span style={{ fontWeight: 'bold', marginRight: '20px' }}> + {this.props....
JavaScript
key props은 Array.map method를 활용하여 여러 엘리먼트를 생성할 때 부여해아하는 것인데 여기서는 map을 사용하고 있지 않습니다. key prop 부여하는 의미가 없어보입니다, 그리고 inline-style은 지양해주시고 className을 통한 스타일링 해주세요, 나머지 부분도 마찬가지입니다,
@@ -0,0 +1,26 @@ +import React from 'react'; + +class InputForm extends React.Component { + constructor(props) { + super(props); + } + + render() { + return ( + <form onSubmit={this.addContent}> + <input + name="comment" + className="replyInput" + type="text" + p...
JavaScript
currenState라는 함수는 보이지 않습니다! undefined가 할당되고 있을 것 같네요
@@ -0,0 +1,26 @@ +import React from 'react'; + +class InputForm extends React.Component { + constructor(props) { + super(props); + } + + render() { + return ( + <form onSubmit={this.addContent}> + <input + name="comment" + className="replyInput" + type="text" + p...
JavaScript
addContent도 마찬가지로 없어보입니다!
@@ -0,0 +1,183 @@ +import React from 'react'; +import { withRouter } from 'react-router'; +import './JaehyunMain.scss'; +import Nav from '../../../components/Nav/Nav'; +import Content from './Content/Content'; + +class JaehyunMain extends React.Component { + constructor(props) { + super(props); + + this.state = ...
JavaScript
```suggestion this.setState({ newContent }); ``` 객체 단축 속성명을 이용할 수 있습니다.
@@ -0,0 +1,183 @@ +import React from 'react'; +import { withRouter } from 'react-router'; +import './JaehyunMain.scss'; +import Nav from '../../../components/Nav/Nav'; +import Content from './Content/Content'; + +class JaehyunMain extends React.Component { + constructor(props) { + super(props); + + this.state = ...
JavaScript
alt 속성이 최상단에 위치하도록 순서 조정해주세요
@@ -0,0 +1,183 @@ +import React from 'react'; +import { withRouter } from 'react-router'; +import './JaehyunMain.scss'; +import Nav from '../../../components/Nav/Nav'; +import Content from './Content/Content'; + +class JaehyunMain extends React.Component { + constructor(props) { + super(props); + + this.state = ...
JavaScript
className 사용해주세요
@@ -0,0 +1,280 @@ +.JaehyunMain { + .fixedTop { + position: fixed; + top: 0; + left: 0; + right: 0; + background-color: white; + border-bottom: 2px solid #ebebeb; + + nav { + display: flex; + justify-content: space-between; + padding: 15px; + max-width: 1100px; + width: 10...
Unknown
최상위 네스팅하는 요소의 클래스네임은 컴포넌트 명과 동일하게 부여해주시고, 클래스 네임을 이용해서 최상위 네스팅을 해주시는게 다른 컴포넌트와 css 충돌이 발생할 확률을 낮출 수 있습니다.
@@ -0,0 +1,280 @@ +.JaehyunMain { + .fixedTop { + position: fixed; + top: 0; + left: 0; + right: 0; + background-color: white; + border-bottom: 2px solid #ebebeb; + + nav { + display: flex; + justify-content: space-between; + padding: 15px; + max-width: 1100px; + width: 10...
Unknown
section은 이미 display:block의 속성이기때문에, width:100%를 부여할 필요가 없습니다.
@@ -0,0 +1,280 @@ +.JaehyunMain { + .fixedTop { + position: fixed; + top: 0; + left: 0; + right: 0; + background-color: white; + border-bottom: 2px solid #ebebeb; + + nav { + display: flex; + justify-content: space-between; + padding: 15px; + max-width: 1100px; + width: 10...
Unknown
가능한 태그 셀렉터보다 클래스네임을 부여해서 선택해주세요! 태그셀렉터를 사용할 경우 다른 요소들에 영향을 미칠 여지가 있습니다!
@@ -0,0 +1,280 @@ +.JaehyunMain { + .fixedTop { + position: fixed; + top: 0; + left: 0; + right: 0; + background-color: white; + border-bottom: 2px solid #ebebeb; + + nav { + display: flex; + justify-content: space-between; + padding: 15px; + max-width: 1100px; + width: 10...
Unknown
이렇게 자주 사용하는 속성들은 mixin으로 만들어서 사용해도 좋겠네요
@@ -0,0 +1,280 @@ +.JaehyunMain { + .fixedTop { + position: fixed; + top: 0; + left: 0; + right: 0; + background-color: white; + border-bottom: 2px solid #ebebeb; + + nav { + display: flex; + justify-content: space-between; + padding: 15px; + max-width: 1100px; + width: 10...
Unknown
연욱님 리뷰 너무 감사합니다!
@@ -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,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
옵셔널 처리에 대해 공부하는건 분명 나중에 좋은 자산이 될거에여!