Skip to content

Comments

3주차 미션 구현 완료 (김세훈)#3

Open
Huniiiiiii wants to merge 7 commits intoallrounder-backend:mainfrom
Huniiiiiii:Huniiiiiii
Open

3주차 미션 구현 완료 (김세훈)#3
Huniiiiiii wants to merge 7 commits intoallrounder-backend:mainfrom
Huniiiiiii:Huniiiiiii

Conversation

@Huniiiiiii
Copy link

No description provided.

@Huniiiiiii Huniiiiiii changed the title 2주차 미션 구현 완료 (김세훈) 3주차 미션 구현 완료 (김세훈) Apr 6, 2025
Copy link
Contributor

@moongua404 moongua404 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3주차 미션 수고 많으셨습니다ㅎㅎ

String input = view.input("");
if (input.equals("4")) return;
Runnable action = menuMap.get(input);
if (action != null) action.run();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

runnable을 선언할 필요 없이 바로 실행하는 편이 가독성이나 효율성 측면에서 더 좋을 것 같아요

import java.util.List;
import java.util.Map;

public class printerController {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

클래스명은 대문자로 시작하는게 컨벤션상 좋을거같아요

int end = Math.min(start + paperSize, input.length());
printOneLine(input.substring(start, end));
start = end;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reduce를 써서 함수형 프로그래밍으로 표현할 수 있지 않을까요?

inkManager.minusInk();
appendAscii(lines, ch);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 부분도 stream API를 사용하면 더 효율적이고 가독성 높게 구성할 수 있을 것 같아요


private List<StringBuilder> initLines() {
List<StringBuilder> lines = new ArrayList<>();
for (int i = 0; i < LINE_COUNT; i++) lines.add(new StringBuilder());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 부분이랑 아래 부분들을 함수형으로 구성하면 좋을 것 같아요

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants