O'Reilly logo
  • Sriram Parthasarathy thinks this is interesting:

The main change I have made is to add a class constructor that accepts an implementation of the IValueCalculator interface, changing the HomeController class so that it declares a dependency.

From

Cover of Pro ASP.NET MVC 5, Fifth Edition

Note

He has made the property calc - IValueCalulator calc as a property of the Home Controller while in the previous case it was a variable in the index method. By declaring it as a private property and creating a constructor that takes IValueCalculator he has tied both together.