March 2019
Intermediate to advanced
242 pages
6h 21m
English
Type inference with var should be used responsibly. When you remove explicit data type from a variable declaration, the variable name takes the center stage. With inferred types, it is your responsibility to use descriptive and appropriate variable names, so that they make more sense in code. As you know, a piece of code is written once, but read many times.
For example, the following line of code won't make much sense to you or to your team members (especially with a big or distributed team) after a period of time:
var i = getData(); // what does getData() return? Is 'i' a // good name?
The key questions are—what is the variable i used for? What does the method getData() return? Imagine the plight of the other ...
Read now
Unlock full access