Inline Method

A method's body is just as clear as its name.

Put the method's body into the body of its callers and remove the method.


	int getRating() {

		return (moreThanFiveLateDeliveries()) ? 2 : 1;

	}

	boolean moreThanFiveLateDeliveries() {

		return _numberOfLateDeliveries > 5;

	}


	int getRating() {

		return (_numberOfLateDeliveries > 5) ? 2 : 1;

	}

For more information see page 117 of Refactoring

| Refactoring Home | | Alphabetical List |