I discovered that my database needed to be redesigned and now it
requires two different methods anyways (getProductsByCat and
getProductsByFormat).
It's always fun being the server administrator, db designer and
administrator, web designer and developer, etc. etc. I often feel like
a jack of all
Subject: Re: [CFCDev] Question About Invoking/Creating CFC Objects
Thanks Matt and Peter for that extra info. It is always great to find out
what other programmers are doing in their CFCs.
Peter, when using argument collection, does it pass named-value pairs to the
method?
-Aaron
On 6/23/06
PROTECTED] On Behalf
Of Aaron Roberson
Sent: Monday, June 26, 2006 12:07 PM
To: CFCDev@cfczone.org
Subject: Re: [CFCDev] Question About Invoking/Creating CFC Objects
I discovered that my database needed to be redesigned and now it requires
two different methods anyways (getProductsByCat
I always cringe when I see By or From in a method name.
For me, it looks like it could be a duplication of code.
If you have some getProducts logic, you want to be careful not to
duplicate that logic in multiple methods.
If your getProductsByCat and getProductsByFormat methods are both
PROTECTED] On Behalf
Of Peter Bell
Sent: Monday, June 26, 2006 12:12 PM
To: CFCDev@cfczone.org
Subject: RE: [CFCDev] Question About Invoking/Creating CFC Objects
Hi Aaron,
You pass in a struct and it matches the names of the keys within the struct
to the names of the arguments to the method. So
-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Peter Bell
Sent: Monday, June 26, 2006 12:12 PM
To: CFCDev@cfczone.org
Subject: RE: [CFCDev] Question About Invoking/Creating CFC Objects
Hi Aaron,
You pass in a struct and it matches the names of the keys within the struct
Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Steve Bryant
Sent: Monday, June 26, 2006 1:02 PM
To: CFCDev@cfczone.org
Subject: Re: [CFCDev] Question About Invoking/Creating CFC Objects
I always cringe when I see By or From in a method name.
For me, it looks like
I'm pretty sure you can do this:
cfset getProductsAndItems =
productItemGateway.getProductAndItems(arg1=#url.formatID#,
arg2=#url.catID#) /
...where arg1 and arg2 are whatever the cfargument name=arg1 value
is.
Does that make sense? My syntax might be slightly off, but it's
something pretty
Is it possible to specify which argument you are passing into
a method when creating an object? When I use the following
syntax, the method assigns the first parameter to the first
argument, the second parameter to the second argument and so on:
cfset productItemGateway =
Yeah, that makes sense. Let me give it a try and get back to you to
see if the syntax is correct.
In the meantime, I am wondering if this is even a good idea. It seems
to me like it kind of violates the principles of encapsulation and
data hiding. What do you think?
-Aaron
On 6/23/06, Nolan
In the meantime, I am wondering if this is even a good idea.
It seems to me like it kind of violates the principles of
encapsulation and data hiding. What do you think?
There's nothing wrong with using named notation. To call a function, you
need to know something about the data it expects
You can specify name-value pairs (named notation) in any order; the
default notation where you specify the values in order is called positional
notation.
Dave, could you give me an example of the syntax for name-value pairs?
Thanks,
Aaron
Nolan,
your syntax worked just fine. I am wondering if there is some other
way that Dave might be getting at. Also, I am still wondering if I
should even take this approach since one would have to know the exact
spelling of the arguments in the method.
-Aaron
On 6/23/06, Aaron Roberson [EMAIL
Financial Credit Union
(916) 569-5409 Office
(916) 569-2024 Fax
www.schools.org
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Aaron Roberson
Sent: Friday, June 23, 2006 1:25 PM
To: CFCDev@cfczone.org
Subject: Re: [CFCDev] Question About Invoking/Creating CFC
Example of name/value pairs:
Say you have a method like this:
cffunction name=getFoo
cfargument name=age
cfargument name=gender
.
/cffunction
Using name/value method calling you can do this:
cfset bar = getFoo(age=26, gender=M)
-OR-
cfset bar = getFoo(gender=M,
Dave, could you give me an example of the syntax for name-value pairs?
Nolan's example is what I meant.
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
Fig Leaf Software provides the highest caliber vendor-authorized
instruction at our training centers in Washington DC, Atlanta,
In my gateway I have a method which accepts two arguments. The query
selects products by category (if catID NEQ 0) or by format (if
formatID NEQ 0). I originally had two methods, but I thought that with
a little conditional logic I could make one method. My thinking was
better code reuse, but
(916) 569-5409 Office
(916) 569-2024 Fax
www.schools.org
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Aaron Roberson
Sent: Friday, June 23, 2006 1:32 PM
To: CFCDev@cfczone.org
Subject: Re: [CFCDev] Question About Invoking/Creating CFC Objects
Thanks
Thanks a lot everyone!
A week ago I was tearing my hair out trying to figure all this OOP and
CFC stuff out but I decided to just seperate my model into beans, DAOs
and gateways (leaving off services and facades for now) and I'm
finally writing some code again and it seems to be coming together.
Hi all,is it correct Aaron's component invocation?cfset productItemGateway = createObject(component,productItemGateway).init(Application.dsn)cfset getProductsAndItems =
productItemGateway.getProductAndItems(url.formatID,url.catID) /Looks like every time CF will instantiate that cfc right? Marco
to
break your code accidentally when refactoring your db schema.
Best Wishes,
Peter
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Aaron Roberson
Sent: Friday, June 23, 2006 4:37 PM
To: CFCDev@cfczone.org
Subject: Re: [CFCDev] Question About Invoking
Don't forget argumentcollection as an alternative.cfset args = structNew() /cfset args.myVariable = some value /cfset args.myOtherVariable = another value /
cfset myObject = createObject('component','myObject').init(myDSN) /cfset qry_Products = myObject.getProducts(argumentCollection=args) /This
Hey Peter, several of my cases have 4-5 search fields available to the user (Customer ID #, First name, last name, company name, city, ...). So I find the Uber Search function easier to use because in it I can test for values in each of these fields and include an AND FirstName LIKE
Title: Message
It is
also a great solution for dynamic code where you want to call different methods
with different parameters using a single line of code. For instance, imagine you
want to run unit testing on your entire model. Load all of the testing into a
database with the methods,
Title: Message
Hi
Matt,
You're
right. Filtering is a great use case for a generic method.
I considered mentioning that case (I like how
you don't let me get away with being TOO sloppy in my postings!). I also have a
special get%EntityName%ListBySearch() method (e.g.
25 matches
Mail list logo