DEV Community

Aleksei Aleinikov
Aleksei Aleinikov

Posted on

✍️ Should you name that variable counter, cnt, or just c?

In 2025, clear code wins — but verbosity kills flow.
✅ Short, context-clear names keep logic front and center.
✅ Compact loops scan faster (both in CPU and human heads).
✅ Use longer names only when scope demands it.

When brevity wins:

  • Local accumulators (s, v, i)
  • Common Go handlers (w, r)
  • Small, tight math functions

When to go long:

  • Exported identifiers
  • Variables living across dozens of lines
  • Complex structs shared across packages

💡 I break down practical examples (slices, handlers, readers), show do’s and don’ts, and share quick checkpoints to keep your future self sane.

https://levelup.gitconnected.com/go-keep-your-variable-names-brief-and-clear-in-2025-52ff06ea0e7d

Top comments (0)