Code Smell 99 — First Second

How many times do we see lazy argument names?

Maximiliano Contieri
Dev Genius

--

Photo by Priscilla Du Preez on Unsplash

TL;DR: Name your arguments according to the role and not the accidental position

Problems

  • Readability
  • Intention Revealing Names

Solutions

1. Use meaningful names

Context

When writing methods, we usually don’t stop to find decent names.

We never refactor the obvious, neither.

Sample Code

Wrong

Right

Detection

[x] Manual

We can warn for forbidden words like ‘first’ and ‘second’ as argument names.

Tags

  • Readability

Conclusion

Always follow rule suggesting parameter.

Name your collaborators according to the role.

Relations

More Info

--

--

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