Skip to content

Replace properties with methods#22

Open
RealOrangeOne wants to merge 1 commit into
mainfrom
remove-properties
Open

Replace properties with methods#22
RealOrangeOne wants to merge 1 commit into
mainfrom
remove-properties

Conversation

@RealOrangeOne
Copy link
Copy Markdown
Member

Properties can be quite surprising for new users, especially if they have side effects.

This PR replaces most properties with getter / setter methods, and in some places simplifying the naming where it makes sense.

@RealOrangeOne RealOrangeOne requested a review from a team June 3, 2025 22:22
Comment thread sr/robot3/power_board.py
@log_to_debug(setter=True)
def is_enabled(self, value: bool) -> None:
@log_to_debug
def power_on(self) -> None:
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Here we have power_on, but the LED has on. Should we standardize?

@sedders123
Copy link
Copy Markdown
Member

sedders123 commented Jun 4, 2025

Apologies for the drive by comment, I have no context for these changes.

Properties can be quite surprising for new users, especially if they have side effects.

Keen to understand where this has come from, is this feedback we've had from competitors or team supervisors?

Every time we change the API we decrease (or in this case reset) the knowledge of existing volunteers. This in turn increases the dependency on a few volunteers who are keeping up to date with kit development to provide support. Given our very limited pool of active volunteers I think this should be a strong consideration.

Likewise any first year competitors continuing into their second year that have learnt the old API will have to relearn this new API. I'm personally not sure we can give a strong enough explanation as to why we're making them do this. (This forced re learning could be considered a feature by some if we're aiming to reduce code reuse between years, but I think we should be focussing on uplifting new teams rather than hindering returning teams)

In my mind V5 kit could be a sensible time to introduce such a huge breaking change like this.

Comment thread sr/robot3/kch.py

@colour.setter
def colour(self, value: tuple[bool, bool, bool]) -> None:
def ste_colour(self, value: tuple[bool, bool, bool]) -> None:
Copy link
Copy Markdown
Member Author

@RealOrangeOne RealOrangeOne Jun 4, 2025

Choose a reason for hiding this comment

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

Suggested change
def ste_colour(self, value: tuple[bool, bool, bool]) -> None:
def set_colour(self, value: tuple[bool, bool, bool]) -> None:

Interesting that tests didn't pick up on this.

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