When to Use the Builder Design Pattern
Have you ever looked back at old code you wrote and asked yourself, "Why did I do it that way?" I do that quite a bit and found myself doing just that on the open source project VoiceModel that I coordinate and contribute to. I think it is healthy to question your method of coding as it can lead to refactoring that makes the code easier to understand and maintain, to name just a few benefits of refactoring. The section of code in question had to do with how states where created in a state machine. VoiceModel has a built-in state machine that make it easy to build voice application call flows . You add states to the state machine that represent actions like playing a prompt to the user or get input from the user from a telephone keypad or using speech recognition. These states are specific to the voice part of the application, but you can also have states that perform background operations, such as a query a database. The states that are used for voice needed to be wi