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

Define final SparkFun Arduino class name pattern #30

Open
gigapod opened this issue Dec 15, 2023 · 4 comments
Open

Define final SparkFun Arduino class name pattern #30

gigapod opened this issue Dec 15, 2023 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@gigapod
Copy link
Member

gigapod commented Dec 15, 2023

Current thoughts are:

SparkFun_[Upper_Camel_Snake_For_Product_Name]

@gigapod gigapod added the enhancement New feature or request label Dec 15, 2023
@gigapod gigapod added this to the Version v01.00.00 milestone Dec 15, 2023
@gigapod gigapod self-assigned this Dec 15, 2023
@SFE-Brudnerd
Copy link
Member

If we're following Microsoft for our style conventions then it should be first letter capital camel case.

Ex: SparkfunAs7331ArdI2c or SfeAs7331ArdI2c

Note this is different than what I'm currently doing in that UV sensor library.

@sfe-SparkFro
Copy link
Contributor

FWIW I've personally started leaning more towards snake case in general. I think it's overall more readable, and then you don't have to do funky things with back to back acronyms. I don't have any strong opinions on how to capitalize, but having_underscores_between_words mimics natural writing more than crammingABunchOfWordsTogether.

Also, I would vote for an "SFE" prefix instead of "SparkFun".

@gigapod
Copy link
Member Author

gigapod commented Dec 18, 2023

Focusing on Arduino:

From what I see in Arduino Library Land, Library Names seem to follow {Company/Org name}{Library Functionally Name}, but it's also all over the map. And the include file for the library follows the library name. So from a Library Naming standard, we use the above suggestion: SparkFun[Library Specific Name] ... Same for the header. TBH I don't like it - too long and too beginner focused - but it's Arduino and that seems to be the style.

For Library Class Names, the Arduino Library class name seems to be the same has the include file, which is the same as the library name/folder. While Arduino (as far as I can find) doesn't explicitly call this pattern out, they imply it in this document by referencing a library that does it. https://docs.arduino.cc/learn/contributions/arduino-library-style-guide

I suggest we do this for our Arduino Libraries (folder, main header/impl and main overall class):
SparkFun_*[UpperCamelForProduct]

It's basically what's in place now.

Anything beyond that, we just use the sfeTk pattern. (lower camel).

@SFE-Brudnerd
Copy link
Member

When you submit a library to the Arduino library registry you will get warnings about those sorts of things from the github actions linter. See here: arduino/library-registry#3744

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants