Frameworks Conference 2007 : Design Pattern Safari
admin | May 16th, 2007 | conferencesPeter Farrell gave this session and it made me wonder what he’s teaching to the ColdFusion community. In fact there were a lot of ideas that he was preaching that came off to me as extremely naive and short sighted. With that being said, please understand that my review of his session is just my opinion, I could be completely off base and detached in terms of OOD.
One of the big things that got me, which is something that got me while attending cf.objective(), is the ColdFusion Community Experts’ use of the DAO and (Table) Gateway pattern. Peter explained a DAO as an object used to represent a single row in your database mapping to a single Bean in your application. Who said that a single row is the only way to represent your object model in a relational one? If this is what you consider a DAO, what’s the ActiveRecord pattern? The other thing that gets me is their use of the (Table) Gateway pattern. The community’s interpretation of this pattern is encouraging a nasty mix of a relational data structure in an object-oriented model. Peter claims that this is ok for performance, and I agree that sometimes you want the relational data in its raw format for performance improvements (i.e. - reporting). That being said, how do we represent a report in our object models? Let’s create an object to represent the report we’re trying to generate which wraps the relational data structure and then expose behavior on the report like render(). The reason to work within an object-oriented paradigm is to emulate the environment in which the problem exists and to form a solution which matches the ideal real-world solution as closely as possible. Now this definition is a bit loose, but the general idea is there. We need the concept of a collection of objects to work within an object-oriented paradigm. Collections themselves are traditionally objects with responsibilities/behaviors of their own. If performance is a concern, then implement caching, lazy load techniques, or something else geared towards performance in your architecture; don’t smelt the relational model into the object model. To say that collections of objects are not useful and a huge performance overhead is very naive.
Peter went on to talk about the Singleton pattern. He represented the concept of the Singleton pattern as storing a variable in the Application scope. Obviously, this is not an implementation of the Singleton pattern, just the use of a persistent memory scope. He didn’t mention anything about the responsibilities of an object implementing the Singleton pattern in terms of construction, accessing the same instance reference in memory, or the effect of the pattern on object cohesion.
Overall I’d give this session a “pass” on the must listen list. I’m dissapointed with the Frameworks Conference and the allowance of a presentation of this quality, especially obtaining the materials ahead of time. Nothing personal Peter, I still have lots of learning to do as well, but I didn’t care for the presentation.
