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

오프라인에서 말씀드린 구현 디테일 문서 혹은 코멘트에 대한 정보입니다. #14

Closed
owljoa opened this issue Mar 28, 2018 · 4 comments

Comments

@owljoa
Copy link
Collaborator

owljoa commented Mar 28, 2018

제가 주로 사용하던 파이썬에서는 아래와 같은 코멘트를 다는 것이 convention이였습니다.
인텔리제이 기반 파이참에서 주석 생성시 함수 원형을 보고 자동으로 저렇게 :param 같은 것들이 만들어집니다.
저런 표준방식의 코멘트가 좋은점은 tool(파이썬의 경우는 sphinx)을 이용한 자동 documentation을 할 때,
편합니다. 그리고 tool까지 안가더라도 코드를 나중에 읽어도 눈에 잘 들어오고요 :)

def load_data(p_user_id: str, target_dir: str, only_user_data: bool=False, fix_user_sample: int=None, fix_imposter_sample: int=None)
-> [np.ndarray, np.ndarray] or np.ndarray:
"""
load legitimate user's data and imposters' data from csv files
:param p_user_id: legitimate user's id(initial)
:param target_dir: target directory for finding requested user data
:param only_user_data: if true, return user data only. if false, return user and imposter data
:param fix_user_sample: fix the number of legitimate user sample to return
:param fix_imposter_sample: fix the number of imposter sample to return
:return: legitimate user data and imposter data
"""

그런데 Go 언어의 convention을 보니 조금 다른것 같네요. golang 개발 깃헙 문서에는 아래와 같은 예시가 있었고, 링크로 가시면 부연설명도 있습니다.(링크 : https://github.com/golang/go/wiki/Comments)
godoc이라는 documentation 자동화 tool도 있네요. (https://godoc.org/)
한글버전의 comment 설명은 (https://golang.kr/doc/effective_go/commentary.html) 에서 조금 볼수 있네요.

// Package superman implements methods for saving the world.
//
// Experience has shown that a small number of procedures can prove
// helpful when attempting to save the world.
package superman

// enterOrbit causes Superman to fly into low Earth orbit, a position
// that presents several possibilities for planet salvation.
func enterOrbit() os.Error {
...
}

coding convention을 일일이 따르는건 나중에 해도 될것 같지만 코멘트나 문서에 대한 규칙(?)은 미리 정의해두어야 좋을것 같아서 말씀드렸습니다!

그래서 아마 제가 달게될 코멘트는 go언어 방식일 것 같습니다 :)

@owljoa
Copy link
Collaborator Author

owljoa commented Mar 28, 2018

golang math 패키지에서 빅넘버 연산에 대한 코드인데.. 위에 제가 너무 길게 드린 복잡한 설명보다 좋은 예시가 될 것 같습니다.

<코드>
https://github.com/golang/go/blob/release-branch.go1.5/src/math/big/int.go#L405

<godoc을 이용한 documentation 결과>
https://godoc.org/math/big#Int

@owljoa owljoa changed the title 제가 오프라인에서 말씀드린 구현 디테일 문서 혹은 주석에 대한.. 정보입니다. 오프라인에서 말씀드린 구현 디테일 문서 혹은 코멘트에 대한 정보입니다. Mar 28, 2018
@yojkim
Copy link
Collaborator

yojkim commented Mar 28, 2018

좋은 것 같습니다. 근데 전체적인 컨벤션을 정하는건 heimdall 뿐에서만 아니라 it-chain 프로젝트 전반적으로 동일하게 가져가야 하지 않을까요? 다 같이 한번 논의해봐야할 것 같습니다 :)

@owljoa
Copy link
Collaborator Author

owljoa commented Mar 28, 2018

아아! 네 알겠습니다.

옮겨가겠습니다!

@yojkim
Copy link
Collaborator

yojkim commented Mar 28, 2018

넵!!

@yojkim yojkim closed this as completed Mar 28, 2018
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

No branches or pull requests

2 participants