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