Skip to content

[DOCS][COMMUNITY] Improve code review guideline on API designs#2459

Merged
tqchen merged 2 commits intoapache:masterfrom
tqchen:master
Jan 18, 2019
Merged

[DOCS][COMMUNITY] Improve code review guideline on API designs#2459
tqchen merged 2 commits intoapache:masterfrom
tqchen:master

Conversation

@tqchen
Copy link
Copy Markdown
Member

@tqchen tqchen commented Jan 18, 2019

Update code review guidelines to emphasize more on API designs. API design is what we sometimes overlooked, and we should learn from projects like numpy, pytorch and keras.

cc @dmlc/tvm-comitter

Copy link
Copy Markdown
Contributor

@eqy eqy left a comment

Choose a reason for hiding this comment

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

minor nits

Comment thread docs/contribute/code_review.rst Outdated

Deliberate on API and Data Structures
-------------------------------------
A minimum and stable API is critical to the project’s life. A good API makes a huge difference. Always think very carefully about all the aspects including naming, arguments definitions and behavior.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: argument definitions

Comment thread docs/contribute/code_review.rst Outdated
Here are some useful principles for designing APIs:

- Be consistent with existing well-known package’s APIs if the feature overlap.
For example, tensor operation APIs should always be consistent with the numpy.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: numpy [API]

Comment thread docs/contribute/code_review.rst Outdated
- Be consistent with existing APIs in the same project.
For example, we should use the same argument ordering across all the optimization passes,
so there is no "surprise" when using them.
- Think about whether API will change in the future.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: [the] API

Comment thread docs/contribute/code_review.rst Outdated
For example, we should use the same argument ordering across all the optimization passes,
so there is no "surprise" when using them.
- Think about whether API will change in the future.
For example, we will have more options like loop_unrolling, device placement policy
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

loop unrolling [and] device placement policy

Comment thread docs/contribute/code_review.rst Outdated
so there is no "surprise" when using them.
- Think about whether API will change in the future.
For example, we will have more options like loop_unrolling, device placement policy
as we add more optimization in build. We can package optimization knobs into a build
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: optimization[s] in build

Comment thread docs/contribute/code_review.rst Outdated
For example, we will have more options like loop_unrolling, device placement policy
as we add more optimization in build. We can package optimization knobs into a build
configuration object. So that the build API is stable over time.
- Write down documents. Documents are mandatory for APIs, sometimes writing documents helps
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

APIs [and] sometimes

Comment thread docs/contribute/code_review.rst Outdated
configuration object. So that the build API is stable over time.
- Write down documents. Documents are mandatory for APIs, sometimes writing documents helps
us to think about whether we need clarification.
- Minimum. Think about how many lines of code a user have to write to use the API.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

a user [has] to write

@tqchen tqchen merged commit f7d0883 into apache:master Jan 18, 2019
@tqchen
Copy link
Copy Markdown
Member Author

tqchen commented Jan 18, 2019

Thanks to @eqy @ZihengJiang , this is now merged

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants