[flexcoders] Re: Defining the DSN in a Gateway When using Flex

2007-04-25 Thread klar1ty
--- In flexcoders@yahoogroups.com, Kyle Hayes [EMAIL PROTECTED] wrote:

 I will try to explain this the best I can. I am building an application
 using ColdFusion and Flex and I want to make sure that I am following
 good practice techniques.
 
 I have a root level COM folder which has various packages inside of it.
 Inside the com.hayes.myproject package contains the much of the
 Gateways, DAOs, and CF VOs for my application. I know that it is good
 practice to pass in the name of a datasource when you first initialize a
 Gateway or DAO. This would normally not be an issue in a 100% CF
 application.
 
 But how do I do that when I am working with Flex? Obviously there is no
 way to do it from the RemoteObject from my understanding.




You want to keep the flex client ignorant of the backend. You wouldn't
put your DSN as a hidden form field in your HTML based application
would you?


One thing you might look into is either storing the DSN in the
Application scope, or adding a service layer in between your
Gateway/DAO objects.

The service layer would take care of initializing and calling the
DAO/Gateways. 

As your application gets more complex, you might find the relationship
between what your Flex RemoteObject call should retrieve and what your
DAO/Gateway layer should return are different. Having the Service
layer will help you account for that.


HTH






[flexcoders] Re: Defining the DSN in a Gateway When using Flex

2007-04-25 Thread Kyle Hayes
--- In flexcoders@yahoogroups.com, klar1ty [EMAIL PROTECTED] wrote:

 --- In flexcoders@yahoogroups.com, Kyle Hayes kyleslists@ wrote:
 
  I will try to explain this the best I can. I am building an
application
  using ColdFusion and Flex and I want to make sure that I am following
  good practice techniques.
  
  I have a root level COM folder which has various packages inside
of it.
  Inside the com.hayes.myproject package contains the much of the
  Gateways, DAOs, and CF VOs for my application. I know that it is good
  practice to pass in the name of a datasource when you first
initialize a
  Gateway or DAO. This would normally not be an issue in a 100% CF
  application.
  
  But how do I do that when I am working with Flex? Obviously there
is no
  way to do it from the RemoteObject from my understanding.
 
 
 
 
 You want to keep the flex client ignorant of the backend. You wouldn't
 put your DSN as a hidden form field in your HTML based application
 would you?
 
 
 One thing you might look into is either storing the DSN in the
 Application scope, or adding a service layer in between your
 Gateway/DAO objects.
 
 The service layer would take care of initializing and calling the
 DAO/Gateways. 
 
 As your application gets more complex, you might find the relationship
 between what your Flex RemoteObject call should retrieve and what your
 DAO/Gateway layer should return are different. Having the Service
 layer will help you account for that.
 
 
 HTH


That is an excellent point. Someone else suggested a service layer as
well on another forum that I posted this message to. I guess it is
finally time for me to become very proficient at service layers. I
know what they are but I have never done some real work with them.
Thanks for your help!