Hehe.

So Gavin, what you are saying is that you can create a CFC have the method
named the same, same arguments and its duplicate code? Regardless that the
meat and guts of the logic is not the same?

Sorry that kinda doesn't sound like duplicate code to me :-)

And your example shows that. And the thing to remember is that the actual
DAO is returning a result, that by all intent and purposes is code reuse.

For example

<cffunction name="getgavinsObject">
    <cfargument name = "ag1" required="true"... >
    <cfargument name = "ag2 required="true"... >

    <cfreturn gavinsDAOCFC.getGavinsObject(arg1 = "#arguments.arg1#, arg2 =
"#arguments.arg2# >
</cffunction>

Gets the data from the database tier, but getGavinsObjectJson might make
the same call to gavinsDAOCFC.getGavinsObject but instead convert the
object to JSON before returning it.

So technically there is no duplication of code, you have taken a call and
separated for reuse by other logic within your code.

-- 
Regards,
Andrew Scott
WebSite: http://www.andyscott.id.au/
Google+: http://plus.google.com/108193156965451149543



On Wed, Jan 11, 2012 at 5:44 PM, Gavin Baumanis <beauecli...@gmail.com>wrote:

> "Technically"?
>
> In the very initial post is this;
>
>> But for the most part, my Service layer becomes a duplicate of the
>> Gateway.
>> * Ensure we have the required arguments for the gateway,
>> * Call the gateway functions, using the supplied arguments
>> * Return exactly the gateway's return value(s) to the consumer.
>>
>
> I suppose it is close to implementing an interface in terms of the code
> that is required to successfully run an application using a service layer.
> If -  you're using the service layer at it's simplest - proxying the DAO /
> gateway.
> And for the most part - that is 99.99% of what I have used a service layer
> for.
>
> So, since the function Name is the same,
> The arguments are named the same,
> The arguments are the same in number
> The arguments are the same in type...
>
> In fact I (previously) wrote the DAO by;
> Copy/pasting the the function from the serviceCFC
> Add the required SQL
> Alter as necessary the cfreturn code.
>
> So apart from the "guts" of the DAO method - the service CFC version was /
> is a duplication of code found in the DAO version.
>
> The intent  / the purpose of the two, is clearly different.... but it IS
> technically a duplication of code.
> diff myServiceCFC, myDaoCFC even agrees with me.
>
>
> Gavin
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to cfaussie@googlegroups.com.
To unsubscribe from this group, send email to 
cfaussie+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en.

Reply via email to