Name formats
In programming languages (and sometimes in computer files and names in general), there are a lot of different rules that could be used to name different things like files and variables. When working in a large team, choosing consistent conventions for naming these things makes reading and writing code easier. At the AssemblyLine project, we've settled on several conventions:
Types of Naming Conventions
snake_case
- Start with a letter, not a digit
- Separate words with underscores (
_) instead of spaces - All other characters are either 0 to 9 or lowercase a to z (alphanumeric)
Some examples: number_of_people, issue_12_address, protective_order.pdf
kebab-case
- Start with a letter, not a digit
- Separate words with dashes (
-) instead of spaces - All other characters are either 0 to 9 or lowercase a to z (alphanumeric)
Some examples: protective-order.yml
PascalCase
- Start with a letter, not a digit
- Each word starts with an uppercase letter
- All the words are squished together
- All characters are either 0 to 9 or a to z (alphanumeric)
Some examples: ProtectiveOrder, ProtectiveOrderRemoveAddress
Uses of Naming Conventions
Form Files stored in docassemble: snake_case
- Makes it clear to lawyers, and we can use the file name as a variable name as well.
- Avoid using the section numbers of the law unless they are the common name of the form.
- Include at least one descriptive term.
- Example: use
protective_order_209A.pdf, even if attorneys call it "209A".
- Example: use
- Avoid adding suffixes or information about the progress of the form at the end of the file. For example, use
protective_order.pdfoverprotective_order_processed.pdforprotective_order_reviewed.pdf. - In all other ways, use the common name of the form - the name attorneys know it by.
Downloadable documents: kebab-case
- We use dashes (
-) because underscores (_) can be hard to see in file names, especially if the text is underlined. - Exactly the same as the docassemble form name in all other ways.
Other files stored in docassemble: snake_case
snake_caseis a common convention and is clear to developers
PDF variables: snake_case
- Each label name must be unique. See how to ensure uniqueness while still creating fields that display the same value.
- Meets PDF or DOCX requirements
- Is consistent with AssemblyLine conventions (which will help you!). See more details about labels' variable names in documents.