[CDBI] Different subclasses for one table / Factory Pattern?
jc5826 at gmail.com
Wed Aug 9 13:48:05 BST 2006
On 8/3/06, Stephan Brunner <stephan.brunner at gmx.de> wrote:
> Right now, I'm thinking about giving up my subclasses in favour of a method
> File->type() that tells me what kind of file I'm dealing with. I dislike the
You have probably come up with a solution by now, I'm sure. Let us
know what you ultimately came up with.
This is a problem I struggle with all of the time and ultimately I
draw the line and don't let my Class models suffer because of
limitations in my data model. By all means have Foo::File::Gif,
Foo::File::PDF, etc which most likely will inheret from from a
Foo::File class. And by all means let those modules use CDBI clases
and anything else you've written to access data. Liberate yourself
from the tyranny of CDBI :)
I wish I saw more discussions here on how to tie the two worlds (Class
vs Data models) better via judicious use of design patterns, etc.
Usually it takes extra coding for me to stick to my original class
diagrams. Although, in several cases I admit to taking a shortcut and
relying directly on the CDBI classes, especially if I design the
schema myself and have it cater to the object world :)
More information about the ClassDBI