-
Notifications
You must be signed in to change notification settings - Fork 4k
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
naming conventions: data types (Props & Options) #1740
Comments
A few notes:
|
Don't really agree to disregard the type name. The argument name is positional, so doesn't really impact the code you're writing (yes, it will affect the docs and the code insight, but not the code as written). In languages like Java, the type name will be front and center as well. I do agree we need to standardize both.
Agreed, and it's been floating through my mind as well. Kind of a crossover topic between this ticket and #1741 as well. I would like to (sardonically :P) point out that that discussion is about the type name as well, not about the argument name. |
I wasn't implying to disregard the type name, just that the scope of this convention should be "what should be the type name for types that are used for keyword arguments" |
I am leaning towards just calling everything "Options": microsoft/TypeScript#23552 |
We need to have a naming convention around data objects, used as (optional) keyword arguments.
They are used for three purposes:
Construct
, via its constructor (example:new Bucket(scope, id, PROPS)
).eventRule.addTarget(target, TEMPLATE)
)Construct
indirectly, via a method on an existing construct (example:loadBalancer.addListener(id, LISTENERPROPS)
)In the TypeScript/JavaScript world, data objects used for configuration are usually called options or opts.
In the CloudFormation world, input data for configuring resources are called properties.
Because of our duality (mapping between programming and CloudFormation), we are split between calling these data objects properties and options.
BucketProps
.I propose that we adopt the rule: Props for construct, Options for methods.
So in the examples above, the type names for the configuration objects would be:
BucketProps
, no change.AddTargetOptions
.AddListenerOptions
.Thoughts?
The text was updated successfully, but these errors were encountered: