Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timeconverter_01 #4

Open
wants to merge 4 commits into
base: Kim-Changyoung
Choose a base branch
from

Conversation

kcy13930
Copy link
Collaborator

2시 서버 포멧하고 와서 에러 메세지 기능 넣겠습니다. 람쥐

Copy link
Contributor

@GiPyoo GiPyoo left a comment

Choose a reason for hiding this comment

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

ES6를 잘 사용하였습니다. 다만 인덴트(뎁스)가 두 단계이상 들어 가 있는 부분이 있는데 이부분의 경우는 함수로 분리한다면 해결하실 수 있을 것입니다. 아직 에러를 구현하지 않으셨는데 이 부분도 조속히 구현 하셔서 리뷰받으셨으면 좋겠습니다. 리뷰 반영해 주시고 다시 푸쉬해주세요

}
}

cvt(){
Copy link
Contributor

Choose a reason for hiding this comment

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

이 함수가 어떤 역할을 하는지 이름만 보고도 알 수 있어야합니다.

Comment on lines +13 to +21
isType(){
let type = ["d","h","m","s"]
for(let i=0;i<type.length;i++){
if (this.data.split("").includes(type[i])){
this.n_data[i] = parseInt(this.data.split(type[i])[0]);
this.data = this.data.split(type[i])[1];
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

이름에 is 혹은 has 가 들어가는 경우 보통 boolean 값을 리턴한다는 인상을 가지게 됩니다. 그런데 이 함수의 경우에는 어떤 역할을 하는지 이해하기 어렵고 리턴 값이 없어서 다른 사람이 코드를 읽을 때 어려워할 수 있습니다. 더 좋은 이름 그리고 더 좋은 함수로 구현하면 좋을 것 같습니다.

Comment on lines +6 to 18
printData(){
let type = ["d","h","m","s"]
let message = "";

for(let i=0;i<this.n_data.length;i++){
if(this.n_data[i]!=0){
message += this.n_data[i]
message += type[i];
}
}
console.log(message);
}
}
Copy link
Contributor

@GiPyoo GiPyoo Feb 18, 2020

Choose a reason for hiding this comment

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

문자열 처리를 잘 한 것 같습니다.

Comment on lines +4 to +6
this.ans_type = input.split(" ")[1];
this.n_data = [0,0,0,0] // day, hour, minute, second
this.n_type = [24,60,60,1] // day_toHour, hour_toMinute, minute_toSecond, seocnd_toSecond
Copy link
Contributor

Choose a reason for hiding this comment

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

이러한 변수들의 이름을 다른 사람이 보았을 때 이해하기 어렵습니다. 때문에 이러한 변수를 설명하기 위하여 주석이 생긴 것 같습니다. 더 좋은 변수이름으로 짓는 다면 좋을 것 같습니다. 또 다른 함수명의 경우는 모두 카멜케이스를 사용하고 있는데 이 변수들은 언더스코어를 사용하는 부분이 많이 어색합니다. 혹이 이러한 부분을 처음 미리 정해 놓고하셨다면 계속 이렇게 진행하셔도 괜찮습니다. 다만 걱정하는 부분은 코드가 많아졌을 때 변수명을 짓는 방식이 모두 들쭉날쭉하게 되면 코드 가독성을 해칠 가능성이 있다는 것입니다. 👀

}

isError(){
// 서버 포멧하고 와서 추가할 예정
Copy link
Contributor

Choose a reason for hiding this comment

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

에러기능이 필요합니다.

Comment on lines +32 to +37
if (cnt!=0){
for(let i=len-1;i>cnt-1;i--){
this.n_data[i-1] += parseInt(this.n_data[i]/this.n_type[i-1]);
this.n_data[i] = this.n_data[i]%this.n_type[i-1];
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

이 부분을 더 개선할 수 있을 것 같습니다! 한 번 더 생각해보세요 👀

Copy link
Contributor

@GiPyoo GiPyoo left a comment

Choose a reason for hiding this comment

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

2주차 미션에 대한 리뷰입니다.
구조는 적절합니다 👍 그런데, 클린코드를 볼때 수정해야할 부분이 몇군데 존재합니다. 그리고 reduce 함수를 잘 못 구현하신 것 같아 다시 구현하셔야할 것 같습니다. 수고하셨습니다.
아해 리뷰 반영해주세요!

Comment on lines 1 to 13
Array.prototype.customReduce = function(callback) {
const array = Object(this);
const length = array.length;
let sum=0;
let value;
for(let i=0;i<length;i++){
value = parseInt(array[i]);
sum = callback(sum, value);
}
return sum;
};

module.exports = Array;
Copy link
Contributor

Choose a reason for hiding this comment

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

reduce는 이니셜벨류 등이 존재하는데, 이 함수는 단순 합을 구하는 함수 처럼 보입니다! MDN의 Reduce함수를 보고 재 구현 해주세요.

Comment on lines 15 to 19
set(){
if(this.command=='count') return this.count(this.array);
else if(this.command='add') return this.add(this.array);
else;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

elseif에서 '=' 연산자가 사용되었는데 '=='로 바뀌어야할 것 같습니다.

Copy link
Contributor

Choose a reason for hiding this comment

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

또 필요없는 else가 존재하는 것 같습니다. 그리고 되도록이면 else는 사용하지 않는 것이 좋습니다!


function test(params){
let domain = new Commander(params);
let util = new Log(domain.command, domain.set());
Copy link
Contributor

Choose a reason for hiding this comment

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

이 변수의 이름이 부적절해보입니다. 그리고 Log 함수의 경우 어디서든지 쓸 수 있기때문에 이렇게 생성자를 이용하기 보다는 static 메서드를 정의한뒤 Log.print() 이런식으로 사용하는 것이 좋아 보입니다.

Copy link
Contributor

@GiPyoo GiPyoo left a comment

Choose a reason for hiding this comment

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

이전의 리뷰를 반영해주시지 않으시고 계속해서 스프린트를 더해가며 PUSH 하시는 것은 정말 좋지 않습니다.
되도록 리뷰를 반영해주시며 해주세요. 자꾸 이렇게 보내려고 하니까 컨플릭트가 발생하고 PR 오류가 발생하고 있습니다. 리뷰들 반영해주세요.

Comment on lines +5 to +6
this.employee_one;
this.employee_two;
Copy link
Contributor

Choose a reason for hiding this comment

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

두 대상 모두 같은 일을 하므로 하나의 class로 빼서 하는 것이 좋아 보입니다.

Comment on lines +21 to +22
this.employee_one = setInterval(()=>this.employee(),2000);
this.employee_two = setInterval(()=>this.employee(),2000);
Copy link
Contributor

Choose a reason for hiding this comment

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

interval를 하나만 쓰는것은 어떻까요?

@@ -0,0 +1,22 @@
let syncTime = 0;
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