Code Smell 105 - Comedian Methods

Code Smell 105 - Comedian Methods

Maxi Contieri
·Nov 23, 2021·

2 min read

Subscribe to my newsletter and never miss my upcoming articles

Play this article

Table of contents

  • Problems
  • Solutions
  • Context
  • Sample Code
  • Detection
  • Tags
  • Conclusion
  • Relations
  • More Info
  • Credits

Use professional and meaningful names

TL;DR: Don't be informal or offensive

Problems

  • Readability

  • Unprofessional work

Solutions

  1. Choose good and professional names.

Context

Our profession has a creative side.

Sometimes we get bored and try to be funny.

Sample Code

Wrong

function erradicateAndMurderAllCustomers();

//unprofessional and offensive

Right

function deleteAllCustomers();

//more declarative and professional

Detection

[X] SemiAutomatic

We can have a list of forbidden words.

We can also check them in code reviews.

Names are contextual, so it would be a difficult task for an automatic linter.

Naming conventions should be generic and should not include cultural jargon.

Tags

  • Naming

Conclusion

Be professional in the way you name things in your code.

Don't be try to be a comedian by giving a variable a silly name.

You should write production code so future software developers (even you) should easily understand.

Relations

More Info

Credits

Photo by Stewart Munro on Unsplash


This ‘users are idiots, and are confused by functionality’ mentality of Gnome is a disease. If you think your users are idiots, only idiots will use it.

Linus Torvalds


This article is part of the CodeSmell Series.

 
Share this

Impressum

Technical Opinions are my own. I don't have the revealed truth.

Software Design is a creative activity. These are hints and not rigid rules.

I write on BackEnd Business Systems and OOP Design. My advice/experience might not suit other systems.

You can write me at info(at)maximilianocontieri.com