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

Rename Variable, Record and Array (#363) #368

Merged

Conversation

sveinse
Copy link
Contributor

@sveinse sveinse commented Apr 7, 2023

To create better distinction between the different Variable, Record and Array types used for different purposes. Helps development, as IDE/linters often only display base name of class. Discussed in issue #363

Unittests pass and generated sphinx documents have been skimmed over.

To create better distinction between the different Variable, Record and Array types used for different purposes. Helps development, as IDE/linters often only display base name of class.
Copy link
Owner

@christiansandberg christiansandberg left a comment

Choose a reason for hiding this comment

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

Seems like a good improvement. As long as we keep backwards compatibility I see no problem.

@sveinse
Copy link
Contributor Author

sveinse commented Apr 8, 2023

Updated with lastest commits in master.

Copy link
Collaborator

@acolomb acolomb left a comment

Choose a reason for hiding this comment

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

Looks good in principle, just a nit-pick about inconsistent uppercase variants.

class Variable(variable.Variable):
class PdoVariable(variable.Variable):
Copy link
Collaborator

@acolomb acolomb May 2, 2023

Choose a reason for hiding this comment

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

This is pure bikeshedding, but why do you use CamelCase with the lowercase Pdo abbreviation here, while for the OD you use the all-caps OD spelling as in ODVariable? Should consistently use uppercase for abbreviations here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@acolomb you're right, this is inconsistent. I didn't make a very deliberate choice, rather trying to adopt the gist from the rest of canopen. After looking more closer at it, I see canopen is equally inconsistent, e.g. class PDO vs class PdoBase. Looking at all class names, the majority is CamelCase, with the notable exception of PDO, TPDO, RPDO and not used with an additional suffix.

To be consistent with naming in canopen, ODVariable should then be OdVariable perhaps?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, I guess that's an acceptable solution. Just don't introduce even more inconsistency ;-)

Copy link
Owner

Choose a reason for hiding this comment

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

Naming is probably inconsistent everywhere else anyway, so it's not super important. Not sure what's best for readability, but I'm nowadays leaning more towards keeping abbreviations upper-case even if it makes it harder to separate the words.

class Record(Mapping):
class SdoRecord(Mapping):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here, SDORecord? Please just be consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With reference to comment above, SdoRecord is correct if SdoBase is correct I would argue.

@christiansandberg christiansandberg merged commit 0285f58 into christiansandberg:master Sep 1, 2023
1 check passed
@sveinse sveinse deleted the feature-variable-rename branch April 26, 2024 01:04
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.

None yet

3 participants