0
$\begingroup$

This is a really basic question. Consider a statement:

A painted line is increased by length $x$

Can $x$ be a negative number just by the wording of the question? What would be a better way of rephrasing the question, to make it clear that $x$ can be negative?

(The reason I'm asking is that I'm programming and a method name needs to indicate that the parameter can be negative or positive, in order to decrease or increase a size)

Basically I'm looking for a generic term for decrease and increase.

  • 1
    @hardmath As a mathematician who programs, I agree that negative arguments with `increaseLengthBy` make perfect sense. Unfortunately when I did this once it was very confusing to non-mathematicians who needed to use the code.2011-07-06

2 Answers 2

2

As a "neutral" verb regarding increase or decrease, I propose "adjust" so that the method would be adjustLengthBy. This is concise but conforms to the MS Code Complete dictum to use strong verbs in function names.

0

I'd say that "A painted line is changed by length $x$." The use of 'increased' implies the change is positive and it sends a confusing mixed message.