Posts Tagged ‘Pair Programming’

The PythonShop saga continues

Monday, January 28th, 2008

We made a lot of progress working on our python shop this weekend. Our working patern ended up being a pair programming scenario, with him at the keyboard (as he was the python person, this was the most efficient) and me finding logic problems, and working on the overall program design. Based on some of what I’d seen discussed recently on the Alt.Net list regarding validation, we ended up doing a close-to-the domain style validation. The classic TurboGears way of data validation is to attach it to the page methods inside the controller. In contrast, the Alt.Net discussion centered around how domain logic validation (for instance, object x should have an object y to allow a certain set of actions, and this integer should not allow things outside of a certain range, and certain fields should be required) should be usable with the business objects themselves. If this is really domain logic, that is something that gets changed by the client, should be in one place and should be reusable no matter how these objects are addressed, bet it in other forms in the application, future tests, or even command-line manipulations. In a more advanced scenario, we could even have different object validators that we inject as appropriate… since this project is a toy 5-table project, we considered that, and decided that was out of scope. But to bring that object validation logic into the domain, we ended up working an optional validator method into the business objects.. We still have validation in the controller to deal with the form, but it purely tests for formatting of input… for instance, numbers should be numbers, to make sure that any data that makes its way into the object at all at least is the right type so the validator there won’t throw up trying to compare a text string to a decimal or something. The only negative of this is that it ends up being a two-pass validation, (type formatting then business validation) but it seemed like an acceptable tradeoff.