However, in throwing together some projects ASAP I ended up putting a bunch of things into my IBOs that I knew belonged elsewhere. I have no problem with the IBO handling transformation and validation of fields (via composition), but the IBO is fundamentally part of the model. My BaseIBO, BaseDAO and BaseService between them comprise a pretty good starting point for replacing a lot of model methods with simple declaritive code. So when I started dropping in DisplayField() and DisplayValue() both of which were HTML aware I knew that it would be time for a refactoring shortly.
I started by revisiting all of the IBO methods, adding some additional functionality which I needed for finding, ordering and paging and then broke out the view methods into a BaseHTMLIBO view helper which automatically decorates IBOs in the view. I could have just mixed in the additional methods, but I’d never used a decorator and (more importantly) I felt that by using a decorator I would more accurately be “describing” my intent in the code.
Later today I’ll post on the new IBO interface and why I made the choices that I did. Then expect a series of posts on the latest BaseService and BaseDAO components. I’ll release code over the next few days.