Why use constuctor injection in controllers or forms? Documentation is proposed to use injection in constructor instead of using \Drupal::service(). Why?

Example with injection:

class MyController extends ControllerBase implements ContainerInjectionInterface {
  protected $database;
  public function __construct(Connection $database) {
    $this-&gt;database = $database;
  }
  public static function create(ContainerInterface $container) {
    return new static(
      $container-&gt;get('database')
    );
  }
}


Example without injection (it is easier):

class MyController extends ControllerBase {
  protected $database;
  public function __construct() {
    $this-&gt;database = \Drupal::service('database');
    // or
    $this-&gt;database = \Drupal::database();
  }
}
As soon as you start to test MyController you will run into problems 

The test harness must be able to instantiate the minimum amount of stuff  around your class to still be able to put it through its paces.

It is easier to mock up and inject a simple container.. rather provide \Drupal::service as it will rapidly spiral out of control and your test harness will have to provide a full drupal environment.

In more formal language you have just "tightly coupled" MyController to the drupal eco-system, and so you have made your code less reusable.