xref: /aosp_15_r20/external/aws-sdk-java-v2/docs/design/NamingConventions.md (revision 8a52c7834d808308836a99fc2a6e0ed8db339086)
1*8a52c783SCole Faust**Design:** Convention, **Status:** [Accepted](README.md)
2*8a52c783SCole Faust
3*8a52c783SCole Faust## Naming Conventions
4*8a52c783SCole Faust
5*8a52c783SCole FaustThis page describes the naming conventions, nouns and common terms
6*8a52c783SCole Faust
7*8a52c783SCole Faust### Class Naming
8*8a52c783SCole Faust
9*8a52c783SCole Faust#### General Rules
10*8a52c783SCole Faust* Prefer singular class names: `SdkSystemSetting`, not `SdkSystemSettings`.
11*8a52c783SCole Faust* Treat acronyms as a single word: `DynamoDbClient`, not `DynamoDBClient`.
12*8a52c783SCole Faust
13*8a52c783SCole Faust#### Classes that instantiate other classes
14*8a52c783SCole Faust
15*8a52c783SCole Faust* If the class's primary purpose is to return instances of another class:
16*8a52c783SCole Faust  * If the "get" method has no parameters:
17*8a52c783SCole Faust    * If the class implements `Supplier`: `{Noun}Supplier` (e.g. `CachedSupplier`)
18*8a52c783SCole Faust    * If the class does not implement `Supplier`: `{Noun}Provider` (e.g. `AwsCredentialsProvider`)
19*8a52c783SCole Faust  * If the "get" method has parameters: `{Noun}Factory` (e.g. `AwsJsonProtocolFactory`)
20*8a52c783SCole Faust
21*8a52c783SCole Faust#### Service-specific classes
22*8a52c783SCole Faust
23*8a52c783SCole Faust* If the class makes service calls:
24*8a52c783SCole Faust  * If the class can be used to invoke *every* data-plane operation:
25*8a52c783SCole Faust    * If the class is code generated:
26*8a52c783SCole Faust      * If the class uses sync HTTP: `{ServiceName}Client` (e.g. `DynamoDbClient`)
27*8a52c783SCole Faust      * If the class uses async HTTP: `{ServiceName}AsyncClient` (e.g. `DynamoDbAsyncClient`)
28*8a52c783SCole Faust    * If the class is hand-written:
29*8a52c783SCole Faust      * If the class uses sync HTTP: `{ServiceName}EnhancedClient` (e.g. `DynamoDbEnhancedClient`)
30*8a52c783SCole Faust      * If the class uses async HTTP: `{ServiceName}EnhancedAsyncClient` (e.g. `DynamoDbEnhancedAsyncClient`)
31*8a52c783SCole Faust  * If the class can be used to invoke only *some* data-plane operations:
32*8a52c783SCole Faust    * If the class uses sync HTTP: `{ServiceName}{Noun}Manager` (e.g. `SqsBatchManager`)
33*8a52c783SCole Faust    * If the class uses async HTTP: `{ServiceName}Async{Noun}Manager` (e.g. `SqsAsyncBatchManager`)
34*8a52c783SCole Faust    * Note: If only the only implementation uses async HTTP, `Async` may be excluded. (e.g. `S3TransferManager`)
35*8a52c783SCole Faust* If the class does not make service calls:
36*8a52c783SCole Faust  * If the class creates presigned URLs: `{ServiceName}Presigner` (e.g. `S3Presigner`)
37*8a52c783SCole Faust  * If the class is a collection of various unrelated "helper" methods: `{ServiceName}Utilities` (e.g. `S3Utilities`)
38*8a52c783SCole Faust
39*8a52c783SCole Faust### Tests Naming
40*8a52c783SCole Faust
41*8a52c783SCole FaustTest names SHOULD follow `methodToTest_when_expectedBehavior` (e.g. `close_withCustomExecutor_shouldNotCloseCustomExecutor`, `uploadDirectory_withDelimiter_filesSentCorrectly`)