Naming Conventions That Make a Codebase Easier to Read

Editorial illustration.

Originally published 7 August 2023; rewritten and reviewed on 15 October 2026.

Open an unfamiliar repository and you do not have to look far before spotting friction: customer_id in one file, CustomerId in another, and customerID in a helper function. None of those choices will crash the compiler or interpreter, yet every inconsistency forces the next developer to pause and double-check which spelling the object actually uses.

Naming conventions exist to remove that mental tax. They turn formatting choices into muscle memory so code reviews can focus on logic and edge cases instead of punctuation.

Match the casing style to the layer you are working in

In a typical full-stack project, you rarely use just one casing style across the entire system. A C# backend, a SQL database, and a web frontend each have strong ecosystem defaults:

Style Example Typical context
camelCase customerId Local variables, JS/TS object properties, JSON payloads
PascalCase CustomerProfile C# classes, public properties, React/Vue components
snake_case customer_id PostgreSQL/MySQL columns, Python functions and variables
SCREAMING_SNAKE_CASE MAX_RETRIES Environment variables and compile-time constants
kebab-case customer-profile URL slugs, CSS classes, HTML attributes, filenames

Where teams run into trouble is letting one layer leak awkwardly into another without explicit mapping. If your PostgreSQL table uses snake_case (order_total), your ASP.NET Core model uses PascalCase (OrderTotal), and your frontend expects camelCase (orderTotal), define the boundary cleanly at the serialiser or ORM level instead of naming C# properties order_total:

using System.Text.Json.Serialization;

public sealed class InvoiceSummary
{
    [JsonPropertyName("invoiceNumber")]
    public string InvoiceNumber { get; init; } = string.Empty;

    [JsonPropertyName("totalAmountMyr")]
    public decimal TotalAmountMyr { get; init; }
}

When each layer follows its own ecosystem standard and maps cleanly at the edges, anyone joining the project immediately knows what to expect.

Let tooling settle style debates

Reading nearby files before writing new code is still the fastest rule of thumb. If a five-year-old codebase uses a particular convention—even one you personally dislike—sticking with it inside that module is almost always better than introducing a second style halfway through.

To stop style arguments from cluttering pull requests, encode the rules in tooling. An .editorconfig file in the repository root handles indentation and C# naming rules directly in Visual Studio, Rider, and VS Code, while ESLint and Prettier keep TypeScript and CSS uniform on save or in CI. Once the formatter enforces casing automatically, nobody wastes review time asking for a capital letter.

Casing cannot rescue a vague name

Consistent formatting will not help if the underlying words say nothing. Variables like data, tempList, res2, or processItem() obey every casing rule in the book while hiding what the code actually does.

Good names carry domain context and units where it matters:

  • Prefer billingAddress and shippingAddress over addr1 and addr2.
  • Prefer paymentTimeoutMs over timeout so nobody passes seconds by mistake.
  • Prefix booleans so they read like a question with a yes/no answer: isInvoicePaid, hasActiveSubscription, or canSubmitForm.

Test names at the call site

A quick habit I use before committing code is reading the call site out loud without looking at the function body. Compare handleData(x, true) against markInvoicePaid(invoiceId, sendReceiptEmail: true). The second version tells you the intent, the identifier type, and what that boolean flag controls without forcing you to jump to another file.

Good naming is less about picking a favourite casing style and more about building a shared vocabulary for the team. Consistent conventions paired with specific, honest names make a codebase feel calm to work in—even months after you wrote it.