5 ms·
public bool ShowOptional() { bool bolReturn = false; return bolReturn; } The above actually seems reasonable if you assume the programmer that wrote
by ep103 13y ago
public bool ShowOptional()
{
bool bolReturn = false;
return bolReturn;
}
The above actually seems reasonable if you assume the programmer that wrote it was intelligent. I'm imagining that the above code is called multiple times by the application, for a new optional feature in development. Currently, they haven't developed the feature, and so we are always returning false. But in the future, we likely will want to show the feature given some condition. So this programmer has (hopefully) decided that (s)he will write the current code to take this future development into account, and rather than pass some boolean or config value throughout the code, has isolated it to one specific method.
Now, when they go to implement Optional, whatever that is, that developer can just update this one method with the expression, and go about coding their feature without any knowledge of the previous code base, which is exactly what's supposed to happen.
- michael_h 13y agoWhy have a variable then? return false; Done.
- pmelendez 13y agoI used to write this kind of snippet when creating the skeleton of a function, this seems like a leftover that was over-sighted in the code review (assuming that there was a code review at all)
- pc86 13y agoIf that’s the case shouldn’t they have just used public bool ShowOptional() { return false; } ?