Tim H inherited some code which has objects that have many, many properties properties on them. Which is bad. That clearly has no cohesion. But it's okay, there's a validator function which confirms that object is properly populated.

The conditions and body of the conditionals have been removed, so we can see what the flow of the code looks like.

if (...) {
    if (...) {

    } else if (...) {

    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    } else if (...) {
        
    }
} else {
  // default
}

It's important to note that this conditional doesn't validate every property on the object. Just most of them.

Even with autocomplete I feel like this is going to make you wear out your "{" key.

[Advertisement] Picking up NuGet is easy. Getting good at it takes time. Download our guide to learn the best practice of NuGet for the Enterprise.