I was looking at a question on here about confessing your worst code ever written and I am not quite sure, because of my lack of knowledge on why this is bad code.
public string GetUsername (string userName)
{
User user = DbLookup.GetUser(userName);
return user.Username;
}
Is it because, it assumes username will exist and doesn't check for null? Or is there more to it?
http://stackoverflow.com/questions/130965/what-is-the-worst-code-youve-ever-written/191969#191969