Este producto no es compatible con el sitio Datadog seleccionado. ().
Esta página aún no está disponible en español. Estamos trabajando en su traducción. Si tienes alguna pregunta o comentario sobre nuestro actual proyecto de traducción, no dudes en ponerte en contacto con nosotros.
Avoid reassigning values to method parameters as it can make the code harder to understand. Typically, parameter values are expected to remain unchanged throughout the method’s execution, and any reassignment might be not be noticed by other developers.
We consider it acceptable to reassign parameters in small functions, smaller than 20 lines. Otherwise, consider using temporary local variables with clear naming to enhance code readability.
Non-Compliant Code Examples
publicclassPerson{privatevoidgreet(Stringname){System.println("this is a long method");System.println("this is a very long method");name=name.trim();// reassigning parameter valueSystem.println("this is a long method");System.println("this is a long method");System.println("this is a long method");System.println("this is a long method");System.println("this is a long method");System.println("this is a long method");System.println("this is a long method");System.println("this is a long method");System.println("this is a long method");System.println("this is a long method");System.println("this is a long method");System.println("this is a long method");System.println("this is a long method");System.println("this is a long method");System.println("this is a long method");System.println("this is a long method");System.println("this is a long method");System.println("this is a long method");System.println("this is a long method");System.println("this is a long method");System.println("this is a long method");System.println("this is a long method");System.println("this is a long method");System.println("this is a long method");System.println("this is a long method");System.println("this is a long method");System.println("this is a long method");System.println("this is a long method");}}