Replace Parameter with Explicit Methods

You have a method that runs different code depending on the values of an enumerated parameter.

Create a separate method for each value of the parameter.

void setValue (String name, int value) {
  if (name.equals("height")) {
    _height = value;
    return;
  }
  if (name.equals("width")) {
    _width = value;
    return;
  }
  Assert.shouldNeverReachHere();
}

image/svg+xml

void setHeight(int arg) {
  _height = arg;
}
void setWidth (int arg) {
  _width = arg;
}

inverse of Parameterize Method