Dev Genius

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

Follow publication

Code Smell 87 — Inconsistent Parameters Sorting

Maximiliano Contieri
Dev Genius
Published in
Sep 26, 2021

Photo by Lance Grandahl on Unsplash

TL;DR: Don’t confuse you readers. Keep the order.

Problems

  • Readability
  • Consistency

Solutions

  1. Refactor and change parameters order.
  2. Use named parameters

Sample Code

Wrong

Right

Detection

  • Some very smart linters may be able to compare arguments and hint for possible mistakes.

Tags

  • Readability

Conclusion

This is a very simple smell.

Readability is very important to avoid mistakes.

Relations

Credits

Computers are good at following instructions, but not at reading your mind.

Donald Knuth

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