What was I thinking?

At my day job I am working on an API into an E911 interface and while writing my DSL to ingest and perform certain actions against their SOAP interface I quickly noticed an opportunity to refactor.  The end result is much cleaner and in my opinion easier to decipher what is happening.

To bring you up to speed this particular function is for searching against their database for a location, there are several “optional” fields you can send over to narrow and scope your search.  Obviously to properly expose the feature my DSL needs to be able to account for all the possible options.  Here is what the code was before refactoring

(WARNING: it is ugly)

Continue reading