HelTecAutomation / CubeCell-Arduino

Heltec CubeCell Series (based on ASR6501, ASR6502 chip) Arduino support.
247 stars 138 forks source link

Naming in ASR650x-Arduino Core is inconsistent and conflicts with Arduino and common C++ naming conventions #58

Closed lnlp closed 4 years ago

lnlp commented 4 years ago

Below feedback is based on ASR650x-Arduino source code and examples.

Use of consistent programming style and naming conventions are (for multiple reasons) important aspects when writing software. Some well known identifier naming conventions are:

For Arduino it is standard to use lowerCamelCase for function and method names. For C++ in general, ALL_CAPS is primarily used for macro names. A common best-practice is to NOT use underscores in camel casing.

To my surprise the ASR650x-Arduino does NOT apply consistent naming conventions. It uses different naming styles that conflicts with both Arduino naming conventions and common C++ naming conventions.

Functions and method names in the ASR650x-Arduino Core use a mixed combination of lowerCamelCase, UpperCamelCase and ALL_CAPS. In examples both lowerCamelCase and UpperCamelCase are used for naming of user defined functions. This inconsistency is bad-practice, confusing and error-prone. Examples:

Similar inconsistencies exist for naming of variables. Examples:

It is important to apply (naming) conventions consistently, and apply conventions that are common for a certain environment (e.g. Arduino framework). An exception to the rule is when external libraries are used. For external libraries one is bound to use the naming that is defined in those libraries, which can result in application source code with mixed naming styles (e.g. LoRaMac-node appears to uses UpperCamelCasing for both functions and variables).

Without documentation it is difficult to check which of the current naming inconsistencies should not exist (because caused by sloppiness/lack of consistency) and should be fixed, and others which are unavoidable because caused by external libraries.

Heltec-Aaron-Lee commented 4 years ago

Thank you for your great suggestions, We will take your suggestions and try to correct this series of issues when the 6502 is released.

lnlp commented 4 years ago

These corrections should be made as soon as possible because this will be a breaking change that impacts application code being written for CubeCell devices. The longer you wait the more code that customers will have to correct for the changes. ASR650x is hardware produced by ASR but ASR650x-Arduino is software (Arduino Core) written by Heltec. Fixing naming in ASR650x-Arduino is not dependent on a the ASR6501 or a newer ASR6502. These corrections should be made asap and be used for all ASR650x MCU's.

Heltec-Aaron-Lee commented 4 years ago

@lnlp I had talked with my colleagues, we will begin the changes when we back to work. Because of the virus, we have to delay the time back to work.

fredolaredo commented 4 years ago

Wish you lot of courage ! I can't imagine what is like ! By the way, I am also quite disappointed with the naming conventions, and agree on the fact that the sooner, less changes we will have to do in the code. For now , just digging into this promising platform. Thx

wasn-eu commented 4 years ago

think that this issue is solved with the last update