DEV Community

Cover image for Code Smell 99 - First Second
Maxi Contieri
Maxi Contieri

Posted on • Originally published at maximilianocontieri.com

Code Smell 99 - First Second

How many times do we see lazy argument names?

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

class Calculator:
  def subtract(self, first, second):
    return first - second

class CalculatorTest:  
  def test_multiply():
    assert