-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add ADR about when to use plural for mod names
- Loading branch information
1 parent
93e8ae4
commit e77d89f
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
docs/adrs/20240227164834_use_plural_for_modules_containing_collections.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Use plural for modules containing collections of types | ||
|
||
## Description | ||
|
||
In Rust, the naming conventions for module names (mod names) generally lean | ||
towards using the singular form, rather than plurals. This practice aligns with | ||
Rust's emphasis on clarity and precision in code organization. The idea is that | ||
a module name should represent a single concept or functionality, which often | ||
means using a singular noun to describe what the module contains or does. | ||
|
||
However, it's important to note that conventions can vary depending on the | ||
context or the specific project. Some projects may choose to use plural forms | ||
for module names if they feel it more accurately represents the contents of the | ||
module. For example, a module that contains multiple implementations of a | ||
similar concept or utility functions related to a specific theme might be named | ||
in the plural to reflect the diversity of its contents. | ||
|
||
This could have some pros anc cons. For example, for a module containing types of | ||
requests you could refer to a concrete request with `request::Announce` or | ||
`requests::Announce`. If you read a code line `request::Announce` is probably | ||
better. However, if you read the filed or folder name `requests`gives you a | ||
better idea of what the modules contains. | ||
|
||
## Agreement | ||
|
||
We agree on use plural in cases where the modules contain some types with the | ||
same type of responsibility. For example: | ||
|
||
- `src/servers`. | ||
- `src/servers/http/v1/requests`. | ||
- `src/servers/http/v1/responses`. | ||
- `src/servers/http/v1/services`. | ||
- Etcetera. | ||
|
||
We will change them progressively. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Architectural Decision Records (ADRs) | ||
|
||
This directory contains the architectural decision records (ADRs) for the | ||
project. ADRs are a way to document the architectural decisions made in the | ||
project. | ||
|
||
More info: <https://adr.github.io/>. | ||
|
||
## How to add a new record | ||
|
||
For the prefix: | ||
|
||
```s | ||
date -u +"%Y%m%d%H%M%S" | ||
``` | ||
|
||
Then you can create a new markdown file with the following format: | ||
|
||
```s | ||
20230510152112_title.md | ||
``` | ||
|
||
For the time being, we are not following any specific template. |