Copy link to clipboard
Copied
Hi all,
I constanly run into a problem when designing new CFCs which I'm hoping you can help me with. It's easier to explin by using an example so here goes...
Imagine that I want to create a new Car which involves the car object being created in the database. I'm not sure if it's the responsibility of the Car components to write to the database or whether I should create a new component e.g. CarManager which would take responsibility.
I'm not sure if I'm making a whole lot of sense but I hope you get the gist of it.
Cheers
Copy link to clipboard
Copied
This is pretty well-trod ground. The approach CF uses (CF9, anyhow) is to use a persistence tier (Hibernate: http://en.wikipedia.org/wiki/Hibernate_%28Java%29) to manage object storage. In short it's not the job of the Car to store itself, no.
If not using CF9, you might want to have a look at Reactor or TransferORM for this sort of thing, rather than reinventing the wheel. I think Reactor is better, but it is no longer being actively developed (but it works fine, so there's not so much of a problem there).
--
Adam