Skip to content

Commit

Permalink
Merge #719: Add ADR about when to use plural for mod names
Browse files Browse the repository at this point in the history
e77d89f chore: add ADR about when to use plural for mod names (Jose Celano)

Pull request description:

  Add ADR about when to use plural for mod names.

ACKs for top commit:
  josecelano:
    ACK e77d89f

Tree-SHA512: c3948e47f5a8e46ee18398081dd213cc9380eef36c8134cd25b3e6323c8f819d6d054297eb221889c77d4e721e03d1a5e5ac322e8880b4ffd1c68364589c063f
  • Loading branch information
josecelano committed Feb 27, 2024
2 parents 93e8ae4 + e77d89f commit b099098
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 b099098

Please sign in to comment.