Self Documenting
by in CodeSOD on 2012-04-30"A little while back, someone introduced the concept of 'self-documenting' code to our team," writes Ryan L. "It was certainly a step forward, but it's somehow taken us two steps backwards. Consider, for example, the following code from an MVC controller."
if (TheFormIsInvalid()) return View("Index", form);
... snip ...
private bool TheFormIsInvalid()
{
return ModelState.IsValid == false;
}

Shawn O. was not used to bright lights, smiling faces, or greetings like “hi Shawn, how are you today?” In fact, just about anything that wasn’t specifically intended to bring pain and misery to all had become foreign to him. It was simply par for the course. Shawn, after all, was an Oracle DBA. And not just any Oracle DBA, but one who sat on the company’s Database Code Review Council.


