Dr. Tobias Weltner
Dr. Tobias Weltner
There are two issues to this IMHO. Technically, it is not necessary to assign a default value to an optional parameter if you are fine with the default $null value,...
Commenting on c#: When you write a method in c#, you need to define parameters. You can either provide an explict default value (in which case the parameters are optional),...
Assigning $null to a default value is an active measure you took, so chances are you thought about it. Not assigning anything is often something that just slipped through.
@Jaykul that is not true. C# does not work the way you suggest. Compare method parameters, not field initializers.
@Jaykul in the real world, we have uncovered _tons_ of issues this way. People write functions and define parameters, then they call them always with their sets of arguments. Once...
So why strongly type a variable? If you always write perfect code, you can get around a lot of things that otherwise can protect you.
I guess what I want to say is: there is a natural clash when it comes to best practice discussions. Everyone has his or her special background, and of course...
what kind of comment is a "thumbs down"?
So when a rule proves to identify significant numbers of real-world issues, then you are still opposed to it because people should have just written better code in the first...
@rkeithhill null-checking would be equally valuable in uncovering the issues I talked about. Maybe it would also be a better approach. @Jaykul the purpose was a discussion I assumed. Now...