Rules to Better Naming Conventions

Establish clear and consistent naming conventions to enhance the readability and maintainability of your code and resources. These guidelines will help you name everything from databases and APIs to Azure resources and virtual machines, ensuring a cohesive and professional approach across your projects.

  1. In the early days of coding, we had to store more information in our heads than in our computers, leading to all sorts of creative abbreviations and clever shortcuts. But today, storage and readability are no longer limitations—our computers can handle verbose names better than our brains can handle cryptic codes. Clinging to those old practices can hurt your code’s readability and make life harder for your team. Mental gymnastics waste time and money!

    Names should always describe at first glance what something represents.

  2. A fundamental principle of object-oriented programming is that a class represents something from outside the code whether a tangible item, like a car, or an abstract concept, like a record. A class should reflect its purpose as a "thing," not an action. Calling a car "drive" would quickly become confusing, and the same is true in your code.

    Keeping classes named as nouns maintains clarity and reinforces their role as representations of entities in the system.

  3. Code becomes easier to understand when names align closely with their meaning. Since classes represent things, they should use nouns. Methods, on the other hand, represent actions and should be named using verbs. A method named Person, for example, could easily confuse your team by suggesting an entity rather than an action.

  4. Generic names like “manager”, "helper", “processor”, “data”, and “info” are easy to reach for, but they tell us very little about a class or method’s true purpose. These words are catch-alls — they don’t communicate what the code actually does or what entity it represents. Avoiding these vague terms forces us to choose names that reflect a specific role or responsibility.

  5. Code that relies on nicknames, abbreviations, or internal jokes can create unnecessary obstacles for new team members or future collaborators. Terms that only make sense to the “in-group” (like a specific project team or company department) can be hard to interpret, causing frustration and slowing down onboarding.

    Instead, favor widely understandable names or domain-specific terms that reflect a shared understanding of the business or domain.

  6. There’s more than one way to skin a cat (apparently—we don’t have any rules on cat-skinning), and equally, there’s often more than one term to represent a concept. While some terms may have nuanced differences, they can often seem interchangeable. But once you’ve picked a term, stick with it and use it everywhere.

    Inconsistent language is one of the quickest ways to violate the DRY principle and add unnecessary complexity to your codebase.

  7. Naming is most effective when it aligns with the audience’s understanding. In code, this often means distinguishing between when to use technical terms, which are clear to developers, and when to use domain-specific terms, which align more closely with business requirements and are familiar to stakeholders.

    Using technical terms in the wrong context can make code feel disconnected from the business, while overusing domain terms for technical concepts can create confusion.

  8. When creating custom controls, avoid vague or generic names like CustomStepper or CustomDbContext. Generic terms like “custom” or “base” don’t communicate what makes the component unique, and they add little value for other developers. Instead, use meaningful modifiers that describe the component’s specific purpose or customization.

  9. Boolean Properties must be prefixed by a verb. Verbs like "Supports", "Allow", "Accept", "Use" should be valid. Also properties like "Visible", "Available" should be accepted (maybe not). See how to name Boolean columns in SQL databases.

  10. When building solutions for clients, it’s tempting to include personal or company identifiers in control or component names, like GoldieEntry or SSWButton. However, naming controls after yourself or your company in client projects can create confusion, dilute the client’s branding, and look unprofessional.

    For consultants, the goal should be to name components in ways that make sense within the client’s business context.

per page
1 - 10 of 30 items
We open source.Loving SSW Rules? Star us on GitHub. Star