Hi,
I just wanted to see if what I'm using is dated or if there is a
cleaner way to do what I'm doing. For example, take the concept of a
user registering on a website.
1. User submits registration data on form
2. Coldbox event handler receives request
3. I'm currently creating an empty RegistrationBean ( I guess like a
value object?? )
4. Populate it using registrationBean.setEmail( rc.email ),
registrationBean.setPassword( rc.password )
5. Call the beans validate method to validate the data, send back to
client if there's a problem, otherwise continue.
6. Event handler has an instance of my Account Service and in my
handler I call
"instance.AccountService.RegisterUser( registrationBean ), passing in
the Registration Bean to the service layer
7. Service layer looks like:
<cffunction name="RegisterUser" access="public" returntype="void">
<cfargument name="registrationBean" type="component"
required="true" hint="The Populated Bean" />
<cfset var result = "" />
<cfset result =
instance.AccountDAO.RegisterUser( arguments.registrationBean ) />
</cffunction>
8. The DAO has a stored procedure call that inserts the data and
returns the id of the newly inserted record
I'm wondering what the problem would be if I just called the DAO
directly as opposed to having this intermediary Service layer that is
just handing off the data to the DAO. Can someone shed some light on
this?
Thanks,
-West