Excellent thanks Jaime, you have given me a lot to think about. i think its best for me to start looking into these DAO's and refer back to what you have said, and get back to you again with more questions if you don't mind :)
thanks again for your help, really appreciate it Richard >Richard, > >If your project.add() method is adding a test - yeah, that sounds right. >Although I'd call it addTest(). And then internally the project would >delegate to a DAO to do the add. So project.addTest() would call >TestDAO.add(). > >project.addTest() would take a parameter of type Test - i.e. you'd first >create a Test object, then pass it to addTest(). It's also often convient >to have a project.createTest(), which takes as parameters all the basic >properties required to create a new Test object and returns the new Test. >So you might say: >project.addTest(project.createTest(param1, param2)); > >OK, some details: > >1. >In this example TestDAO is acting as a collection object, albeit >specifically a database-backed collection. You can imagine you could do a >similar thing with an in-memory collection like a struct. The natural >progression is to make in-memory collections act just like database-backed >collections so you can switch between the two, but in practice there are >some ColdFusion-specific issues with doing this. > >2. >project.createTest() is a "factory method", which makes Project a "factory" >for Tests. This makes sense if all tests have to live inside projects. If >tests can stand alone, you need a different factory, maybe a dedicated >factory object that encapsulates the creation logic for your top-level >domain objects. You'll probably need this for creating Project instances >anyway. If this same top-level factory also has a DAO that lets it >manipulate existing Projects, it's starting to look like a "service" object. > >3. >Where do all these DAOs come from? You can have your top-level factory know >how to create them, and then the creation logic for your domain objects >would make sure that each domain object has it's DAO. So you'd have >something like (in pseudocode): > >component myAppFactory: > > method createTestDAO() > return new TestDAO(DSN = "my_datasource") > > method createProject (name_param, description_param) > return new Project( > name = name_param, > description = description_param, > dao = createTestDAO() > ) > >Hope this helps > >Jaime Metcher > >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:306052 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

