There is a fine line between short code and readability, which is, by far, one of the most important factors of code quality. Say you have a code:
$this->executeAfter(5);
This is a short code, but it's not readable. What the hell is 5 here? Let's improve it a little bit. class Time {
protected $seconds;
private function __construct($seconds)
{
$this->seconds = $seconds;
}
public static function inSeconds($seconds)
{
return new self($seconds);
}
}
$this->executeAfter(Time::inSeconds(5));
I've just added ~10 lines of code, but the readability of executeAfter is way better. In addition, the executeAfter method is more flexible, since it can manipulate the Time object now.This is a very basic example to illustrate what I meant when drawing a line between the short code and readability.