ewhk9887/korean_code_reviews_from_github huggingface dataset:
@@ -0,0 +1,65 @@
+package menu.controller;
+
+import camp.nextstep.edu.missionutils.Randoms;
+import menu.model.Coach;
+import menu.model.MenuRepository;
+import menu.view.InputView;
+import menu.view.OutputView;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.IntStream;
+
+public class MenuController {
+    MenuRepository menuRepository = new MenuRepository();
+    Validate validate = new Validate();
+    List<Coach> coaches = new ArrayList<>();
+    int[] category;
+
+    public void run() {
+        OutputView.printStart();
+        setCoaches();
+        OutputView.printResultIntro();
+        setCategory();
+        OutputView.printCategory(category);
+        coaches.forEach(this::menuRecommendations);
+    }
+
+    private void setCoaches() {
+        OutputView.printInsertCoach();
+        String[] inputCoaches = InputView.insertCoach().split(",");
+        if (!validate.validateCoach(inputCoaches)) {
+            setCoaches();
+            return;
+        }
+        for (String inputCoach : inputCoaches) {
+            Coach coach = new Coach(inputCoach);
+            OutputView.printInsertNotFood(coach.getName());
+            String[] NotFood = InputView.insertNotFood().split(",");
+            Arrays.stream(NotFood).forEach(coach::addNotFood);
+            coaches.add(coach);
+        }
+    }
+
+    private void setCategory() {
+        category = new int[5];
+        IntStream.range(0, 5).forEach(i -> category[i] = Randoms.pickNumberInRange(1, 5));
+    }
+
+    private void menuRecommendations(Coach coach) {
+        String[] menus = new String[5];
+        for (int i = 0; i < 5; i++) {
+            menus[i] = selectMenu(i, coach);
+        }
+        OutputView.printMenu(coach.getName(), menus);
+    }
+
+    private String selectMenu(int index, Coach coach) {
+        String menu = menuRepository.getMenu(category[index]);
+        if (!coach.checkMenu(menu)) {
+            return selectMenu(index, coach);
+        }
+        return menu;
+    }
+}

리뷰: 컬렉션 대신 배열을 사용한 이유가 있을까요!?
@@ -0,0 +1,65 @@
+package menu.controller;
+
+import camp.nextstep.edu.missionutils.Randoms;
+import menu.model.Coach;
+import menu.model.MenuRepository;
+import menu.view.InputView;
+import menu.view.OutputView;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.IntStream;
+
+public class MenuController {
+    MenuRepository menuRepository = new MenuRepository();
+    Validate validate = new Validate();
+    List<Coach> coaches = new ArrayList<>();
+    int[] category;
+
+    public void run() {
+        OutputView.printStart();
+        setCoaches();
+        OutputView.printResultIntro();
+        setCategory();
+        OutputView.printCategory(category);
+        coaches.forEach(this::menuRecommendations);
+    }
+
+    private void setCoaches() {
+        OutputView.printInsertCoach();
+        String[] inputCoaches = InputView.insertCoach().split(",");
+        if (!validate.validateCoach(inputCoaches)) {
+            setCoaches();
+            return;
+        }
+        for (String inputCoach : inputCoaches) {
+            Coach coach = new Coach(inputCoach);
+            OutputView.printInsertNotFood(coach.getName());
+            String[] NotFood = InputView.insertNotFood().split(",");
+            Arrays.stream(NotFood).forEach(coach::addNotFood);
+            coaches.add(coach);
+        }
+    }
+
+    private void setCategory() {
+        category = new int[5];
+        IntStream.range(0, 5).forEach(i -> category[i] = Randoms.pickNumberInRange(1, 5));
+    }
+
+    private void menuRecommendations(Coach coach) {
+        String[] menus = new String[5];
+        for (int i = 0; i < 5; i++) {
+            menus[i] = selectMenu(i, coach);
+        }
+        OutputView.printMenu(coach.getName(), menus);
+    }
+
+    private String selectMenu(int index, Coach coach) {
+        String menu = menuRepository.getMenu(category[index]);
+        if (!coach.checkMenu(menu)) {
+            return selectMenu(index, coach);
+        }
+        return menu;
+    }
+}

리뷰: 관심사 분리 입장에서 보면 단일 메서드여도 별도 메서드로 분리하는 방향도 고려해볼만 한 것 같아요!
@@ -0,0 +1,65 @@
+package menu.controller;
+
+import camp.nextstep.edu.missionutils.Randoms;
+import menu.model.Coach;
+import menu.model.MenuRepository;
+import menu.view.InputView;
+import menu.view.OutputView;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.IntStream;
+
+public class MenuController {
+    MenuRepository menuRepository = new MenuRepository();
+    Validate validate = new Validate();
+    List<Coach> coaches = new ArrayList<>();
+    int[] category;
+
+    public void run() {
+        OutputView.printStart();
+        setCoaches();
+        OutputView.printResultIntro();
+        setCategory();
+        OutputView.printCategory(category);
+        coaches.forEach(this::menuRecommendations);
+    }
+
+    private void setCoaches() {
+        OutputView.printInsertCoach();
+        String[] inputCoaches = InputView.insertCoach().split(",");
+        if (!validate.validateCoach(inputCoaches)) {
+            setCoaches();
+            return;
+        }
+        for (String inputCoach : inputCoaches) {
+            Coach coach = new Coach(inputCoach);
+            OutputView.printInsertNotFood(coach.getName());
+            String[] NotFood = InputView.insertNotFood().split(",");
+            Arrays.stream(NotFood).forEach(coach::addNotFood);
+            coaches.add(coach);
+        }
+    }
+
+    private void setCategory() {
+        category = new int[5];
+        IntStream.range(0, 5).forEach(i -> category[i] = Randoms.pickNumberInRange(1, 5));
+    }
+
+    private void menuRecommendations(Coach coach) {
+        String[] menus = new String[5];
+        for (int i = 0; i < 5; i++) {
+            menus[i] = selectMenu(i, coach);
+        }
+        OutputView.printMenu(coach.getName(), menus);
+    }
+
+    private String selectMenu(int index, Coach coach) {
+        String menu = menuRepository.getMenu(category[index]);
+        if (!coach.checkMenu(menu)) {
+            return selectMenu(index, coach);
+        }
+        return menu;
+    }
+}

리뷰: 5는 상수화하면 좋을 것 같아요
@@ -0,0 +1,65 @@
+package menu.controller;
+
+import camp.nextstep.edu.missionutils.Randoms;
+import menu.model.Coach;
+import menu.model.MenuRepository;
+import menu.view.InputView;
+import menu.view.OutputView;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.IntStream;
+
+public class MenuController {
+    MenuRepository menuRepository = new MenuRepository();
+    Validate validate = new Validate();
+    List<Coach> coaches = new ArrayList<>();
+    int[] category;
+
+    public void run() {
+        OutputView.printStart();
+        setCoaches();
+        OutputView.printResultIntro();
+        setCategory();
+        OutputView.printCategory(category);
+        coaches.forEach(this::menuRecommendations);
+    }
+
+    private void setCoaches() {
+        OutputView.printInsertCoach();
+        String[] inputCoaches = InputView.insertCoach().split(",");
+        if (!validate.validateCoach(inputCoaches)) {
+            setCoaches();
+            return;
+        }
+        for (String inputCoach : inputCoaches) {
+            Coach coach = new Coach(inputCoach);
+            OutputView.printInsertNotFood(coach.getName());
+            String[] NotFood = InputView.insertNotFood().split(",");
+            Arrays.stream(NotFood).forEach(coach::addNotFood);
+            coaches.add(coach);
+        }
+    }
+
+    private void setCategory() {
+        category = new int[5];
+        IntStream.range(0, 5).forEach(i -> category[i] = Randoms.pickNumberInRange(1, 5));
+    }
+
+    private void menuRecommendations(Coach coach) {
+        String[] menus = new String[5];
+        for (int i = 0; i < 5; i++) {
+            menus[i] = selectMenu(i, coach);
+        }
+        OutputView.printMenu(coach.getName(), menus);
+    }
+
+    private String selectMenu(int index, Coach coach) {
+        String menu = menuRepository.getMenu(category[index]);
+        if (!coach.checkMenu(menu)) {
+            return selectMenu(index, coach);
+        }
+        return menu;
+    }
+}

리뷰: 랜덤 숫자 뽑기가 controller의 관심사일지 고민해보면 좋을 것 같아요
@@ -0,0 +1,65 @@
+package menu.controller;
+
+import camp.nextstep.edu.missionutils.Randoms;
+import menu.model.Coach;
+import menu.model.MenuRepository;
+import menu.view.InputView;
+import menu.view.OutputView;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.IntStream;
+
+public class MenuController {
+    MenuRepository menuRepository = new MenuRepository();
+    Validate validate = new Validate();
+    List<Coach> coaches = new ArrayList<>();
+    int[] category;
+
+    public void run() {
+        OutputView.printStart();
+        setCoaches();
+        OutputView.printResultIntro();
+        setCategory();
+        OutputView.printCategory(category);
+        coaches.forEach(this::menuRecommendations);
+    }
+
+    private void setCoaches() {
+        OutputView.printInsertCoach();
+        String[] inputCoaches = InputView.insertCoach().split(",");
+        if (!validate.validateCoach(inputCoaches)) {
+            setCoaches();
+            return;
+        }
+        for (String inputCoach : inputCoaches) {
+            Coach coach = new Coach(inputCoach);
+            OutputView.printInsertNotFood(coach.getName());
+            String[] NotFood = InputView.insertNotFood().split(",");
+            Arrays.stream(NotFood).forEach(coach::addNotFood);
+            coaches.add(coach);
+        }
+    }
+
+    private void setCategory() {
+        category = new int[5];
+        IntStream.range(0, 5).forEach(i -> category[i] = Randoms.pickNumberInRange(1, 5));
+    }
+
+    private void menuRecommendations(Coach coach) {
+        String[] menus = new String[5];
+        for (int i = 0; i < 5; i++) {
+            menus[i] = selectMenu(i, coach);
+        }
+        OutputView.printMenu(coach.getName(), menus);
+    }
+
+    private String selectMenu(int index, Coach coach) {
+        String menu = menuRepository.getMenu(category[index]);
+        if (!coach.checkMenu(menu)) {
+            return selectMenu(index, coach);
+        }
+        return menu;
+    }
+}

리뷰: `!coach.checkMenu()`가 어떤 의미인지 애매한 것 같아요
@@ -0,0 +1,19 @@
+package menu.controller;
+
+import menu.view.OutputView;
+
+public class Validate {
+    public boolean validateCoach(String[] inputCoaches) {
+        if (inputCoaches.length > 5 || inputCoaches.length < 2) {
+            OutputView.printCoachesNumberError();
+            return false;
+        }
+        for (String inputCoach : inputCoaches) {
+            if (inputCoach.length() < 2 || inputCoach.length() > 4) {
+                OutputView.printCoachesNameError();
+                return false;
+            }
+        }
+        return true;
+    }
+}

리뷰: 2, 4는 상수화하면 좋을 것 같아요
@@ -0,0 +1,71 @@
+package menu.view;
+
+public class OutputView {
+    private static final String START = "점심 메뉴 추천을 시작합니다.";
+    private static final String INSERT_COACH_NAME = "코치의 이름을 입력해 주세요. (, 로 구분)";
+    private static final String INSERT_NOT_FOOD = "(이)가 못 먹는 메뉴를 입력해 주세요.";
+    private static final String RESULT_INTRO = "메뉴 추천 결과입니다.\n[ 구분 | 월요일 | 화요일 | 수요일 | 목요일 | 금요일 ]";
+    private static final String JAPAN_FOOD = "일식";
+    private static final String KOREA_FOOD = "한식";
+    private static final String CHINA_FOOD = "중식";
+    private static final String ASIA_FOOD = "아시안";
+    private static final String WEASTEN_FOOD = "양식";
+    private static final String CATEGORY_START = "[ 카테고리 | ";
+    private static final String STEP = " | ";
+    private static final String PRINT_START = "[ ";
+    private static final String PRINT_END = " ]";
+
+    public static void printStart() {
+        System.out.println(START);
+    }
+
+    public static void printInsertCoach() {
+        System.out.println(INSERT_COACH_NAME);
+    }
+
+    public static void printInsertNotFood(String name) {
+        System.out.println(name + INSERT_NOT_FOOD);
+    }
+
+    public static void printResultIntro() {
+        System.out.println(RESULT_INTRO);
+    }
+
+    public static void printCategory(int[] category) {
+        String[] stringCategory = new String[category.length];
+        for (int i = 0; i < 5; i++) {
+            if (category[i] == 1) stringCategory[i] = JAPAN_FOOD;
+            if (category[i] == 2) stringCategory[i] = KOREA_FOOD;
+            if (category[i] == 3) stringCategory[i] = CHINA_FOOD;
+            if (category[i] == 4) stringCategory[i] = ASIA_FOOD;
+            if (category[i] == 5) stringCategory[i] = WEASTEN_FOOD;
+        }
+        System.out.print(CATEGORY_START);
+        for (int i = 0; i < 5; i++) {
+            System.out.print(stringCategory[i]);
+            if (i != category.length - 1) {
+                System.out.print(STEP);
+            }
+        }
+        System.out.println(PRINT_END);
+    }
+
+    public static void printMenu(String coach, String[] menus) {
+        System.out.print(PRINT_START + coach + STEP);
+        for (int i = 0; i < menus.length; i++) {
+            System.out.print(menus[i]);
+            if (i != menus.length - 1) {
+                System.out.print(STEP);
+            }
+        }
+        System.out.println(PRINT_END);
+    }
+
+    public static void printCoachesNumberError() {
+        System.out.println("[ERROR] 코치는 최소 2명, 최대 5명까지입니다.");
+    }
+
+    public static void printCoachesNameError() {
+        System.out.println("[ERROR] 코치의 이름은 최소 2글자, 최대 4글자입니다.");
+    }
+}

리뷰: OutputView가 특정 예외에 의존적이게 되는 것 같아요
@@ -0,0 +1,28 @@
+package menu.model;
+
+import camp.nextstep.edu.missionutils.Randoms;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class MenuRepository {
+    private final List<String> japan =
+            Arrays.asList("규동", "우동", "미소시루", "스시", "가츠동", "오니기리", "하이라이스", "라멘", "오코노미야끼");
+    private final List<String> korea =
+            Arrays.asList("김밥", "김치찌개", "쌈밥", "된장찌개", "비빔밥", "칼국수", "불고기", "떡볶이", "제육볶음");
+    private final List<String> china =
+            Arrays.asList("깐풍기", "볶음면", "동파육", "짜장면", "짬뽕", "마파두부", "탕수육", "토마토 달걀볶음", "고추잡채");
+    private final List<String> asia =
+            Arrays.asList("팟타이", "카오 팟", "나시고렝", "파인애플 볶음밥", "쌀국수", "똠얌꿍", "반미", "월남쌈", "분짜");
+    private final List<String> western =
+            Arrays.asList("라자냐", "그라탱", "뇨끼", "끼슈", "프렌치 토스트", "바게트", "스파게티", "피자", "파니니");
+
+    public String getMenu(int category) {
+        if (category == 1) return Randoms.shuffle(japan).get(0);
+        if (category == 2) return Randoms.shuffle(korea).get(0);
+        if (category == 3) return Randoms.shuffle(china).get(0);
+        if (category == 4) return Randoms.shuffle(asia).get(0);
+        if (category == 5) return Randoms.shuffle(western).get(0);
+        return null;
+    }
+}

리뷰: switch문과 비슷한 구조인 것 같아요.
다른 방법은 없었을까요..?
@@ -0,0 +1,71 @@
+package menu.view;
+
+public class OutputView {
+    private static final String START = "점심 메뉴 추천을 시작합니다.";
+    private static final String INSERT_COACH_NAME = "코치의 이름을 입력해 주세요. (, 로 구분)";
+    private static final String INSERT_NOT_FOOD = "(이)가 못 먹는 메뉴를 입력해 주세요.";
+    private static final String RESULT_INTRO = "메뉴 추천 결과입니다.\n[ 구분 | 월요일 | 화요일 | 수요일 | 목요일 | 금요일 ]";
+    private static final String JAPAN_FOOD = "일식";
+    private static final String KOREA_FOOD = "한식";
+    private static final String CHINA_FOOD = "중식";
+    private static final String ASIA_FOOD = "아시안";
+    private static final String WEASTEN_FOOD = "양식";
+    private static final String CATEGORY_START = "[ 카테고리 | ";
+    private static final String STEP = " | ";
+    private static final String PRINT_START = "[ ";
+    private static final String PRINT_END = " ]";
+
+    public static void printStart() {
+        System.out.println(START);
+    }
+
+    public static void printInsertCoach() {
+        System.out.println(INSERT_COACH_NAME);
+    }
+
+    public static void printInsertNotFood(String name) {
+        System.out.println(name + INSERT_NOT_FOOD);
+    }
+
+    public static void printResultIntro() {
+        System.out.println(RESULT_INTRO);
+    }
+
+    public static void printCategory(int[] category) {
+        String[] stringCategory = new String[category.length];
+        for (int i = 0; i < 5; i++) {
+            if (category[i] == 1) stringCategory[i] = JAPAN_FOOD;
+            if (category[i] == 2) stringCategory[i] = KOREA_FOOD;
+            if (category[i] == 3) stringCategory[i] = CHINA_FOOD;
+            if (category[i] == 4) stringCategory[i] = ASIA_FOOD;
+            if (category[i] == 5) stringCategory[i] = WEASTEN_FOOD;
+        }
+        System.out.print(CATEGORY_START);
+        for (int i = 0; i < 5; i++) {
+            System.out.print(stringCategory[i]);
+            if (i != category.length - 1) {
+                System.out.print(STEP);
+            }
+        }
+        System.out.println(PRINT_END);
+    }
+
+    public static void printMenu(String coach, String[] menus) {
+        System.out.print(PRINT_START + coach + STEP);
+        for (int i = 0; i < menus.length; i++) {
+            System.out.print(menus[i]);
+            if (i != menus.length - 1) {
+                System.out.print(STEP);
+            }
+        }
+        System.out.println(PRINT_END);
+    }
+
+    public static void printCoachesNumberError() {
+        System.out.println("[ERROR] 코치는 최소 2명, 최대 5명까지입니다.");
+    }
+
+    public static void printCoachesNameError() {
+        System.out.println("[ERROR] 코치의 이름은 최소 2글자, 최대 4글자입니다.");
+    }
+}

리뷰: 상수가 너무 많은데 enum으로 분리하는 것도 좋을 것 같아요!
@@ -0,0 +1,71 @@
+package menu.view;
+
+public class OutputView {
+    private static final String START = "점심 메뉴 추천을 시작합니다.";
+    private static final String INSERT_COACH_NAME = "코치의 이름을 입력해 주세요. (, 로 구분)";
+    private static final String INSERT_NOT_FOOD = "(이)가 못 먹는 메뉴를 입력해 주세요.";
+    private static final String RESULT_INTRO = "메뉴 추천 결과입니다.\n[ 구분 | 월요일 | 화요일 | 수요일 | 목요일 | 금요일 ]";
+    private static final String JAPAN_FOOD = "일식";
+    private static final String KOREA_FOOD = "한식";
+    private static final String CHINA_FOOD = "중식";
+    private static final String ASIA_FOOD = "아시안";
+    private static final String WEASTEN_FOOD = "양식";
+    private static final String CATEGORY_START = "[ 카테고리 | ";
+    private static final String STEP = " | ";
+    private static final String PRINT_START = "[ ";
+    private static final String PRINT_END = " ]";
+
+    public static void printStart() {
+        System.out.println(START);
+    }
+
+    public static void printInsertCoach() {
+        System.out.println(INSERT_COACH_NAME);
+    }
+
+    public static void printInsertNotFood(String name) {
+        System.out.println(name + INSERT_NOT_FOOD);
+    }
+
+    public static void printResultIntro() {
+        System.out.println(RESULT_INTRO);
+    }
+
+    public static void printCategory(int[] category) {
+        String[] stringCategory = new String[category.length];
+        for (int i = 0; i < 5; i++) {
+            if (category[i] == 1) stringCategory[i] = JAPAN_FOOD;
+            if (category[i] == 2) stringCategory[i] = KOREA_FOOD;
+            if (category[i] == 3) stringCategory[i] = CHINA_FOOD;
+            if (category[i] == 4) stringCategory[i] = ASIA_FOOD;
+            if (category[i] == 5) stringCategory[i] = WEASTEN_FOOD;
+        }
+        System.out.print(CATEGORY_START);
+        for (int i = 0; i < 5; i++) {
+            System.out.print(stringCategory[i]);
+            if (i != category.length - 1) {
+                System.out.print(STEP);
+            }
+        }
+        System.out.println(PRINT_END);
+    }
+
+    public static void printMenu(String coach, String[] menus) {
+        System.out.print(PRINT_START + coach + STEP);
+        for (int i = 0; i < menus.length; i++) {
+            System.out.print(menus[i]);
+            if (i != menus.length - 1) {
+                System.out.print(STEP);
+            }
+        }
+        System.out.println(PRINT_END);
+    }
+
+    public static void printCoachesNumberError() {
+        System.out.println("[ERROR] 코치는 최소 2명, 최대 5명까지입니다.");
+    }
+
+    public static void printCoachesNameError() {
+        System.out.println("[ERROR] 코치의 이름은 최소 2글자, 최대 4글자입니다.");
+    }
+}

리뷰: enum을 활용하면 코드 중복을 최소화할 수 있었을 것 같아요!
@@ -0,0 +1,65 @@
+package menu.controller;
+
+import camp.nextstep.edu.missionutils.Randoms;
+import menu.model.Coach;
+import menu.model.MenuRepository;
+import menu.view.InputView;
+import menu.view.OutputView;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.IntStream;
+
+public class MenuController {
+    MenuRepository menuRepository = new MenuRepository();
+    Validate validate = new Validate();
+    List<Coach> coaches = new ArrayList<>();
+    int[] category;
+
+    public void run() {
+        OutputView.printStart();
+        setCoaches();
+        OutputView.printResultIntro();
+        setCategory();
+        OutputView.printCategory(category);
+        coaches.forEach(this::menuRecommendations);
+    }
+
+    private void setCoaches() {
+        OutputView.printInsertCoach();
+        String[] inputCoaches = InputView.insertCoach().split(",");
+        if (!validate.validateCoach(inputCoaches)) {
+            setCoaches();
+            return;
+        }
+        for (String inputCoach : inputCoaches) {
+            Coach coach = new Coach(inputCoach);
+            OutputView.printInsertNotFood(coach.getName());
+            String[] NotFood = InputView.insertNotFood().split(",");
+            Arrays.stream(NotFood).forEach(coach::addNotFood);
+            coaches.add(coach);
+        }
+    }
+
+    private void setCategory() {
+        category = new int[5];
+        IntStream.range(0, 5).forEach(i -> category[i] = Randoms.pickNumberInRange(1, 5));
+    }
+
+    private void menuRecommendations(Coach coach) {
+        String[] menus = new String[5];
+        for (int i = 0; i < 5; i++) {
+            menus[i] = selectMenu(i, coach);
+        }
+        OutputView.printMenu(coach.getName(), menus);
+    }
+
+    private String selectMenu(int index, Coach coach) {
+        String menu = menuRepository.getMenu(category[index]);
+        if (!coach.checkMenu(menu)) {
+            return selectMenu(index, coach);
+        }
+        return menu;
+    }
+}

리뷰: 개수가 정해져 있다고 생각해서 생각 없이 배열을 사용했는데 컬렉션을 사용하는 게 더 좋을 것 같습니다!