Marino was handed this code. Like all great code, it’s written defensively, protecting itself against nulls, empty strings, and other unexpected values.
I mean, sort of.
public static void LogMessageWithArguments(string message, params object[] args) {
Condition.Requires(message, "Message");
Condition.Requires(args, "arguments");
if (string.IsNullOrEmpty(message))
{
message = string.Empty;
}
if (args != null)
{
message = string.Format(message, args);
}
if (string.IsNullOrEmpty(message))
{
throw new NullReferenceException("Geen data om te loggen");
}
Log(message);
}
I mean, they’re really thorough about checking that the message has an actual value. Marino checked the Log
function, and found that it already had an overload the accepted a list of formatting parameters, thus making this function both redundant and ugly.
[Advertisement]
BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!