Repository navigation
coordinate step 2 완료했습니다. - #126
Merged
Merged
Conversation
javajigi
suggested changes
Oct 29, 2018
|
|
||
| public class Point { | ||
|
|
||
| // 인스턴스가 많아도 너무 많다.... 이걸 줄여야 되는데 |
| import java.util.ArrayList; | ||
| import java.util.List; | ||
|
|
||
| public class ParserString { |
Contributor
There was a problem hiding this comment.
굳이 인스턴스 변수와 메소드로 구현하지 말고 클래스 메소드로 구현해 본다.
| } | ||
| return false; | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
Point는 사용자가 입력한 값에 대해서만 인스턴스를 만들고 나머지는 위치 정보는 Point 인스턴스 생성하지 않고 구현할 수는 없을까?
javajigi
suggested changes
Oct 30, 2018
| public class MakeLine { | ||
|
|
||
| private Point aPoints; | ||
| private Point bPoints; |
Contributor
There was a problem hiding this comment.
Line에 두 값이 저장해서 반환했는데 굳이 이 2개의 Point를 인스턴스 변수로 가지는 이유가 있나?
2개의 인스턴스 변수를 제거한다.
| private Point aPoints; | ||
| private Point bPoints; | ||
|
|
||
| public Line makeLine(String coordinate) throws Exception { |
| printCoordinate(); | ||
| System.out.println(String.valueOf(stringBuilder)); | ||
|
|
||
| public void printAll(Line line, MakeLine parser) { |
| Point b = parser.getbPoints(); | ||
| printCoordinate(a, b); | ||
| printDistance(line.lineDistance()); | ||
| System.out.println(String.valueOf(coordinatePrint)); |
Contributor
There was a problem hiding this comment.
String.valueOf 대신 coordinatePrint.toString()으로 구현한다.
| } | ||
|
|
||
| private static void diffrentYBar(Point a, Point b) { | ||
| if (a.getY() != b.getY()) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
이번 step 2를 하는 도중 진전이 없어 다시 처음부터 공부하고 다른 사람들의 사다리게임 코드를 보았었습니다. 다른 사람들의 코드를 읽는 것이 많이 도움이 된 것 같습니다. 물론 어렵고 적용하기는 힘들지만, 확실히 다른사람들 코드를 보니 깨달은 것들이 많았습니다.
이번 저의 코드에서는 포인트 클래스에서 get메소드를 사용하여 x와 y의 arraylist를 만들어 값들을 가져왔습니다. 하지만 다른 방법을 생각하는 도중 포인트 클래스에서 생성자를 이용하여 값들을 가져와 새로 만들 수 있다는 생각도 하게 되었습니다. 하지만 그렇게 만드는 것이 쉽지 않아 일단....
그리고 예외처리를 저번 시간에 배웠었는데, 제대로 이해가 되지 않아 공부를 더하고 옆 사람들에게 물어 예외처리를 적용하였는데, 아직 미숙하고 제대로 이해하지 못한 것 같습니다. 특히 메인 메소드에서 try, catch문을 사용하는 것이 영 찝찝합니다.
이번 step은 혼자서 설계하고 도움을 한번도 받지 않았습니다. 그래서 더욱 시간이 많이 걸리고 힘이 빠지던 순간이었던 것 같습니다. 저번 보다 모든 부분이 많이 부족하다 느껴지실듯 합니다.