views:

37

answers:

1

I am writing a motor vehicle system for a county government that lets a user select many different types of car tags. The problem is that the state has built in a lot of special little exceptions for tag types. I realize it's very messy and inefficient to simply code if statements for each of these, but I can't seem to find a way to abstract this out because the variations on the tag types are so different. Does anyone have any ideas as to how one would do this? Thanks!

A: 

Here is the best solution I found. What I did was encapsulate the deviations into methods, then in the UI layer I called that function, which returned a boolean if the condition was met. So, for instance:

if(tagType.IsSpecialTag(params)) {
     //display appropriate deviations
   }
Austin