Skip to content

Commit a6d9f5b

Browse files
authored
Documented naming conventions of when we use different class suffixes, like 'Manager', 'Client', 'Utilities', etc. (#2602)
1 parent 00a503b commit a6d9f5b

File tree

1 file changed

+28
-8
lines changed

1 file changed

+28
-8
lines changed

docs/design/NamingConventions.md

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,34 @@
44

55
This page describes the naming conventions, nouns and common terms
66

7-
- Abbreviations must follow the same conventions as any other word (eg. use `DynamoDbClient`, not `DynamoDBClient`)
7+
### Class Naming
88

9-
- Use Singular Enum Name
10-
11-
For enum classes or "pseudo-enums" classes(classes with public static fields), we should use singular name. (eg. use `SdkSystemSetting`, not `SdkSystemSettings`)
9+
#### General Rules
10+
* Prefer singular class names: `SdkSystemSetting`, not `SdkSystemSettings`.
11+
* Treat acronyms as a single word: `DynamoDbClient`, not `DynamoDBClient`.
1212

13-
- Use of `Provider`, `Supplier` and `Factory` in the class name.
14-
- For general supplier classes (loading/creating resources of the same kind), prefer `Provide` unless the class extends from Java `Supplier` class. (eg. `AwsCredentialsProvider`)
15-
- For factories classes (creating resources of same or different kinds), prefer `Factory`. (eg. `AwsJsonProtocolFactory`)
16-
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 implements `Supplier`: `{Noun}Provider` (e.g. `AwsCredentialsProvider`)
19+
* If the "get" method has paramters: `{Noun}Factory` (e.g. `AwsJsonProtocolFactory`)
20+
21+
#### Service-specific classes
1722

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`)

0 commit comments

Comments
 (0)