Skip to content

Add notes on unsafe comments, client library consistency, and reviewing to contributing.md #252

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

Merged
merged 6 commits into from
Oct 11, 2022

Conversation

nnmm
Copy link
Contributor

@nnmm nnmm commented Sep 10, 2022

Motivation: This documents several guidelines that have so far been implicit. I hope they represent a consensus opinion :)

@nnmm nnmm requested a review from a team September 10, 2022 14:34
jhdcs
jhdcs previously approved these changes Sep 12, 2022
Copy link
Collaborator

@jhdcs jhdcs left a comment

Choose a reason for hiding this comment

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

These appear to be good additions to me. I'll have to work on my reviewing style to comply with the new guidelines.

This does _not_ mean that
- No variability between languages is allowed. What is easy to do, and what is considered idiomatic, is quite different between languages, and thus ROS 2 allows for considerable variability between client languages.
- Features should always be ported 1:1. Do not rely on the assumption that the best implementation for `rclrs` is whatever `rclcpp` does, but understand the motivation and status of the implementation in the other client libraries. For instance, sometimes a design is implemented incompletely by a client library, the feature is later found to have problems (e.g. the deadlocking of sync client calls in Python), or the client library is constrained by backwards compatibility.
- Internal consistency does not matter. It does.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd add external consistency as well, API should follow the principle of least surprise, where there are no quirks in how similar functions are called and the types they return.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, by "external consistency" you mean consistency of the user-facing API within rclrs? Because I thought external consistency would refer to the part explained in lines 73 - 79, i.e. consistency between client libraries.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I meant more in the sense of consistence in the rclrs API itself, over the years rclcpp and rclpy have their own quirks and sometimes the API is not entirely coherent. For example, rclcpp's create_subscription has the QoS parameter before the callback, where create_service has them swapped. It's a delicate line, because on the one hand we want to make it easy for people to port their applications and mimic the existing APIs, but if such APIs are not consistent, it may make writing new applications more confusing.

Copy link
Collaborator

Choose a reason for hiding this comment

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

In my opinion, if we have to make a decision to mimic rclcpp's API or rclpy's API, we should probably go for rclcpp - Rust is a bit closer to C++ than to Python, so (theoretically) it's more likely that a user of rclcpp would be using rclrs. At least that's my reasoning.

But yeah, ideally the APIs would be consistent across the board.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, sounds like we mean the same things with "internal consistency" and "external consistency". I rewrote it to say "consistency within rclrs" to avoid this dubious distinction.

- Internal consistency does not matter. It does.
- No deviations from the above guidelines are possible.

In summary, understand the context of the features that you port, in order to avoid [_cargo-culting_](https://en.wikipedia.org/wiki/Cargo_cult_programming), and to be mindful of [Chesterton's fence](https://en.wiktionary.org/wiki/Chesterton%27s_fence).
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the addition of Chesterton's fence here might be harmful, given that in other parts of this document it's advised to understand the rationale for a given design in rclcpp in order to be able to not port features 1:1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, yes you could read it as "be wary of deviating from the design of other client libraries", but I meant it more like "if you find the design of rclcpp and rclpy illogical, that's probably a signal that you don't understand the problem they are solving there".

But I see that it might be misleading, so I'm removing it.

Copy link
Contributor Author

@nnmm nnmm left a comment

Choose a reason for hiding this comment

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

Thanks for the comments!

This does _not_ mean that
- No variability between languages is allowed. What is easy to do, and what is considered idiomatic, is quite different between languages, and thus ROS 2 allows for considerable variability between client languages.
- Features should always be ported 1:1. Do not rely on the assumption that the best implementation for `rclrs` is whatever `rclcpp` does, but understand the motivation and status of the implementation in the other client libraries. For instance, sometimes a design is implemented incompletely by a client library, the feature is later found to have problems (e.g. the deadlocking of sync client calls in Python), or the client library is constrained by backwards compatibility.
- Internal consistency does not matter. It does.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, by "external consistency" you mean consistency of the user-facing API within rclrs? Because I thought external consistency would refer to the part explained in lines 73 - 79, i.e. consistency between client libraries.

- Internal consistency does not matter. It does.
- No deviations from the above guidelines are possible.

In summary, understand the context of the features that you port, in order to avoid [_cargo-culting_](https://en.wikipedia.org/wiki/Cargo_cult_programming), and to be mindful of [Chesterton's fence](https://en.wiktionary.org/wiki/Chesterton%27s_fence).
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, yes you could read it as "be wary of deviating from the design of other client libraries", but I meant it more like "if you find the design of rclcpp and rclpy illogical, that's probably a signal that you don't understand the problem they are solving there".

But I see that it might be misleading, so I'm removing it.

@esteve
Copy link
Collaborator

esteve commented Sep 30, 2022

Regarding contributions, something that personally makes reviews more difficult for me is force-pushes and squashing while the PR is being reviewed, because I can't point to a commit to check if a particular feedback has been addressed. Could you add a section about that? We squash commits when we merge a PR, so there's not much change in how merge notes look like.

@nnmm
Copy link
Contributor Author

nnmm commented Sep 30, 2022

Regarding contributions, something that personally makes reviews more difficult for me is force-pushes and squashing while the PR is being reviewed, because I can't point to a commit to check if a particular feedback has been addressed. Could you add a section about that? We squash commits when we merge a PR, so there's not much change in how merge notes look like.

Added. I think all comments should be addressed now.

@nnmm
Copy link
Contributor Author

nnmm commented Oct 8, 2022

@esteve I assume all your comments have been addressed and this can be merged, yes?

Copy link
Collaborator

@esteve esteve left a comment

Choose a reason for hiding this comment

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

@nnmm nice work!

@nnmm nnmm merged commit 0533699 into main Oct 11, 2022
@delete-merged-branch delete-merged-branch bot deleted the api_consistency branch October 11, 2022 08:50
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.

3 participants