Jonathan Birkholz

Reducing Exceptional Cases

We have a third party control suite that provided some aggregation functionality. The third party controls had some built in aggregate functions but was missing some other more business centric functions.

We ended up coding every aggregate as a separate custom class and not using any of the built in aggregates. My team member asked me why not use the built in aggregates?

The reasoning is that if we used some built-in aggregates and then built the custom aggregates for the other functions, we would have 2 methods of aggregation to maintain. If we treat all the aggregates as custom, then instead of having 2 scenarios, we have one. We don’t have any exceptions. All aggregates are custom aggregates.

Not only do we simplify our code and future maintenance, we eliminate any dependency on the third party aggregates. Now we are free to change control vendors and not worry about losing our aggregation functionality.

The point I want to make is look to simplify your code. Eliminate exceptional cases as much as possible. Make everything the same and you achieve simplicity and flexibility.