Refactoring Handicap, Part 1
In preperation for moving some of the data storage for Handicap into the cloud, I've started refactoring the code base. I never implmented a business tier between my activity code and the data access code in the past. For this app I felt it was unneccessary becuase that business tier would be extremely thin. The real business logic (handicapping logic) had already been broken into it's own class.
Ideally this will allow me to simplify my testing and allow me to switch backends easily. The amount of work isn't horrible but it has forced me to make a couple adjustments to how the code works. The majority of the coding has been creating interfaces, implementing those interfaces then replacing the references to the data access classes with the new services. The coding has been fairly simple.
Although I was able to make most of the code changes in a pair of three hour sessions I have run into a couple problems. In my original design I relied on a few list views that utilized the cursor to display data. I've been forced to create a couple custom ArrayAdapters to handle pojo instead of a cursor. This new adapter allows me to take the pojo and map specific elements to the display. This was fairly easy to accomplish because i've done this before in excerises from <Link> Reto Meier's book.


Comments