Skip to content

Commit

Permalink
chore: add ADR about when to use plural for mod names
Browse files Browse the repository at this point in the history
  • Loading branch information
josecelano committed Feb 27, 2024
1 parent 93e8ae4 commit e77d89f
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
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.
23 changes: 23 additions & 0 deletions docs/adrs/README.md
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.

0 comments on commit e77d89f

Please sign in to comment.