Code complexity

time to read 4 min | 733 words

If we are talking about code comments, here is a piece of code that I don't think should deserve a comment:

public IEnumerable<RuleResult> Validate(Rule rule, DateTime date)

{

       if (false == this.IsInRange(date)) (Update: Moved to an explicit method because it is obviously not working)

              yield break;

       yield return rule.Validate(this, date);

       foreach (EmployeeSnapshot snapshot in EmployeeSnapshots)

       {

              if (snapshot.IsInRange(date) == false)

                     continue;

              IEnumerable<RuleResult> enumerable = snapshot.Validate(rule, date);

              foreach (RuleResult result in enumerable)

              {

                     yield return result;

              }

       }

}

What do you think?