I commonly place into variables values that are only used once after assignment. I do this to make debugging more convenient later, as I m able to hover the value on the one line where it s later used.
For example, this code doesn t let you hover the value of GetFoo():
return GetFoo();
But this code does:
var foo = GetFoo();
return foo; // your hover-foo is great
This smells very YAGNI-esque, as the functionality of the foo s assignment won t ever be used until someone needs to debug its value, which may never happen. If it weren t for the merely foreseen debugging session, the first code snippet above keeps the code simpler.
How would you write the code to best compromise between simplicity and ease of debugger use?