Dev Genius

Coding, Tutorials, News, UX, UI and much more related to development

Follow publication

Code Smell 33 — Abbreviations

Maximiliano Contieri
Dev Genius
Published in
2 min readNov 24, 2020

Photo by Jessica Knowlden on Unsplash

Problems

  • Coupling
  • Bad Naming
  • Declarativeness
  • Ambiguity
  • Readability
  • Premature Optimization

Solutions

  1. Use meaningful and declarative names.

Examples

  • Variable naming
  • Function naming
  • Package naming
  • Class Naming

Sample Code

Wrong

Right

Detection

We can’t automate choosing what is a short name and a declarative.

Some “modern” and shinny languages enforce this bad practice. So we should wisely choose a good language instead.

Tags

  • Declarative

Conclusion

Computer science was born from the mother of science (mathematics). In math, the assignment of single letter variables (i, j, x, y) is a good practice.

The concept of reference arose from the variable.

Many people wondered why mathematicians can work with such short variables, and computer scientists cannot.

For mathematicians, once entered into a formula, variables lose all semantics and become indistinguishable.

Our brain wastes a lot of energy figuring out what is the meaning of an abbreviation.

It is 2020, We need to write software for humans, not for compilers.

Relations

More info

A long descriptive name is better than a short enigmatic name. A long descriptive name is better than a long descriptive comment.

Robert Martin

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Published in Dev Genius

Coding, Tutorials, News, UX, UI and much more related to development

Written by Maximiliano Contieri

I’m a senior software engineer specialized in declarative designs. S.O.L.I.D. and agile methodologies fan. Maximilianocontieri.com

No responses yet

Write a response