{
Although it seems to be a little disagreement over the existence of beautiful code, a refactor I did today was pleasant to my eye.
Starting with:
string result;
if (parameterLessCommands.Contains(commandName))
{
result = RunArglessCommand(user, commandName);
}
else {
string commandArg = RetrievePairCommandArg(commandData);
result = RunArgCommand(user, commandName, commandArg);
}
return result;
Ending with:
return
(parameterLessCommands.Contains(commandName)) ?
RunArglessCommand(user, commandName) :
RunArgCommand(user, commandName,
RetrievePairCommandArg(commandName));
I'll take it. ()?: is your friend!