Azure / azure-sdk-for-cpp

This repository is for active development of the Azure SDK for C++. For consumers of the SDK we recommend visiting our versioned developer docs at https://azure.github.io/azure-sdk-for-cpp.
MIT License
181 stars 126 forks source link

Codify guidelines for "helper" functions. #6164

Open LarryOsterman opened 3 weeks ago

LarryOsterman commented 3 weeks ago

Currently we have no class naming guidelines for "helper" classes.

Examples include:

Codify the use of the suffix naming so that we are consistent within the Azure SDK.

Extremely preliminary thoughts:

Type names without suffixes should represent concrete types that can be stored in another types. Examples include:

These types should contain non-static methods because they represent a concrete idea.

Static-only helper types should always have a suffix.

Known suffixes include:

Related guideline:

github-actions[bot] commented 3 weeks ago

Thank you for your feedback. Tagging and routing to the team member best able to assist.

ahsonkhan commented 2 weeks ago

Is the intent to codify this guideline meant for public surface area that we can't change/modify, or for implementation detail?

LarryOsterman commented 2 weeks ago

Is the intent to codify this guideline meant for public surface area that we can't change/modify, or for implementation detail?

This guideline is meant for the Azure SDK for C++.

It applies to all scenarios in which we might be defining types.

For instance, when considering whether a type is a helper type or not, by definition helper types should not define concrete constructs - for example, Uuid, ETag, and UserAgent - by their name, these types are values and thus can be expected to be used as a variable or class member. But UserAgentGenerator/UserAgentBuilder/UserAgentHelper are names which make it clear that they are NOT expected to be used as a variable.

Note that we could also consider defining these functions as free functions within a namespace, but that has its own set of challenges (I'm personally not a fan of free functions).