code
stringlengths
41
34.3k
lang
stringclasses
8 values
review
stringlengths
1
4.74k
@@ -0,0 +1,35 @@ +package store.custom.model.product; + +public class Product { + private final String name; + private final int price; + private int quantity; + private final String promotion; + + public Product(String name, int price, int quantity, String promotion) { + this.name = name; + ...
Java
그 생각을 못해봤네요! 확실히 프로모션 객체를 참조하면 더 좋을 것 같네요!
@@ -0,0 +1,153 @@ +package store.custom.service.editor; + +import static store.custom.constants.StringConstants.AFTER_PROMOTION_END; +import static store.custom.constants.StringConstants.BEFORE_PROMOTION_START; +import static store.custom.constants.StringConstants.RESPONSE_NO; +import static store.custom.constants.Stri...
Java
OrdersheetEditor의 역할을 이미 생성된 주문서의 변경(주문서의 초기 설정, 프로모션 내용 적용)으로 생각하고 작성하였는데, 객체가 가질 수 있는 역할의 범위를 잘 파악하지 못해 기본적인 것을 제외하고 editor에 모두 작성하였습니다. 모델 내부에서 책임을 가져갈 수 있는 부분을 고민해 보아야겠습니다. 좋은 의견 감사합니다!
@@ -0,0 +1,153 @@ +package store.custom.service.editor; + +import static store.custom.constants.StringConstants.AFTER_PROMOTION_END; +import static store.custom.constants.StringConstants.BEFORE_PROMOTION_START; +import static store.custom.constants.StringConstants.RESPONSE_NO; +import static store.custom.constants.Stri...
Java
칭찬해주셔서 감사합니다!
@@ -0,0 +1,369 @@ +# 4주 차 - 편의점 + +--- +## 기능 요구사항 + +--- + +구매자의 할인 혜택과 재고 상황을 고려하여 최종 결제 금액을 계산하고 안내하는 결제 시스템을 구현한다. + +* 사용자가 입력한 상품의 가격과 수량을 기반으로 최종 결제 금액을 계산한다. + * 총구매액은 상품별 가격과 수량을 곱하여 계산하며, 프로모션 및 멤버십 할인 정책을 반영하여 최종 결제 금액을 산출한다. +* 구매 내역과 산출한 금액 정보를 영수증으로 출력한다. +* 영수증 출력 후 추가 구매를 진행할지 또는 종료할지를 선택할 수 있다. +* 사...
Unknown
이번 미션이 정말 복잡해서 어려웠는데 저도 설계를 진행할때 플로우 차트와 비슷하게 동작 과정을 정리하고 개발을 진행했던것 같은데 문상휘님도 비슷하게 진행한 것 보고 놀랐네요
@@ -0,0 +1,137 @@ +package store.controller; + +import camp.nextstep.edu.missionutils.DateTimes; +import java.util.ArrayList; +import java.util.List; +import store.domain.BuyProductParser; +import store.domain.BuyProducts; +import store.domain.FileReader; +import store.domain.CustomerReceipt; +import store.domain.Produ...
Java
다른 사람들의 코드를 몰래몰래 봤을때 이런씩으로 처리해서 변수를 줄이는 방법도 있더군요. 시각에 따라 좋을수도 있고 안좋다고 생각할 수도 있지만 코드보다가 생각나서 넣어둘게요 ```suggestion do { showInventory(products); BuyProducts buyProducts = buyProducts(promotions, products); CustomerReceipt customerReceipt = makeCustomerReceipt(products, bu...
@@ -0,0 +1,137 @@ +package store.controller; + +import camp.nextstep.edu.missionutils.DateTimes; +import java.util.ArrayList; +import java.util.List; +import store.domain.BuyProductParser; +import store.domain.BuyProducts; +import store.domain.FileReader; +import store.domain.CustomerReceipt; +import store.domain.Produ...
Java
뒤에 .equals(YES)라고 하는 경우 판단을 controller에서 진행하는 것보다는 view에서 YES면 true를 넣어 controller의 책임을 줄여주는것에 대해서는 어떻게 생각하시나요?
@@ -0,0 +1,137 @@ +package store.controller; + +import camp.nextstep.edu.missionutils.DateTimes; +import java.util.ArrayList; +import java.util.List; +import store.domain.BuyProductParser; +import store.domain.BuyProducts; +import store.domain.FileReader; +import store.domain.CustomerReceipt; +import store.domain.Produ...
Java
FileReader를 생성하는 것보다 의존성 주입을 통해 사용하시면 추후 프로모션을 가져오는 방법이 바뀌어도 쉽게 수정이 가능해질 것 같습니다.
@@ -0,0 +1,41 @@ +package store.domain; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import store.domain.vo.PromotionType; + +public class Promotions { + + private static final int BUY_INDEX = 1; + private static final int FREE_GET_INDEX = 2; + private static final i...
Java
List<List<String>>으로 정보를 뽑아내는 것은 도메인의 역할이 아닌 view의 역할에 더 가까운 것 같습니다. View에서 어느정도의 데이터를 가공한 후 DTO를 통해 product를 생성하는 것은 어떨까요?
@@ -0,0 +1,60 @@ +package store.domain; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import store.domain.vo.ProductQuantity; +import store.domain.vo.PromotionType; + +public class Promotion { + + private final PromotionType promotionType; + private final ProductQua...
Java
프로모션 생성 과정을 보면 현재 시간에 맞춰 프로모션 적용을 정하는데 재고를 넣는 시간대와 물품을 사는 시간이 다른 경우 문제가 생길 것 같습니다.
@@ -0,0 +1,137 @@ +package store.controller; + +import camp.nextstep.edu.missionutils.DateTimes; +import java.util.ArrayList; +import java.util.List; +import store.domain.BuyProductParser; +import store.domain.BuyProducts; +import store.domain.FileReader; +import store.domain.CustomerReceipt; +import store.domain.Produ...
Java
이렇게 여러번 호출이 된다면 IO작업이 늘어나게 되면서 성능적으로 아쉬움이 생길 수 있다고 생각합니다. List를 통해 한번에 보낸 후 IO작업을 통해 처리하시는것은 어떤가요?
@@ -0,0 +1,76 @@ +package store.view; + +import java.util.List; +import store.view.dto.response.BuyProductResponse; +import store.view.dto.response.ErrorResponse; +import store.view.dto.response.FreeProductResponse; +import store.view.dto.response.ProductCalculateResponse; + +public class OutputView { + + private st...
Java
format을 상수를 통해 처리하는 것은 어떤가요? 만약 출력 형식이 좀 달라진다면 수정이 더욱 번거로울것 같습니다.
@@ -0,0 +1,76 @@ +package store.view; + +import java.util.List; +import store.view.dto.response.BuyProductResponse; +import store.view.dto.response.ErrorResponse; +import store.view.dto.response.FreeProductResponse; +import store.view.dto.response.ProductCalculateResponse; + +public class OutputView { + + private st...
Java
System.lineSeparator를 통한 줄바꿈 처리 굉장히 좋은 것 같습니다.
@@ -0,0 +1,46 @@ +package store.domain.service; + +import java.util.ArrayList; +import java.util.List; +import store.domain.BuyProducts; +import store.domain.Product; +import store.domain.Products; +import store.view.dto.response.PromotionResponse; + +public class PromotionChecker { + + private static final int ZERO...
Java
프로모션을 확인하는 부분을 따로 뽑은 이유가 있을까요?
@@ -0,0 +1,137 @@ +package store.controller; + +import camp.nextstep.edu.missionutils.DateTimes; +import java.util.ArrayList; +import java.util.List; +import store.domain.BuyProductParser; +import store.domain.BuyProducts; +import store.domain.FileReader; +import store.domain.CustomerReceipt; +import store.domain.Produ...
Java
false와 isFreePromotion을 enum을 통한 상태를 나타내는 열거형으로 하는 것은 어떨까요?
@@ -0,0 +1,137 @@ +package store.controller; + +import camp.nextstep.edu.missionutils.DateTimes; +import java.util.ArrayList; +import java.util.List; +import store.domain.BuyProductParser; +import store.domain.BuyProducts; +import store.domain.FileReader; +import store.domain.CustomerReceipt; +import store.domain.Produ...
Java
이 부분을 outputView에서 순서를 관리하는 것이 더 좋을 것 같습니다
@@ -0,0 +1,137 @@ +package store.controller; + +import camp.nextstep.edu.missionutils.DateTimes; +import java.util.ArrayList; +import java.util.List; +import store.domain.BuyProductParser; +import store.domain.BuyProducts; +import store.domain.FileReader; +import store.domain.CustomerReceipt; +import store.domain.Produ...
Java
while조건 안에 true를 넣는 방식은 매우 좋지 못한 방식이라고 알고 있습니다. 따로 boolean값을 사용해서 조건을 넣는 것이 더 좋을 것 같습니다
@@ -0,0 +1,63 @@ +package store.domain; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import store.domain.exception.ProductErrorCode; +import store.domain.exception.ProductException; + +...
Java
Hash의 경우 사기적인 시간복잡도로 좋지만 특수한 상황에서는 Hash의 경우 굉장히 느려질 수 있다고 생각합니다. 따라서 Hash보단 느리지만 안정적인 성능을 가지는 TreeMap도 추천드립니다. 근데 TreeMap을 사용하면 예시와 다르게 정렬된다는 단점이 있습니다.
@@ -0,0 +1,168 @@ +## 고민사항 + +**고민** +~~~ +구현에 필요한 상품 목록과 행사 목록을 파일 입출력을 통해 불러온다. +src/main/resources/products.md과 +src/main/resources/promotions.md 파일을 이용한다. +~~~ +* 마크다운 파일에 있는 내용을 어떻게 불러와 코드에 적용시킬 수 있을까? + +**해결 과정** +* BufferedReader 를 사용하여 파일 내용의 한 줄씩 입력받는 형식으로 한다. +* 받아온 줄을 쉼표(,)로 구분하여 분리한다 +* 분리한 내용을 알맞게 원시값 ...
Unknown
README에 모두 작성하지 않고, 여러개로 분리하신 이유가 있을까요??
@@ -1,7 +1,19 @@ package store; +import store.controller.StoreController; +import store.domain.service.MemberShipCalculator; +import store.domain.service.PromotionCalculator; +import store.view.InputView; +import store.view.OutputView; + public class Application { public static void main(String[] args) { ...
Java
controller 내부에서 생성자 주입으로 이미 명시를 해두었는데, 객체 생성을 한번 더 하신 이유가 궁금해요! InputView와 OutputView는 static으로 호출하고 아래처럼 하시면 어떨까요?? ```suggestion StoreController storeController = new StoreController(new MemberShipCalculator(), new PromotionCalculateService()); ```
@@ -0,0 +1,79 @@ +package store.domain; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map.Entry; +import store.domain.vo.MemberShip; +import store.domain.vo.ProductQuantity; +import store.view.dto.response.BuyProductResponse; +import store.view.dto.response.Free...
Java
메서드명이 모두 직관적이어서 좋네요👍
@@ -0,0 +1,54 @@ +package store.domain; + +import java.io.BufferedReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import store.domain.exception.ProductErrorCode; +import store.domain.exception.ProductException; + +public class FileReader { + + ...
Java
List<List<String>>으로 구현하신 이유가 궁금합니다!
@@ -0,0 +1,45 @@ +package store.domain; + +import store.domain.exception.ProductErrorCode; +import store.domain.exception.ProductException; + +public enum ProductInfo { + + COKE("콜라", "1000"), + CIDER("사이다", "1000"), + ORANGE_JUICE("오렌지주스", "1800"), + SPARKLING_WATER("탄산수", "1200"), + WATER("물", "500"), ...
Java
해당 부분은 파일 내에 있는 내용을 활용해서 구현해야하지 않나용?? 따로 명시해두신 이유가 궁금합니다!
@@ -0,0 +1,76 @@ +package store.view; + +import java.util.List; +import store.view.dto.response.BuyProductResponse; +import store.view.dto.response.ErrorResponse; +import store.view.dto.response.FreeProductResponse; +import store.view.dto.response.ProductCalculateResponse; + +public class OutputView { + + private st...
Java
System.lineSeparator()를 활용할 수 있군요!! 배워갑니다:)
@@ -0,0 +1,6 @@ +package store.view.dto.request; + +public record MemberShipRequest( + boolean isMemberShip +) { +}
Java
불변임을 명시할 수 있는 record 사용 좋네요!!👏
@@ -0,0 +1,63 @@ +package store.domain; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import store.domain.exception.ProductErrorCode; +import store.domain.exception.ProductException; + +...
Java
parse 클래스는 domain보다 util 패키지 내에 있는게 적합하다고 생각하는데, 상휘님의 의견은 어떠신가요?
@@ -0,0 +1,54 @@ +package store.domain; + +import java.io.BufferedReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import store.domain.exception.ProductErrorCode; +import store.domain.exception.ProductException; + +public class FileReader { + + ...
Java
FileReader도 util 패키지 내에 있는게 적합하다고 생각합니다!
@@ -0,0 +1,86 @@ +package store.domain; + +import java.util.Objects; +import store.domain.vo.ProductName; +import store.domain.vo.ProductPrice; +import store.domain.vo.ProductQuantity; + +public class Product { + + private final ProductName name; + private final ProductPrice price; + private final ProductQuant...
Java
도메인 패키지 내에 클래스가 많은 것 같아요! product와 promotion 등의 패키지를 한번 더 만들어서 분리해주시면 도메인의 역할이 명확히 보일 것 같아요!
@@ -0,0 +1,63 @@ +package store.domain; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import store.domain.exception.ProductErrorCode; +import store.domain.exception.ProductException; + +...
Java
private 메서드로 메서드를 분리하는 것은 어떨까요?
@@ -0,0 +1,56 @@ +package store.domain; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import store.domain.exception.ProductErrorCode; +import store.domain.exception.ProductException; + +public class BuyProducts { + + private...
Java
반환해줄떄 데이터의 안정성을 지키기 위해 사용하셨군요 배워갑니다
@@ -0,0 +1,56 @@ +package store.domain; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import store.domain.exception.ProductErrorCode; +import store.domain.exception.ProductException; + +public class BuyProducts { + + private...
Java
저도 entry를 코테를 볼 때 별도의 클래스 작성이 필요없고 편해 많이 사용하는데 이는 가독성 면에서 많이 떨어진다고 느낍니다 이보다는 따로 DTO를 만드는게 나을것 같습니다
@@ -0,0 +1,56 @@ +package store.domain; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import store.domain.exception.ProductErrorCode; +import store.domain.exception.ProductException; + +public class BuyProducts { + + private...
Java
단순히 getProducts후 contains를 직접적으로 하기보단 Products에 public 메서드를 따로 두는 것은 어떤가요?
@@ -0,0 +1,79 @@ +package store.domain; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map.Entry; +import store.domain.vo.MemberShip; +import store.domain.vo.ProductQuantity; +import store.view.dto.response.BuyProductResponse; +import store.view.dto.response.Free...
Java
엔트리를 직접적으로 사용하는 경우 코드의 가독성이 떨어진다고 생각합니다. getKey(), getValue()과 같이 키와 값으로 나타내는 메서드는 코드를 읽는 사람에게 key는 무엇이지부터 시작하게 되어 따로 만드는게 좋을것같습니다
@@ -0,0 +1,28 @@ +# 기능 요구 사항 + +1. 상품 목록 조회 + + - [x] API를 통해 상품 목록을 가져올 수 있다. + - [x] 맨 처음 API 호출 시 20개의 목록을 불러온다. + - [x] 이 후 추가 API 호출 시 4개의 목록을 불러온다. + - [x] 무한 스크롤을 할 수 있다. + +2. 상품 정렬 및 필터링 + + - [x] 상품 카테고리별 필터링을 할 수 있다. + - [x] 상품을 정렬 할 수 있다. (낮은 가격 순, 높은 가격 순) + +3. 상품 장바구니 담기 + + - [x] 사용자가 담기 버...
Unknown
사소하지만, 여기 마지막 부분 체크리스트가 빠져있네요! 아직 구현 못한 부분일까요?!
@@ -4,17 +4,21 @@ "version": "0.0.0", "type": "module", "scripts": { - "dev": "vite", + "dev": "vite --host", "build": "tsc && vite build", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview", "test": "vitest" }, "depend...
Unknown
제이드는 styled-components를 사용한 이유가 있을까요? 제이드의 의견이 궁금하네요! 🐫
@@ -0,0 +1,28 @@ +# 기능 요구 사항 + +1. 상품 목록 조회 + + - [x] API를 통해 상품 목록을 가져올 수 있다. + - [x] 맨 처음 API 호출 시 20개의 목록을 불러온다. + - [x] 이 후 추가 API 호출 시 4개의 목록을 불러온다. + - [x] 무한 스크롤을 할 수 있다. + +2. 상품 정렬 및 필터링 + + - [x] 상품 카테고리별 필터링을 할 수 있다. + - [x] 상품을 정렬 할 수 있다. (낮은 가격 순, 높은 가격 순) + +3. 상품 장바구니 담기 + + - [x] 사용자가 담기 버...
Unknown
++ README에 작성하기보다, REQUIREMENTS에 작성하신 이유가 있을까요?
@@ -4,17 +4,21 @@ "version": "0.0.0", "type": "module", "scripts": { - "dev": "vite", + "dev": "vite --host", "build": "tsc && vite build", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview", "test": "vitest" }, "depend...
Unknown
styled-component와 emotion 의 선택 사실 저는 둘 다사용해보고 emotion을 더 선호하지만, 이번 미션에서는 이 둘의 선택에 대해선 크루의 의견을 따랐습니다. emotion을 좀 더 선호하는 이유: styled-component를 다른파일에 계속 만들어 줄 필요 없음 동적인 css를 사용하고싶을 때 좀 더 편하다고 느꼈음 입니다.
@@ -0,0 +1,28 @@ +# 기능 요구 사항 + +1. 상품 목록 조회 + + - [x] API를 통해 상품 목록을 가져올 수 있다. + - [x] 맨 처음 API 호출 시 20개의 목록을 불러온다. + - [x] 이 후 추가 API 호출 시 4개의 목록을 불러온다. + - [x] 무한 스크롤을 할 수 있다. + +2. 상품 정렬 및 필터링 + + - [x] 상품 카테고리별 필터링을 할 수 있다. + - [x] 상품을 정렬 할 수 있다. (낮은 가격 순, 높은 가격 순) + +3. 상품 장바구니 담기 + + - [x] 사용자가 담기 버...
Unknown
요구사항이라서 REQUIREMENTS로 명명했습니다. README에는 프로젝트 내용에대한 소개 등을 쓰는 편인 것 같습니다
@@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Bucket + uuid = "F89D4C7C-1180-42EB-AF20-BEE64400FB01" + type = "1" + version = "2.0"> +</Bucket>
Unknown
이 파일은 무엇인가요 . .? gitignore 로 안올리는게 좋을것가탸요
@@ -10,11 +10,11 @@ import UIKit class HomeViewController: UIViewController { private var feeds: [Feed] = [ - Feed(username: "Woody", profileImage: "profileImage", title: "우럭먹다 받은 영감", hashTags: [HashTag(hashTag: "#Guitar"), HashTag(hashTag: "#Jazz")]), - Feed(username: "Woody", profileImage: ...
Swift
550의 의미는 무엇인가요 ! 의미가 있다면 let으로 명명해서 추후에 유지보수 때 알아보기 쉽게하는것이 좋을 듯합니다 ~
@@ -21,3 +21,25 @@ extension UICollectionViewCell { NSStringFromClass(self.classForCoder()).components(separatedBy: ".").last! } } + +extension UIImage { + + func applyBlur_usingClamp(radius: CGFloat) -> UIImage { + let context = CIContext() + guard let ciImage = CIImage(image: self), +...
Swift
Swift는 카멜케이스 ~ 🐫
@@ -21,3 +21,25 @@ extension UICollectionViewCell { NSStringFromClass(self.classForCoder()).components(separatedBy: ".").last! } } + +extension UIImage { + + func applyBlur_usingClamp(radius: CGFloat) -> UIImage { + let context = CIContext() + guard let ciImage = CIImage(image: self), +...
Swift
계속 extension이 늘어날 예정이라면 UIImage+.swift 로 별도로 빼면어떨까욥
@@ -20,27 +20,106 @@ class FeedCollectionViewCell: UICollectionViewCell { return stackView }() - // 상단 + // UpperBar private let feedUpperBar: UIStackView = { let stackView = UIStackView() stackView.axis = .horizontal stackView.distribution = .fill ...
Swift
```suggestion private let feedUpperBarStackView: UIStackView = { ``` class가 StackView인건 바로 알아보면 읽기 편할거같아용
@@ -20,27 +20,106 @@ class FeedCollectionViewCell: UICollectionViewCell { return stackView }() - // 상단 + // UpperBar private let feedUpperBar: UIStackView = { let stackView = UIStackView() stackView.axis = .horizontal stackView.distribution = .fill ...
Swift
```suggestion ``` 사용하지 않게되었다면 삭제
@@ -20,27 +20,106 @@ class FeedCollectionViewCell: UICollectionViewCell { return stackView }() - // 상단 + // UpperBar private let feedUpperBar: UIStackView = { let stackView = UIStackView() stackView.axis = .horizontal stackView.distribution = .fill ...
Swift
여기에 한줄씩 넣는건 우디만의 스타일인건가요? 그저 궁금쓰
@@ -20,27 +20,106 @@ class FeedCollectionViewCell: UICollectionViewCell { return stackView }() - // 상단 + // UpperBar private let feedUpperBar: UIStackView = { let stackView = UIStackView() stackView.axis = .horizontal stackView.distribution = .fill ...
Swift
property이름과 주석이 같다면 각 주석이 사라져도 되지 않을까요 ..?
@@ -10,11 +10,11 @@ import UIKit class HomeViewController: UIViewController { private var feeds: [Feed] = [ - Feed(username: "Woody", profileImage: "profileImage", title: "우럭먹다 받은 영감", hashTags: [HashTag(hashTag: "#Guitar"), HashTag(hashTag: "#Jazz")]), - Feed(username: "Woody", profileImage: ...
Swift
의미는 없읍니다.. 눈으로 대강 height 쟀습니다 let으로 변수 선언하는것은 해당 func 내부에 선언하는 것이 좋겠죠?
@@ -20,27 +20,106 @@ class FeedCollectionViewCell: UICollectionViewCell { return stackView }() - // 상단 + // UpperBar private let feedUpperBar: UIStackView = { let stackView = UIStackView() stackView.axis = .horizontal stackView.distribution = .fill ...
Swift
위에 주석 말씀이신가요?
@@ -20,27 +20,106 @@ class FeedCollectionViewCell: UICollectionViewCell { return stackView }() - // 상단 + // UpperBar private let feedUpperBar: UIStackView = { let stackView = UIStackView() stackView.axis = .horizontal stackView.distribution = .fill ...
Swift
주석은 저에게 일종의 영역 표시와 같습니다 굳이 존재하지 않아도 될수도 있지만 여기 뭔가가 있다라는 느낌적인 느낌이랄까요
@@ -20,27 +20,106 @@ class FeedCollectionViewCell: UICollectionViewCell { return stackView }() - // 상단 + // UpperBar private let feedUpperBar: UIStackView = { let stackView = UIStackView() stackView.axis = .horizontal stackView.distribution = .fill ...
Swift
키워드를 여러개 붙여도 되는군요? 생각도 안해봤습니다
@@ -10,11 +10,11 @@ import UIKit class HomeViewController: UIViewController { private var feeds: [Feed] = [ - Feed(username: "Woody", profileImage: "profileImage", title: "우럭먹다 받은 영감", hashTags: [HashTag(hashTag: "#Guitar"), HashTag(hashTag: "#Jazz")]), - Feed(username: "Woody", profileImage: ...
Swift
> 눈으로 대강 height 쟀습니다 🤔 ..????? > let으로 변수 선언하는것은 해당 func 내부에 선언하는 것이 좋겠죠? 물론이죠 !
@@ -20,27 +20,106 @@ class FeedCollectionViewCell: UICollectionViewCell { return stackView }() - // 상단 + // UpperBar private let feedUpperBar: UIStackView = { let stackView = UIStackView() stackView.axis = .horizontal stackView.distribution = .fill ...
Swift
L60과 같은 개행 이야기드린거였어요 !
@@ -20,27 +20,106 @@ class FeedCollectionViewCell: UICollectionViewCell { return stackView }() - // 상단 + // UpperBar private let feedUpperBar: UIStackView = { let stackView = UIStackView() stackView.axis = .horizontal stackView.distribution = .fill ...
Swift
개인적인 스타일이네요 ! 🙆
@@ -18,6 +18,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; +import java.util.stream.Collectors; @Slf4j @RestController @@ -26,12 +27,24 @@ public class OrderController { private final OrderService orderService; private final BasketService basketService; + + /* ...
Java
(C) 불필요한 IOException인 것 같습니다.
@@ -11,6 +11,7 @@ import java.io.IOException; +// (Q) Custom deserializer를 구현한 이유가 무엇인가요? Jackson 등의 serializer를 사용하기 어려운 부분이 있나요? public class StoreDeserializer extends StdDeserializer { public StoreDeserializer(){
Java
> 네 사실 Menu 데이터와는 다르게 Store 데이터는 Point라는 spring에서 제공하는 객체를 property로 가지고 있습니다. 그런데 objectMapper의 readValue()로는 Store.class를 바로 역직렬화시키지 못하는데 그건 바로 Point를 objectMapper가 해석하지 못하기 때문이더라고요. JSONObject.get()을 사용해서 하나하나 까서 역직렬화해도 됐지만, convertStoreData() 메서드가 길어지는 게 보기 싫어서 Custom deserializer를 사용해서 한방에 처리되게끔 보이도록(?) 했습니다. 사실 D...
@@ -5,27 +5,32 @@ import org.springframework.web.bind.annotation.*; import java.util.ArrayList; +import java.util.Arrays; import java.util.EnumSet; import java.util.List; +import java.util.stream.Collectors; @RestController -@RequestMapping("/customer") +@RequestMapping("/customer") // (R) HomeController에서 url...
Java
>HomeController의 home()은 특별한 이유 없이 초기에 서버가 잘 돌아가는지 테스트 하려고 넣어놓은 테스트 용도의 코드입니다. Customer, Restaurant, Rider 세가지 서버를 띄우다보니 White Error 페이지로는 헷갈려서 임시로 작성했던 코드인데, 테스트 용도기 때문에 없어도 문제가 없습니다. 해당 코드에는 주석을 넣어야 했었네요. > customer, restaurant, rider 서버 모두 home controller를 가지고 있는데, 사실 주 용도는 서버가 돌아가는지 보려고 만들어둔 것입니다. url prefix도 컨트...
@@ -18,6 +18,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; +import java.util.stream.Collectors; @Slf4j @RestController @@ -26,12 +27,24 @@ public class OrderController { private final OrderService orderService; private final BasketService basketService; + + /* ...
Java
> Customer당 Basket은 하나만 가진다고 생각해서 CustomerId를 바로 BasketId로 사용했습니다. 물론 동일한 값을 id로 사용하시는 것도 기능 동작에 문제가 없겠지만, basketId에 customerId를 그대로 사용하는 것은 일단 코드의 의도 파악이 어렵고, 이후 부여되는 id를 기반으로 데이터를 검색할텐데 그 때도 실수를 유발할 여지가 있는 것 같습니다. 코드 수준에서 실수를 예방할 수 있는 부분이 있다면 항상 방어하도록 작성하는 것이 좋은 것 같습니다!
@@ -18,6 +18,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; +import java.util.stream.Collectors; @Slf4j @RestController @@ -26,12 +27,24 @@ public class OrderController { private final OrderService orderService; private final BasketService basketService; + + /* ...
Java
> Repository에서 습관적으로 create이후 id를 반환하는 로직을 사용하다보니 이렇게 작성했는데, 생각해보니 order 자체를 가져오면 getOrder()도 사용하지 않아도 되니 쿼리 한 번을 절약하겠군요. 지적해주셔서 감사합니다. 말씀해주신 부분도 order 객체로 처리하는 것의 장점으로 볼 수 있을 것 같습니다. 다만 제가 리뷰드린 관점은 조금 다른 부분입니다. string 타입은 범용적인 primitive 타입이기 때문에, 클래스 자체로써는 큰 의미를 갖지 않습니다. (단지 string의 역할을 하는 기능들을 제공할 뿐이겠죠) 하지만...
@@ -11,6 +11,7 @@ import java.io.IOException; +// (Q) Custom deserializer를 구현한 이유가 무엇인가요? Jackson 등의 serializer를 사용하기 어려운 부분이 있나요? public class StoreDeserializer extends StdDeserializer { public StoreDeserializer(){
Java
네 동일한 변수명으로 처리했지만, custom deserializer를 사용하지 않으면 다음과 같은 에러가 발생합니다. _Cannot construct instance of `org.springframework.data.geo.Point` (no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator)_ Point라는 객체를 objectMapper가 모르기 때문에 발생한 일이라고 하더군요. 아래는 c...
@@ -11,6 +11,7 @@ import java.io.IOException; +// (Q) Custom deserializer를 구현한 이유가 무엇인가요? Jackson 등의 serializer를 사용하기 어려운 부분이 있나요? public class StoreDeserializer extends StdDeserializer { public StoreDeserializer(){
Java
@millwheel 아 Point가 기본 생성자가 없군요. 제가 알고있는 일반적인 serializer의 deserialize 방식은, 먼저 기본 생성자로 객체를 생성하고 setter를 통해 객체 필드를 setting하는 방식으로 알고 있습니다. 그런데 기본 생성자가 없다보니 객체를 생성하는 과정에서 에러가 나는 것 같네요~ 사실 point 클래스와 관련해서도 리뷰 드리려고 했는데, 이후 관련 리뷰에서 더 얘기해보겠습니다~
@@ -19,11 +19,16 @@ @RestController @Slf4j +/* + (C) foodKind는 QueryParam으로 받는 것이 더 restful 해보입니다. + 또한 showStoreInfo에서는 foodKind를 사용하지 않기 때문에, 개별 메서드에서 맵핑하는 것이 좋아 보입니다. +*/ @RequestMapping("/customer/{foodKind}/store") public class StoreController { private final MemberService memberService; priv...
Java
> Q) @RequiredArgConstructor를 Entity에서 사용하는 경우 입력된 Property의 순서를 바꿨을 때 때 같은 타입의 property라면 문제가 되는 경우가 있더라고요. 생성자를 생성할 때 매개변수 입력 순서를 바꾸지 않아도 컴파일 과정에서 에러가 발생하지 않아서 잘못된 값이 들어와도 캐치할 수 없어서 아예 @RequiredArgConstructor를 사용하지 말자고 하는 글도 봤었습니다. 물론 Controller라서 같은 타입의 property가 없으니까 여기선 문제가 없겠지만, 실제로 @requiredargsconstructor를 편의상 ...
@@ -0,0 +1,162 @@ +package store.controller; + +import static store.controller.PromotionController.getValidInput; + +import java.text.NumberFormat; +import java.util.List; +import store.model.Receipt; +import store.view.InputView; +import store.view.OutputView; +import store.view.error.ErrorException; +import store.vie...
Java
제가 저번에는 재귀 함수가 안좋지 않을까라는 식으로 얘기를 하였지만 작년 3주차 피드백을 보니 재귀함수로 처리할 수 있다는 내용이 있더군요... 코드를 줄일 수 있다면 재귀도 좋은 것 같습니다!
@@ -0,0 +1,162 @@ +package store.controller; + +import static store.controller.PromotionController.getValidInput; + +import java.text.NumberFormat; +import java.util.List; +import store.model.Receipt; +import store.view.InputView; +import store.view.OutputView; +import store.view.error.ErrorException; +import store.vie...
Java
저도 몰랐던 내용이지만 String format과 %-8s(8칸만큼 왼쪽정렬 이런식으로 사용해서 정렬을 시도하더군요
@@ -0,0 +1,306 @@ +package store.controller; + +import camp.nextstep.edu.missionutils.DateTimes; +import java.time.LocalDateTime; +import java.util.List; +import java.util.function.Function; +import java.util.function.Supplier; +import store.model.Product; +import store.model.ProductStock; +import store.model.Promotion...
Java
enum을 사용해서 처리할 수 있는 부분입니다!
@@ -1,7 +1,26 @@ package store; + +import store.controller.FrontController; +import store.controller.ProductController; +import store.controller.PromotionController; +import store.view.InputView; +import store.view.OutputView; + + public class Application { + + public static void main(String[] args) { - ...
Java
클래스명으로 의미를 알 수 있으므로 메소드명에 표현안해도 될 거 같습니다
@@ -0,0 +1,29 @@ +import ItemCard from "@/components/ItemCard"; +import styled from "styled-components"; +import { flexCenter } from "@/styles/common"; +import { Product } from "@/types/products"; +import SeaOtterVideo from "@/components/SeaOtterVideo"; + +const ItemCardList = ({ products, isLoading }: { products: Prod...
Unknown
여기서 product.id 가 key 값이 아니라 Math.random 으로 주신 이유가 따로 있으실까용 ??
@@ -0,0 +1,15 @@ +import * as S from "@/components/Header/style"; + +export const HeaderMain = ({ children }: React.PropsWithChildren) => { + return <S.Header>{children}</S.Header>; +}; + +export const Title = ({ text }: { text: string }) => { + return <S.Title>{text}</S.Title>; +}; + +const Header = Object.assign(He...
Unknown
너무 좋아요~!
@@ -0,0 +1,29 @@ +import ItemCard from "@/components/ItemCard"; +import styled from "styled-components"; +import { flexCenter } from "@/styles/common"; +import { Product } from "@/types/products"; +import SeaOtterVideo from "@/components/SeaOtterVideo"; + +const ItemCardList = ({ products, isLoading }: { products: Prod...
Unknown
서버에서 간헐적으로 중복된 key 를 반환하는 문제가 있어서 한 번씩 동일한 key 값으로 에러가 발생하기에 random 값을 key 로 설정해줬어요!
@@ -0,0 +1,33 @@ +public class Calculator { + public double calculate(String expression) { + String[] tokens = expression.split(" "); + double currentResult = Double.parseDouble(tokens[0]); + + for (int i = 1; i < tokens.length; i += 2) { + String operator = tokens[i]; + do...
Java
Enum을 사용해서 switch문을 사용하지 않는 방향으로 코드를 작성해봅시다
@@ -0,0 +1,33 @@ +public class Calculator { + public double calculate(String expression) { + String[] tokens = expression.split(" "); + double currentResult = Double.parseDouble(tokens[0]); + + for (int i = 1; i < tokens.length; i += 2) { + String operator = tokens[i]; + do...
Java
Calculator 클래스의 책임은 무엇인가요. 한 클래스에 여러 개의 책임이 있는 것 같습니다. SCP에 대해서 공부해보고 코드를 작성해주세요
@@ -0,0 +1,34 @@ +public class Validator { + public boolean isValid(String expression) { + String[] tokens = expression.split(" "); + + if (tokens.length % 2 == 0) { + return false; + } + + if (!isNumeric(tokens[0])) { + return false; + } + + for (int i...
Java
한 메소드가 많은 역할을 해주는 것 같습니다. 각각의 if문을 여러 메소드로 나누어보세요.
@@ -1,5 +1,22 @@ +import java.util.Scanner; + public class Main { public static void main(String[] args) { - System.out.println("1 + 1 = 2"); + Scanner scanner = new Scanner(System.in); + System.out.println("계산할 수식을 입력하세요 (예: 30 + 20 / 2 * 4):"); + String expression = scanner.nextLine(...
Java
Main 클래스에 너무 많은 책임이 있습니다. SCP에 대해서 공부 해보고 코드를 작성해주세요 * 콘솔에 프린트해주는 것도 하나의 책임으로 봅니다
@@ -0,0 +1,519 @@ +import React, { Component } from 'react'; +import * as d3 from 'd3'; +import drawData from './Module/loadHandle'; +import FilterContainer from './Components/FilterContainer'; +import LoginModal from './Components/LoginModal'; +import DrawContainer from './Components/DrawContainer'; +import './l...
JavaScript
상수로 빼놓는게 좋을듯. `server/categories.js`에도 정의되어있고 server나 client나 같이 쓰게 될텐데 어떻게 처리할지 정하는게 좋을듯
@@ -0,0 +1,519 @@ +import React, { Component } from 'react'; +import * as d3 from 'd3'; +import drawData from './Module/loadHandle'; +import FilterContainer from './Components/FilterContainer'; +import LoginModal from './Components/LoginModal'; +import DrawContainer from './Components/DrawContainer'; +import './l...
JavaScript
`idle` 이벤트가 브라우저 창 크기를 변경할때 너무 자주 발생하므로 debounce 처리하는게 좋겠음
@@ -0,0 +1,519 @@ +import React, { Component } from 'react'; +import * as d3 from 'd3'; +import drawData from './Module/loadHandle'; +import FilterContainer from './Components/FilterContainer'; +import LoginModal from './Components/LoginModal'; +import DrawContainer from './Components/DrawContainer'; +import './l...
JavaScript
입력값도 없고, 리턴값도 고정값인데 함수로 만들어서 반환할 이유가 없어보임.
@@ -0,0 +1,519 @@ +import React, { Component } from 'react'; +import * as d3 from 'd3'; +import drawData from './Module/loadHandle'; +import FilterContainer from './Components/FilterContainer'; +import LoginModal from './Components/LoginModal'; +import DrawContainer from './Components/DrawContainer'; +import './l...
JavaScript
`mainPageLoad`에서 데이터 로딩이 끝나는 시점에 맞게 기존핀을 제거하는 `DataDelete`를 처리해야할듯 함.
@@ -0,0 +1,519 @@ +import React, { Component } from 'react'; +import * as d3 from 'd3'; +import drawData from './Module/loadHandle'; +import FilterContainer from './Components/FilterContainer'; +import LoginModal from './Components/LoginModal'; +import DrawContainer from './Components/DrawContainer'; +import './l...
JavaScript
이후에 ```suggestion } else { this.drawList[el.id].setMap(null); delete this.drawList[el.id]; } ``` 이렇게 해야하지 않을까?
@@ -0,0 +1,519 @@ +import React, { Component } from 'react'; +import * as d3 from 'd3'; +import drawData from './Module/loadHandle'; +import FilterContainer from './Components/FilterContainer'; +import LoginModal from './Components/LoginModal'; +import DrawContainer from './Components/DrawContainer'; +import './l...
JavaScript
필요없음 제거
@@ -0,0 +1,519 @@ +import React, { Component } from 'react'; +import * as d3 from 'd3'; +import drawData from './Module/loadHandle'; +import FilterContainer from './Components/FilterContainer'; +import LoginModal from './Components/LoginModal'; +import DrawContainer from './Components/DrawContainer'; +import './l...
JavaScript
갑자기 왜 대문자로 시작할까요? 이름도 `deleteDraw` / `unsetDraw` 등으로 해야할 듯
@@ -0,0 +1,519 @@ +import React, { Component } from 'react'; +import * as d3 from 'd3'; +import drawData from './Module/loadHandle'; +import FilterContainer from './Components/FilterContainer'; +import LoginModal from './Components/LoginModal'; +import DrawContainer from './Components/DrawContainer'; +import './l...
JavaScript
`0.01`을 상수처리
@@ -0,0 +1,519 @@ +import React, { Component } from 'react'; +import * as d3 from 'd3'; +import drawData from './Module/loadHandle'; +import FilterContainer from './Components/FilterContainer'; +import LoginModal from './Components/LoginModal'; +import DrawContainer from './Components/DrawContainer'; +import './l...
JavaScript
이것만 underscore로 시작하는 이유가 모에요? 그리고 네이밍으로 무슨 일을 하는 메서드인지 알아채기 힘드네요.
@@ -0,0 +1,519 @@ +import React, { Component } from 'react'; +import * as d3 from 'd3'; +import drawData from './Module/loadHandle'; +import FilterContainer from './Components/FilterContainer'; +import LoginModal from './Components/LoginModal'; +import DrawContainer from './Components/DrawContainer'; +import './l...
JavaScript
리턴값이 기존값인게 이상한데, 살펴보니 리턴값 받아서 쓰는데도 없는거 같아요.
@@ -0,0 +1,519 @@ +import React, { Component } from 'react'; +import * as d3 from 'd3'; +import drawData from './Module/loadHandle'; +import FilterContainer from './Components/FilterContainer'; +import LoginModal from './Components/LoginModal'; +import DrawContainer from './Components/DrawContainer'; +import './l...
JavaScript
이후 코드가 `mainPageLoad`랑 중복되는 부분이 많은데 일반화 해야겠네요.
@@ -0,0 +1,519 @@ +import React, { Component } from 'react'; +import * as d3 from 'd3'; +import drawData from './Module/loadHandle'; +import FilterContainer from './Components/FilterContainer'; +import LoginModal from './Components/LoginModal'; +import DrawContainer from './Components/DrawContainer'; +import './l...
JavaScript
style을 inline으로 직접 지정하는 것 보다는 style은 `less(css)`에 정의하고 class명을 toggle 하는 방식을 쓰는게 좋아요.
@@ -0,0 +1,519 @@ +import React, { Component } from 'react'; +import * as d3 from 'd3'; +import drawData from './Module/loadHandle'; +import FilterContainer from './Components/FilterContainer'; +import LoginModal from './Components/LoginModal'; +import DrawContainer from './Components/DrawContainer'; +import './l...
JavaScript
여기도 마찬가지
@@ -0,0 +1,519 @@ +import React, { Component } from 'react'; +import * as d3 from 'd3'; +import drawData from './Module/loadHandle'; +import FilterContainer from './Components/FilterContainer'; +import LoginModal from './Components/LoginModal'; +import DrawContainer from './Components/DrawContainer'; +import './l...
JavaScript
`closeFn` 이렇게 postfix로 네이밍하는 것도 다른 함수들과는 다른 방식으로 처리되었네요. 통일성을 위해 그냥 떼는게 좋겠음. `onClose` 정도나, 혹은 아래쪽엔 `handle~` 이런식으로 썼으니 `handleToggle` 뭐 이런식이어도 좋겠고요.
@@ -0,0 +1,62 @@ +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; +import Drawing from './Drawing'; +import '../less/Toolbox.less'; + +class DrawContainer extends Component { + static propTypes = { + drawingData: PropTypes.array.isRequired, + mapLoad: PropTypes.ob...
JavaScript
less 로 빼내기
@@ -0,0 +1,62 @@ +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; +import Drawing from './Drawing'; +import '../less/Toolbox.less'; + +class DrawContainer extends Component { + static propTypes = { + drawingData: PropTypes.array.isRequired, + mapLoad: PropTypes.ob...
JavaScript
{``} 로 감쌀 필요가 없음
@@ -0,0 +1,438 @@ +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; +import '../less/Drawing.less'; +import Button from '../Module/Button'; +import Line from '../CustomOverlay/Line'; +import Arrow from '../CustomOverlay/Arrow'; +import Circle from '../CustomOverlay/Circle'; +import ...
JavaScript
key 정의 안되었음
@@ -0,0 +1,438 @@ +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; +import '../less/Drawing.less'; +import Button from '../Module/Button'; +import Line from '../CustomOverlay/Line'; +import Arrow from '../CustomOverlay/Arrow'; +import Circle from '../CustomOverlay/Circle'; +import ...
JavaScript
상수로 뺄것. 고정된 값이라면 state로 정의할 필요없음.
@@ -0,0 +1,438 @@ +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; +import '../less/Drawing.less'; +import Button from '../Module/Button'; +import Line from '../CustomOverlay/Line'; +import Arrow from '../CustomOverlay/Arrow'; +import Circle from '../CustomOverlay/Circle'; +import ...
JavaScript
icons에 대응하는 overlay 의 형태인거 같은데 상수로 빼서 `const SHAPES = [{ icons: 'line', overlay: Line }, ...]` 이런식으로 정의하는게 좋겠음.
@@ -0,0 +1,438 @@ +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; +import '../less/Drawing.less'; +import Button from '../Module/Button'; +import Line from '../CustomOverlay/Line'; +import Arrow from '../CustomOverlay/Arrow'; +import Circle from '../CustomOverlay/Circle'; +import ...
JavaScript
break; 안하면 배열 계속 순회함.
@@ -0,0 +1,96 @@ +import React, { Component } from 'react'; +import '../less/Filter.less'; +import PropTypes from 'prop-types'; +import FilterBox from './FilterBox'; +import * as constants from '../constants'; + +class Filter extends Component { + static propTypes = { + MyInfoButton: PropTypes.bool.is...
JavaScript
상수...
@@ -0,0 +1,96 @@ +import React, { Component } from 'react'; +import '../less/Filter.less'; +import PropTypes from 'prop-types'; +import FilterBox from './FilterBox'; +import * as constants from '../constants'; + +class Filter extends Component { + static propTypes = { + MyInfoButton: PropTypes.bool.is...
JavaScript
css로 빼내기
@@ -0,0 +1,96 @@ +import React, { Component } from 'react'; +import '../less/Filter.less'; +import PropTypes from 'prop-types'; +import FilterBox from './FilterBox'; +import * as constants from '../constants'; + +class Filter extends Component { + static propTypes = { + MyInfoButton: PropTypes.bool.is...
JavaScript
감쌀필요 없음
@@ -0,0 +1,45 @@ +package calculator.model; + +import java.util.HashMap; +import java.util.Map; +import java.util.function.BiFunction; + +public enum OperatorType { + ADDITION("+", (a, b) -> a + b), + SUBTRACTION("-", (a, b) -> a - b), + MULTIPLICATION("*", (a, b) -> a * b), + DIVISION("/", (a, b) -> { + ...
Java
이렇게 문자열을 리턴해줄 필요가 있을까요?
@@ -0,0 +1,17 @@ +package calculator.model; + +public class Operator { + + public int calculate(String[] values) { + int result = Integer.parseInt(values[0]); + + for (int i = 1; i < values.length; i += 2) { + String symbol = values[i]; + int nextNumber = Integer.parseInt(values[i...
Java
Enum 사용법을 다시 공부해서 적용해봅시다. Switch문을 사용하지 않는 방식으로요.
@@ -0,0 +1,11 @@ +package calculator.view; + +import java.util.Scanner; + +public class InputView { + public String formulaInput() { + Scanner scanner = new Scanner(System.in); + System.out.print("수식을 입력하세요 : "); + return scanner.nextLine(); + } +} \ No newline at end of file
Java
클래스에 역할이 두 가지 존재합니다 1. 문자열을 받는다 2. 문자열을 나눈다 클래스의 책임과 역할에 대해서 생각해봅시다
@@ -0,0 +1,27 @@ +package calculator.controller; + +import calculator.model.Operator; +import calculator.util.FormulaParser; +import calculator.view.InputView; +import calculator.view.OutputView; + +public class CalculatorController { + private final Operator operator; + private final InputView inputView; + pr...
Java
이 변수가 어떤 역할을 하는 변수인지 변수명만 보고 알 수 있게 만들어주세요
@@ -0,0 +1,17 @@ +package calculator.model; + +public class Operator { + + public int calculate(String[] values) { + int result = Integer.parseInt(values[0]); + + for (int i = 1; i < values.length; i += 2) { + String symbol = values[i]; + int nextNumber = Integer.parseInt(values[i...
Java
이렇게 해줄 거면 필드에서 직접적으로 선언해주는 것이 더 깔끔합니다
@@ -0,0 +1,45 @@ +package calculator.model; + +import java.util.HashMap; +import java.util.Map; +import java.util.function.BiFunction; + +public enum OperatorType { + ADDITION("+", (a, b) -> a + b), + SUBTRACTION("-", (a, b) -> a - b), + MULTIPLICATION("*", (a, b) -> a * b), + DIVISION("/", (a, b) -> { + ...
Java
이 메소드가 static 메소드여야만 하는 이유가 있나요?