Skip to content

Suggestion: Add section or clarification about datatypes in variable names #37

Open
@jezeke

Description

@jezeke

One major contributor of code smell (in my opinion) is code that superfluously includes the type of the thing in its name. (e.g. List itemList, or CREATE TABLE itemTable instead of just items). This goes hand-in-hand with the "avoid context-duplication" rule too.

One edge-case to consider is date type variables- whereby you may have item.dateAdded, and simply removing the type from the name leaves you with item.added, which is very unclear (sounds more like a boolean flag set if the item has been added). My personal preference is to follow the form of At. So, dateAdded would be addedAt. This defies the A/HC/LC pattern somewhat however, so take it as you will.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions