Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Components (CFC) for creating objects

New Here ,
Feb 03, 2010 Feb 03, 2010

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

284
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 03, 2010 Feb 03, 2010
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources