Re: [CFCDEV] Rails-Style Migrations (for fun and profit?)
Hi Eric, I actually didn't implement all that much in cfrails - simple up and down for tables only, and you are right - it only works in MS SQL Server (mainly due to the column type name differences for autonumber fields). Other than that, I think I've left the column type up to the developer to avoid having to abstract that out myself (although this will eventually change). Another glaring hole is that the included runner doesn't respect version numbers, so you cannot go up and down to specific instances in time (without writing your own script). I also plan to change that behavior. That said, migrations are low on the list of things I need to do for cfrails. In any case, I do see value in it. I'm trying to move away from tags, so I probably wouldn't use this version, but I'm sure some people prefer tags! Sam Eric O'Connell wrote, On 7/13/2007 10:28 AM: Hi folks, I started to get anxious about keeping my developer and production database schemas in sync, so I decided to implement a rails-style migration functionality. I'd already implemented about 90% of it when I came across cf_rails, but I thought I'd show it off anyway. Like cf_rails, it is currently mssql-only, but a connection adaptor layer could be added fairly easily. Anyway, here's what the migration syntax looks like: cf_create_table tableName=foo force=true cf_column name=bar type=varchar cf_column name=baaz type=integer /cf_create_table cf_add_column tableName=foo name=quux type=datetime cf_remove_column tableName=foo name=baaz cf_drop_table tableName=foo And here is an actual migration script: cfcomponent extends=com.iba.migration.instance output=yes cffunction name=up returnType=void output=no access=remote cf_add_column tableName=cart name=discountCode type=varchar(30) /cffunction cffunction name=down returnType=void output=no access=remote cf_remove_column tableName=cart name=discountCode /cffunction /cfcomponent If anyone is interested in it, I could clean it up and release it. If not, oh well :) Eric O'Connell IBA Webmaster - 941-921-7443 x15 [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] www.bodytalksystem.com You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] More on class objects aka single class Service objects
I've been following this discussion pretty intently, but haven't had much to add, since Sean covers it so well. One thing is below, however, that I don't recall was mentioned or not. Jaime Metcher wrote, On 7/5/2007 5:32 PM: My fixed mental model is everything is an object. I can write (and have done so) object oriented code in Pascal, CF 4.0, perl and (yes, Tom), macro assembler. Where the language features aren't there to help out, they can be simulated or worked around - but this is harder, more error prone and usually slower than when they are. It also means that I have to remember how the workarounds work - the mental model is more complex and less consistent. So, in CF: 1. Classes aren't objects. This can be worked around by creating a separate CFC, an instance of which will act as the class object. In CF it seems to be common practice to put whole-of-class methods and data into service, manager and gateway objects which therefore act in combination as a class object. Service objects I've seen often provide whole-of-class methods for more than one class, as well as logic spanning classes. I don't think static methods (or class methods) are especially object oriented. Certainly they /can/ be acceptable in your code, but they are more procedural in nature. Someone correct me if I'm wrong. Sam You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] More on class objects aka single class Service objects
Sean Corfield wrote, On 7/5/2007 10:58 AM: This comes back to my (frequent) comment that there is no one true way to do OO. Excepting of course, my way. =) You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Questions migrating to OO
Casey Dougall wrote: On 7/2/07, *Nando* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: cfcomponent displayName=List hint=I'm a List that belongs to a certain User output=false cffunction name=init access=public output=false cfargument name=ListID type=string required=false default= / cfargument name=UserID type=string required=false default= / cfargument name=ListName type=string required=false default= / cfset setListID(arguments.ListID) / cfset setUserID(arguments.UserID) / cfset setListName(arguments.ListName) / cfreturn this / /cffunction I'm not a OO guy myself but found it interesting as anything at cfunited. My question about the above deals about changing the order of arguments. I haven't see anything that really deals with this and I would think this is one of the biggest challenges with anything using components and at some point adding on to an application from somewhere in the middle. Using the example above, a few months down the line you need to access this list not by ListID, but by ListCategoryID. Now where this may be the last argument used, is this the best way to go about designing cffunctions? I'd like to put ListCategoryID first without messing up my scripts that depend on ListID being first. What's the best way to handle this? As you mention, there really is no way to handle it. Either put it last and make it not required, create a new function, or start naming your arguments everywhere. Of course, you could also just bite the bullet and go change all that other code as well. Most people choose a different option, however. There may be other ways, but those are the 4 that stick out at the moment. Finally, there are refactoring tools in other languages that might be able to help you in those languages, but not CF. Also, method overloading is available in many statically typed languages. Sam You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Need to qualify function with scope?
Jim Cassata wrote, On 6/12/2007 8:10 PM: definitely OT but how exactly does one prepare to eat his own foot? Is it eaten directly off the bottom of the leg or is there some other method involved? Jim I was prepared mentally only. I think if I was preparing it physically, I'd have to cut it off and cook it, probably using salt and pepper as well. I don't like it raw, so I would likely not have eaten it directly from the bottom of the leg. HTH, =) Sam --- Sammy Larbi [EMAIL PROTECTED] wrote: Sean Corfield wrote, On 6/12/2007 2:34 PM: On 6/11/07, Sammy Larbi [EMAIL PROTECTED] wrote: I don't generally bother scoping them - I don't see a point or any usefulness in immediately knowing whether a function is public or private when I'm using it within its own CFC. Note that you cannot call a private function using this.someFunc()... Of course not! =) But, I think you can use variables.someFunc(), though I didn't test it before writing this, so I'm fully prepared to eat my foot. Sam You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] OT: Quick AJAX Poll
Most of our stuff was home-spun (before the term came about and before there was a different framework for it on every corner) and remains so today, simply because there's not much value in switching. For most of the newer stuff I've used Scriptaculous/Prototype, but I've been slowing getting into Spry for CF development, simply because I figured eventually that would be integrated into CF. I guess we'll see. For Rails development, I've used Scriptaculous/Prototype since that's integrated into the framework and there are helper methods that use it. Sam Brent Nicholas wrote, On 6/12/2007 12:07 PM: Hey all - So I'm wonder how many people are using AJAX in this group and what you're using. I'm using dojo right now and have done a few simple things with it on the site, but am looking at doing a full application with AJAX. Has anyone used Prototype? I've been told it's #1, but I hear the same about dojo. Right now I'm finding dojo a little cryptic, despite the few 'starter guides'. I'm initially looking for reasonable learning curve and loose coupling. Thanks for your time, Brent Nicholas - 248.767.5516 - [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] There, I guess King George will be able to read _that_! - John Hancock You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Need to qualify function with scope?
Sean Corfield wrote, On 6/12/2007 2:34 PM: On 6/11/07, Sammy Larbi [EMAIL PROTECTED] wrote: I don't generally bother scoping them - I don't see a point or any usefulness in immediately knowing whether a function is public or private when I'm using it within its own CFC. Note that you cannot call a private function using this.someFunc()... Of course not! =) But, I think you can use variables.someFunc(), though I didn't test it before writing this, so I'm fully prepared to eat my foot. Sam You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Application.cfc: where to set DSN
Tom Chiverton wrote, On 6/8/2007 8:50 AM: On Friday 08 Jun 2007, Joe Lakey wrote: To use a Config CFC, would I hard-code the settings variables in the Config CFC file, instantiate it in application scope in onApplicationStart(), then call application.config.getDSN() (for example)? Yeah. What would be the benefit of this approach over including a settings file in onApplicationStart() and/or onRequest()? Including a file has overhead (reading the file from disk), where as accessing an application var. is just reading memory. You might want to benchmark it though, to see if it really makes much of a difference (after all, if it's included often, it'll be in the disk cache). Or compiled with the other template, or of course you can check to see if the parameters have been defined, and only include it if not. I wouldn't suspect this to be an issue at all, but I've been known to be wrong on occasion. =) Sam You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Application.cfc: where to set DSN
Brian Kotek wrote, On 6/8/2007 2:18 PM: Philip, questions are good. However, these questions don't really have any bearing on why you would use ColdSpring. It makes no difference what my database tables look like, what methods the CFCs have, what the datasource looks like, what mapping you use for your component paths, or what the index.cfm or maintenance screens look like. But, it would be good to know/understand why you have so many classes (for what seems like it should just be a simple Product class), what they are doing, and why you have designed them that way. It would be off topic to the expressed subject, but it would be good. =) Sam What ColdSpring does is create CFCs for you and manage their relationships so you don't have to (it also does a lot more such as AOP and remote facade generation but those are separate topics). It's completely generic. It will work with any CFCs, whether you are using a database or not, and regardless of what the CFCs actually do or how you display the data they provide. However, if code would help, have a look at the code from my presentation at the Frameworks conference earlier this year: http://www.briankotek.com/blog/files/framework_agnostic_models_presentation_code.zip Hope that helps, Brian On 6/8/07, *Phillip Senn* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Thanks Brian for your posts. In your blog, you use this as an example: beans bean id=productService class=components.ProductService constructor-arg name=productFactory ref bean=productFactory / /constructor-arg constructor-arg name=productDAO ref bean=productDAO / /constructor-arg constructor-arg name=productGateway ref bean=productGateway / /constructor-arg /bean bean id=productDAO class=components.ProductDAO constructor-arg name=config ref bean=config / /constructor-arg /bean bean id=productGateway class=components.ProductGateway constructor-arg name=config ref bean=config / /constructor-arg /bean bean id=config class=components.config constructor-arg name=configFile value/config/configFile.xml/value /constructor-arg /bean bean id=productFactory class=components.ProductFactory / /beans 1. What does the Product table look like? 2. What does ProductService.cfc look like? 3. What does ProductFactory.cfc look like? 4. What does ProductDAO.cfc look like? 5. What does ProductGateway.cfc look like? 6. What does Config.cfc look like? 7. What does Application.cfc look like? 8. What does your ColdFusion datasource look like in the cfide administrator? 9. What does your mapping look like if you refer to myapp.components.? 10. What does your Index.cfm page look like? 11. What does your maintenance screen look like? 12. What does your Report screen look like? 13. What does your Inquiry screen look like? When I use the phrase look like, what I'm trying to convey to you is: What is the exact source code for this /thing/ which I'm describing, whether it be a sql script, a ColdFusion component, a cfm page that outputs plain old HTML with javascript and cascading style sheets, or a cfm page that outputs a flex application. I'm trying to show you that I'm not trying to be obnoxious, but rather that I have lots of questions. You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Config Bean vs. Struct vs. ????
Jeff Chastain wrote, On 6/7/2007 4:06 PM: Is there any reasoning / logic behind having your configuration information stored in a bean vs. some other method? I have seen some applications design using a collection of configuration beans and other applications designed using an xml file that is just read and parsed into a ‘config’ structure. If your configuration information is not really changing (maybe this is a bad assumption), is there any reason for having the extra overhead of the beans and their instantiation instead of just a static structure of key = value pairs? There may be encapsulation issues, for example if you don't want your components that use the configuration to be too tightly coupled to the /implementation/ of that configuration. Now, you can avoid this yourself (though experience has shown it is hard to do), but having it as a bean means you can change any any of the implementation details and be fairly sure its not going to break any code that relies on it (since the implementation details, presumably, were hidden). Sam Thanks -- Jeff *From:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] *On Behalf Of *Peter Bell *Sent:* Thursday, June 07, 2007 3:44 PM *To:* cfcdev@cfczone.org *Subject:* Re: [CFCDEV] Application.cfc: where to set DSN +1. Only thing I put into application.cfc (in terms of a config property) is application.name which I need to include the framework that calls the application specific config bean that contains all of the other app specific config info. Encapsulating it in a config bean gives you a bunch more flexibility to change how it is created or stored without breaking the API you expose to the rest of your app. Best Wishes, Peter You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Need to qualify function with scope?
Joe Lakey wrote, On 6/11/2007 12:37 PM: If a function within a CFC calls another function within the same CFC, is it necessary to qualify the function call with this or variables? What if there is a known possibility of a name collision with a function outside of the CFC? As Brian mentioned, there isn't really a possibility of collision. You may have the same name, but you will need to prefix that call with the name of the object it's contained in. I don't generally bother scoping them - I don't see a point or any usefulness in immediately knowing whether a function is public or private when I'm using it within its own CFC. You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Application.cfc: where to set DSN
Hi Joe, In my view, a DSN is a variable that properly belongs to an application. Therefore, I'd go with putting it in onApplicationStart, since by the very nature of its name, implies that you are setting variables belonging to the application. Others may view it differently, however. Sam Joe Lakey wrote, On 6/7/2007 11:03 AM: Another newbie question to provide a little light diversion from interfaces and method overloading... My application uses only one DSN, and I'd like to set it in one place. I'm cfincluding two files in onRequest(): server_config.cfm, which sets server/environment variables, and app_config.cfm, which sets application-specific variables; both set variables in Request scope. It would seem that one of these includes would be the place to set the DSN, i.e., cfset Request.DSN = myDSN. However, in onApplicationStart() and onSessionStart() I'm instantiating components that take the DSN as an argument to their init() methods. If I understand the sequence that Application.cfc methods are executed, onApplicationStart() and onSessionStart() won't have access to variables set in onRequest(). So if I want to set the DSN in only one place, where is the best place to do it? It's probably obvious (and there's probably a better way to architect the whole app to avoid this, but...), but I'm still getting my mind around this OO stuff. Thanks, Joe You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] viruses?
It didn't really bother me - I was just worried because it seemed like I was getting hundreds of them (but, as others pointed out, it was just the one) so I figured Avast was just acting stupid and I had to reboot. Everything was good then. (Thanks to everyone who responded as well) Rob Brooks-Bilson wrote: Just a quick note. We do run a virus scanner on the listserv, and for the most part, it does a decent job. I do apologize, however for the occasional one that gets by. -Rob Sent by: [EMAIL PROTECTED] *Sammy Larbi [EMAIL PROTECTED]* *05/24/2007 07:36 AM* Please respond to cfcdev To: cfcdev@cfczone.org cc: bcc: Subject: [CFCDEV] viruses? Hey guys, It seems I got hit pretty hard with a virus from cfcdev this morning. Its not done anything bad (that I can tell) except Avast keeps coming up saying there was a virus found and blah blah blah. Can't seem to get rid of the message - dunno if its because it came in 100s of times or if something is seriously wrong. In any case, I just wanted to ask if anyone else got hit from the list or if I am way off base? Thanks, Sam You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] here we go again...
Eric Knipp wrote: If you can successfully outsource programming, you can successfully outsource project management, as well. I know Shell is doing that. You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Is there a point to staying here?
Tom Chiverton wrote, On 5/22/2007 10:36 AM: On Tuesday 22 May 2007, Barry Beattie wrote: a powerful introspective IDE, sure I'm going to keep buying Mark JD until he's done writing that feature in CFEclipse :-) Mark, I hate to do this to you, but... Tom, that doesn't give him much incentive to finish it, does it? =) -Sam You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] baseComponent.cfc
That's One True Language, surely =). Peter Bell wrote, On 5/4/2007 2:30 PM: Actually, it was a crazed Ruby programmer who wrested control of my keyboard from me - apologies. You know I'd never say something like that about the one true language (after ColdFusion) :- On 5/4/07 3:18 PM, Aaron Roberson [EMAIL PROTECTED] wrote: Personally I'd leave that to the enterprise Java guys. They've got enough clutter anyway with all the hacks to handle static typing and those big ole XML config files *winks-and-then-runs-for-cover*:- You better run fast and hard :)~ -Aaron You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Oh how I wish we had method overloading!
Andrew Scott wrote, On 5/4/2007 7:42 PM: There would be no need for any any exists, becaue we can't have 2 methods with different arguments. I think of it the other way around. We can't have 2 methods with different arguments /because/ any exists. Any exists because we're using a dynamically typed language. I kind of like that =). On 5/5/07, *Sammy Larbi* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Andrew Scott wrote, On 5/4/2007 11:32 AM: *lol* The same way the underlying technology does it But how can you do that when you can pass any type into a method? On 5/4/07, *Sammy Larbi* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Sorry for the confusion Arron, I meant that question to be more like how would you implement /actual/ method overloading in CF itself. =) Aaron DC wrote, On 5/4/2007 8:14 AM: I would implement it exactly the same way I did in the code I emailed to the list 1-2 hours ago. With the function I defined, you can call save() like so: save(somestruct) save(somestruct, arg1) save(somestruct, arg1, arg2) save(someobject) save(someobject, arg1) save(someobject, arg1, arg2) If you want to make the arguments required, test for their existence and generate an error. Aaron Sammy Larbi wrote: Aaron DC wrote, On 5/4/2007 7:26 AM: If you can simulate it (as in the example I just showed), does it really matter if it makes it into CF8? Aaron Andrew Scott wrote: +1... I agree, it would so good if we could create methods with different arguments. I have flagged this as a wish, so I doubt it will make CF8... But who knows... And how would you implement it? I see three choices: 1) require named arguments, and distinguish on the name 2) require typed arguments, and distinguish on the type 3) keep the option of naming/typing arguments, and only require it if attempting to overload a method (throwing an error if, when using the method, someone forgets to name arguments, if that is chosen. Don't forget, we also have optional arguments, so you can use that for overloading too... -Sam You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com http://www.katapultmedia.com http://www.katapultmedia.com http://www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org http://www.mail-archive.com/cfcdev@cfczone.org http://www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com http://www.katapultmedia.com http://www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org http://www.mail-archive.com/cfcdev@cfczone.org http://www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com http://www.katapultmedia.com http://www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org http://www.mail-archive.com/cfcdev@cfczone.org http://www.mail-archive.com/cfcdev@cfczone.org -- Senior Coldfusion Developer Aegeon Pty. Ltd. www.aegeon.com.au http://www.aegeon.com.au http://www.aegeon.com.au Phone: +613 8676 4223 Mobile: 0404 998 273 You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev
Re: [CFCDEV] baseComponent.cfc
I haven't taken a look, but my guess would be that it doesn't. In order to use getProperty() rather than get(property) (I'm assuming this is generated dynamically), you would have to write the methods to a file and include it in the class, since there is no way to generate methods dynamically in CF. It's not hard to do by any means, but then you'll want to think about how do I cache it and reuse it until its changed, so I can limit the # of disk accesses? (assuming that becomes a problem) and such. I'm still hoping for that functionality /sometime/ =) Sam Aaron Roberson wrote, On 5/3/2007 8:03 PM: Hey guys, I just read Jeffry Houser's Data Gateway article in CFDJ and went and downloaded Hal Helm's baseComponent. What I have been looking for is a way to create a baseObject bean so that I can have generic getters and setters. The caveat is that I would like to be able to access those bean properties in my views as getProperty() instead of get(property). Does the get and set methods within Hal's baseComponent.cfc support such am implementation? From a quick look at the code it appears it does, although it may just be checking for the existence of a specific accessor or mutator in the child object. Anyone know for sure? Is my requirement even possible to be met? Thanks, Aaron You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Oh how I wish we had method overloading!
Aaron DC wrote, On 5/4/2007 7:26 AM: If you can simulate it (as in the example I just showed), does it really matter if it makes it into CF8? Aaron Andrew Scott wrote: +1... I agree, it would so good if we could create methods with different arguments. I have flagged this as a wish, so I doubt it will make CF8... But who knows... And how would you implement it? I see three choices: 1) require named arguments, and distinguish on the name 2) require typed arguments, and distinguish on the type 3) keep the option of naming/typing arguments, and only require it if attempting to overload a method (throwing an error if, when using the method, someone forgets to name arguments, if that is chosen. Don't forget, we also have optional arguments, so you can use that for overloading too... -Sam You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Oh how I wish we had method overloading!
Sorry for the confusion Arron, I meant that question to be more like how would you implement /actual/ method overloading in CF itself. =) Aaron DC wrote, On 5/4/2007 8:14 AM: I would implement it exactly the same way I did in the code I emailed to the list 1-2 hours ago. With the function I defined, you can call save() like so: save(somestruct) save(somestruct, arg1) save(somestruct, arg1, arg2) save(someobject) save(someobject, arg1) save(someobject, arg1, arg2) If you want to make the arguments required, test for their existence and generate an error. Aaron Sammy Larbi wrote: Aaron DC wrote, On 5/4/2007 7:26 AM: If you can simulate it (as in the example I just showed), does it really matter if it makes it into CF8? Aaron Andrew Scott wrote: +1... I agree, it would so good if we could create methods with different arguments. I have flagged this as a wish, so I doubt it will make CF8... But who knows... And how would you implement it? I see three choices: 1) require named arguments, and distinguish on the name 2) require typed arguments, and distinguish on the type 3) keep the option of naming/typing arguments, and only require it if attempting to overload a method (throwing an error if, when using the method, someone forgets to name arguments, if that is chosen. Don't forget, we also have optional arguments, so you can use that for overloading too... -Sam You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Oh how I wish we had method overloading!
And apologies for misspelling your name =) Sammy Larbi wrote, On 5/4/2007 8:46 AM: Sorry for the confusion Arron, I meant that question to be more like how would you implement /actual/ method overloading in CF itself. =) Aaron DC wrote, On 5/4/2007 8:14 AM: I would implement it exactly the same way I did in the code I emailed to the list 1-2 hours ago. With the function I defined, you can call save() like so: save(somestruct) save(somestruct, arg1) save(somestruct, arg1, arg2) save(someobject) save(someobject, arg1) save(someobject, arg1, arg2) If you want to make the arguments required, test for their existence and generate an error. Aaron Sammy Larbi wrote: Aaron DC wrote, On 5/4/2007 7:26 AM: If you can simulate it (as in the example I just showed), does it really matter if it makes it into CF8? Aaron Andrew Scott wrote: +1... I agree, it would so good if we could create methods with different arguments. I have flagged this as a wish, so I doubt it will make CF8... But who knows... And how would you implement it? I see three choices: 1) require named arguments, and distinguish on the name 2) require typed arguments, and distinguish on the type 3) keep the option of naming/typing arguments, and only require it if attempting to overload a method (throwing an error if, when using the method, someone forgets to name arguments, if that is chosen. Don't forget, we also have optional arguments, so you can use that for overloading too... -Sam You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] baseComponent.cfc
Well, like I said, it /is/ possible, but I was thinking it would be unlikely he'd have done it that way. I mean, of course you can wrap it in a specific one as well (that you write in the derivative class), but I was doubting he'd have gone through the trouble of writing it to a file and including it in the base class. I should probably stop speaking as if I'm representing him though... =) Aaron Roberson wrote, On 5/4/2007 9:34 AM: Sammy, I didn't think it was possible to use getProperty() on a generic getter but as I was searching Google and the various mailing lists I came across a conversation between Hal and Sean Corfield. In it, it sounded as though Hal was explaining to Sean that his generic gets and sets could be accessed that way, but I couldn't view the entire conversation (for lack of navigation skills through mailing list archives) so I wasn't sure. -Aaron On 5/4/07, Sammy Larbi [EMAIL PROTECTED] wrote: I haven't taken a look, but my guess would be that it doesn't. In order to use getProperty() rather than get(property) (I'm assuming this is generated dynamically), you would have to write the methods to a file and include it in the class, since there is no way to generate methods dynamically in CF. It's not hard to do by any means, but then you'll want to think about how do I cache it and reuse it until its changed, so I can limit the # of disk accesses? (assuming that becomes a problem) and such. I'm still hoping for that functionality /sometime/ =) Sam You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Is there a point to staying here?
Brent Nicholas wrote, On 4/30/2007 5:26 PM: Mike - I see plenty of good talks about CFC OO and various other topics. Lot's to learn. You should check the web page that allows you to browse the postings and see if you are actually getting all of them. Otherwise maybe your spam filter is only letting spam through and filtering the conversations. That's what I was thinking, since he replied to an email from November... From: [EMAIL PROTECTED] To: cfcdev@cfczone.org Subject: [CFCDEV] Is there a point to staying here? Date: Tue, 1 May 2007 08:11:18 +1000 Is there any point to staying on this list? For a month I've had nothing but spam. Is there any legitimate traffic on this list at all any more? Or am I the last one left with the spammers? Or should I turn out the lights as I leave? Cheers Mike Kear Windsor, NSW, Australia 0422 985 585 Adobe Certified Advanced ColdFusion Developer AFP Webworks Pty Ltd http://afpwebworks.com Full Scale ColdFusion hosting from A$15/month -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Raymond Camden Sent: Wednesday, 22 November 2006 1:40 AM To: cfcdev@cfczone.org Subject: [CFCDEV] [ADMIN] Testing if back up Just testing. Please reply if you get this. (And if you see other folks reply, don't bother. :) -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.467 / Virus Database: 269.6.2/781 - Release Date: 30/04/2007 9:14 AM You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] An example of a NotificationService
Sean Corfield wrote, On 4/22/2007 1:12 PM: On 4/21/07, Marc [EMAIL PROTECTED] wrote: The example shows just variables.notificationService.send(.), but I'm having trouble figuring out how the exact call and the actual implementation would look. What goes inside send()? If the message content itself goes in there, doesn't that get messy? Should all the attributes of a CFMAIL tag be accounted for, and if so, how? There is of course no one true answer here but there are lots of reasonable degrees... A simple send() method might take from=, to=, subject=, body= and, yes, pass in a string containing the message both. I'm using this approach right now for a site I'm working on. Yes, constructing the body in the calling code and passing it in is a little messy. See below. At least there's cfsavecontent to make it less messy. Can you imagine trying to do something like that in Java? =) You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Soft Coding (Article on WTF)
Patrick McElhaney wrote, On 4/12/2007 9:44 AM: WTF has a great article on Soft Coding. We all know that Hard Coding is bad, and we try to put information that's likely to change in configuration files. But as this article explains, our assault on Hard Coding can go too far, and we end up with something even worse: Soft Coding. I'm sure the short (2.5 page) article will be making the rounds on social networking sites soon. Since ColdFusion developers seem to be particularly susceptible to Soft Coding, I thought I would post it here. http://worsethanfailure.com/Articles/Soft_Coding.aspx +1 I read it earlier this morning and it's worth the read. I thought about putting it up here too, but looks like you beat me to it =) You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]
Re: [CFCDEV] Soft Coding (Article on WTF)
Tom Chiverton wrote, On 4/12/2007 10:23 AM: On Thursday 12 Apr 2007, Patrick McElhaney wrote: http://worsethanfailure.com/ Still prefer the old name :-) I know, me too! You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]
Re: [CFCDEV] table driven file system
I've used the path solution before... in fact, I don't immediately see a reason not to in this situation. Aaron DC wrote, On 4/12/2007 4:10 PM: Hi Janet Ok, you just pwnt my knowledge on folder / file storage :-) Adjacency wha? Kind of reminds me of the phone interview I had when someone asked for a definition of referential integrity... 3rd year Uni database theory learnt over a decade prior to the phone conversation was difficult to recall at that instant but I digress. I have to store folders and files in a database design for an application I am developing. I created an initial folder table similar to yours. The right way. Then worked out what I wanted to be able to do with the data stored in that table, from within the application. omg. I have to what? NB: this was not using SQL Server. I'm only hinting that when I was starting out with this problem, the solution looked like far too much work :-) Being the decidedly lazy developer that I am, I totally denormalised (to the nth degree) the design, giving me: Folder: --- FolderID FolderPath File: - FileID FolderID FileName My design is not used directly for display purposes, I do not have to build a tree with it, but I imagine it would not be that difficult if I had to. I probably will in time. MS Windows can be funny: when drawing a tree, it displays a [+] next to a directory whether that directory contains something or not. It's not until you click / dbl-click it that the display updates - removing the [+] if there are no subdirectories in there. I figure if Windows can do it, so can I. A LIKE and a '%' would probably suffice. The most common actions I have to perform (to date) are: does this file some path \ some file exist in the database? list all the files in some path folder? I have also totally ignored the possibility (for now) of a tree change (pun intended) but figure a well placed '%' in an UPDATE LIKE statement should work. The fact that others have developed solutions to the problem does not surprise me, and using someone else's working code is always a great option. My solution feels amateurish by comparison, but it's satisfying my Rule 1 (does it work?), and is darn simple to implement. Hope it provides food for thought. It would be interesting to put together a quick list of functions: add file (to folder) rename file (within folder) delete file move file add folder rename folder move folder delete folder draw tree list files in folder does file exist in folder and see the code / SQL associated with each one from the adjacency model or any other wacky models people may come up with. HTH Aaron J MacKay wrote: Aaron http://support.microsoft.com/kb/248915 It sounds like you're hinting that the adjacency model is not the way to go? I should have specified that I'm not building this from scratch. I'm working with pre-existing structures and code (pre-MX and cfcs). So any changes must coexist with the existing structure (adjacency model) for now. I'm not arguing the merits of one method over the other. I agree there are different advantages to each approach. I think the original designers went with the adjacency model because they expected a lot of structural changes which can be a more expensive operation when using nested sets. But as you hinted, querying a hierarchy is usually easier with nested sets :) Truthfully I'm not always a fan of the adjacency model. But thats what I've got to work with right now. If you have any thoughts about converting it to something more managable or performant without drastically disturbing the existing structure I'm all ears. Janet -- Don't be flakey. Get Yahoo! Mail for Mobile http://us.rd.yahoo.com/evt=43909/*http://mobile.yahoo.com/mail and always stay connected http://us.rd.yahoo.com/evt=43909/*http://mobile.yahoo.com/mail to friends. You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED] You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED] You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]
Re: [CFCDEV] Class methods part I - what's a static method?
Sean Corfield wrote, On 4/10/2007 6:00 PM: Any layer of abstraction in pretty much *every* language adds performance overhead. For example, virtual methods have a perfomance overhead compared to non-virtual methods in general. So polymorphism causes a performance overhead. Encapsulation also causes a performance overhead because you need to call methods to access data instead of just accessing data directly. I seem to remember a time when people talked about having fewer ... (was the term at the time functions, procedures, subroutines?) just because of the performance hit. (and I think I should be too young to remember that! =)) You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Class methods part I - what's a static method?
Phillip Senn wrote, On 4/6/2007 8:24 AM: I'm going to talk about the elephant in the middle of this conversation. With computers, speed is everything. Speed of execution rather than development, I gather is what you mean from the rest of your comments? Are there any time studies between dynamic languages and static ones? If the speed of ColdFusion is about the same as java, then we can talk about the subtle differences between the languages. I think the general consensus is that dynamic languages usually perform slower than their static counterparts. But, I'm not sure if I'm addressing the right question (or if you were asking the right question) since we were talking about static (or class) methods as opposed to object methods. In any case, I thought you brought up some interesting points so I wanted to respond =). But if they're miles apart, then we're talking miles vs. kilometers (to keep with the same metaphor). I'd like to see an average elapsed time for cfloop from=1 to=100 Index=I /cfloop And FOR I=1 TO 100 NEXT I Back in December Vince Bonfanti explained that benchmarks like this aren't very helpful (http://blog.newatlanta.com/index.cfm?mode=entryentry=97A790C6-13C3-71E3-27BA15D212DA96A1) and why. I can't vouch for the accuracy of his statements, since I don't know much about benchmarking, but they made sense to me. And even if they did reliably show which language was faster (which almost certainly will not be CF on that list), I may very well still say so what? or who cares? I don't need it to run as fast as the electrons travel through the processor, memory, and motherboard. I just need it to run fast enough to give my users a good experience. Otherwise, I might try programming in a lower level language, if that were my goal. You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Class methods part I - what's a static method?
Jaime Metcher wrote, On 4/4/2007 4:30 PM: The thing that made me think was this statement - Smalltalk doesn't have static methods, neither does Ruby. The implication being that static methods are just another Java thing that doesn't apply to dynamic languages. Am I missing some crucial distinction between static methods and class methods? I don't know Java well enough to be sure, but the Ruby docs actually state that they are equivalent. I don't know Ruby, but can anyone imagine Smalltalk without class methods and variables? As you said, Ruby does indeed have class methods, and they are the same thing as static methods - they are not tied to any particular object. Now, I don't know if there are some subtle differences behind that and the naming conventions... As for Smalltalk, I don't know enough about it to say anything useful. But, I do think static or class methods can provide a useful distinction between their object counterparts. You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Class methods part III - is there problem?
Jaime Metcher wrote, On 4/4/2007 8:37 PM: In ColdFusion, you could have a singleton CFC instance (of type MyThingClass) associated with your regular CFC instances (of type MyThing) and use the Smalltalk-style model. In fact, if MyThingClass was really a factory CFC for MyThing objects, the chances are that you'd be squarely in the Smalltalk-style world here - your class methods and class variables would simply be (non-static) methods and variables on your factory object and you could ask the factory for actual instances of MyThing. Yes, this is what I'm doing. Does anyone think this is weird? Not weird, but it could be overkill. You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] newbie - where to handle component composition
A good place to start is where Peter explained it: http://lightwire.riaforge.org/blog/index.cfm/2006/10/22/Why-LightWire (and probably other posts on that blog as well) J MacKay wrote, On 4/5/2007 11:36 AM: Although I do use ColdSpring myself, there are other DI frameworks: http://rachaelandtom.info/node/1429 Any thoughts or opinions on the differences between Lightwire and ColdSpring? -- Need Mail bonding? Go to the Yahoo! Mail QA http://answers.yahoo.com/dir/index;_ylc=X3oDMTFvbGNhMGE3BF9TAzM5NjU0NTEwOARfcwMzOTY1NDUxMDMEc2VjA21haWxfdGFnbGluZQRzbGsDbWFpbF90YWcx?link=asksid=396546091 for great tips from Yahoo! Answers http://answers.yahoo.com/dir/index;_ylc=X3oDMTFvbGNhMGE3BF9TAzM5NjU0NTEwOARfcwMzOTY1NDUxMDMEc2VjA21haWxfdGFnbGluZQRzbGsDbWFpbF90YWcx?link=asksid=396546091 users. You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Your password has been successfully updated
Tom Chiverton wrote, On 4/3/2007 5:46 AM: On Monday 02 Apr 2007, Nando wrote: I believe it was sent to the whole list by a spammer. I assumed the attachment was a trojan or a virus and trashed the email. Or someone is trying to gain access to all the accounts in the hope of finding one he can use to post here. But... he already posted here... ? ==) You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] newbie: needs an opinion on component structure
Joe Lakey wrote, On 4/2/2007 10:47 AM: I like this explanation of what a controller is and does; it clarifies the controller concept a little for me. I have a couple of follow-up newbie questions: 1. Should the user action (i.e. clicked link or submitted form) go to a controller cfc or to a cfm page that interacts with the controller cfc? I'm not aware that you could have it go directly to a CFC and run anything (it would ask you to log in to view the documentation, unless you've set something up to do it differently)... 2. How should the controller cfc direct the browser to the view layer: cfincluding the view page, redirecting with cflocation, or something else? I like cfincluding, as it allows you to get the state correct before rendering. For example, if the user logs in, and you have already rendered the menu before performing the login action, the menu will not have changed to reflect the new actions available to the user. I suppose you could do something similar with cflocation, and I would do so in cases where it is appropriate: for example, there was an interrupt created somewhere that needs attention and it doesn't make sense to keep them on the same page. But in general, I'd still be using cfinclude to render the page that was arrived at by the cflocation. I hope that made any sense. Others will have their views as well, and good reasons for them. Those are mine, and I offer a money back guarantee if you aren't satisfied =) -Sam You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Help with Component Path/Package
Tom Chiverton wrote, On 3/28/2007 11:00 AM: On Wednesday 28 Mar 2007, J MacKay wrote: Well, I didn't think it was in the components, but in their instantiation (ie, createObject(..)). But yes, I think even the addition of a simple function getComponent(componentName) would help tremendously, if you removed the path info from it. Well, you could write your own, based on a recursive search of the filesystem. The performance hit is gonna be *huge* though. Well, I was thinking that you might just be in a couple of places looking for components... You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Uploading Files and CFCs
Ryan Everhart wrote, On 3/29/2007 6:25 AM: This may be a dumb question, but can you use a cfc to upload files? Do they have access to the form scope when executed? The way my application is being built is sorta like a framework where I have pages called views which display all my data then I have action pages which do stuff like add/remove/update data in the db via CFCs. So my question is, on an action page can I call a component that will be able to upload a picture from a form, or do i have to do the actual upload on the action page itself then do any other actions (rename, move, add file name to db) on the cfc. Thanks! I've been thinking about this all night but haven't tested it out yet. Try it out! CFCs do have access to the form scope, but generally I think people tell you to only depend on a structure, and pass in the form scope instead. I think I have actually tried uploading a file in one, so assuming I'm not making up past experiences (which, on occasion I probably have done), I'm pretty sure it will work. You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Uploading Files and CFCs
Anthony Israel-Davis wrote, On 3/29/2007 11:39 AM: I would suggest a design that has a high amount of reuse (that's one of the reasons for using a CFC!) so instead of passing in the entire form structure and depending on the form names, you may want to consider passing in each attribute individually and returning the cffile variable for additional processing. Here's an example: That's true. You should only use the entire form scope if you intend to you all of it (or, perhaps if you have another really good reason) cffunction name=upload access=public output=false returntype=struct hint=returns the cffile struct cfargument name=fileField type=string required=true hint=This is the name of the form field that contains the file cfargument name=acceptType type=string required=false default= hint=Valid File Types cfargument name=nameConflict type=string required=false default=MakeUnique hint=nameConflict value for cffile ... MORE CODE HERE ... cfreturn cffile !--- OR Whatever you name your return variable --- /cffunction anthony -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sammy Larbi Sent: Thursday, March 29, 2007 9:12 AM To: cfcdev@cfczone.org Subject: Re: [CFCDEV] Uploading Files and CFCs Ryan Everhart wrote, On 3/29/2007 6:25 AM: This may be a dumb question, but can you use a cfc to upload files? Do they have access to the form scope when executed? The way my application is being built is sorta like a framework where I have pages called views which display all my data then I have action pages which do stuff like add/remove/update data in the db via CFCs. So my question is, on an action page can I call a component that will be able to upload a picture from a form, or do i have to do the actual upload on the action page itself then do any other actions (rename, move, add file name to db) on the cfc. Thanks! I've been thinking about this all night but haven't tested it out yet. Try it out! CFCs do have access to the form scope, but generally I think people tell you to only depend on a structure, and pass in the form scope instead. I think I have actually tried uploading a file in one, so assuming I'm not making up past experiences (which, on occasion I probably have done), I'm pretty sure it will work. You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Help with Component Path/Package
Nando wrote, On 3/27/2007 2:28 PM: If your primary motivation is to document your classes ... well, when i understood what was really going on under the hood, it made more sense to me to put that in the hint tag ... but that's me. That's pretty much how I feel about it. You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Help with Component Path/Package
Adding to the possibility of ant scripts and the best being replicating your environment, you might use a mapping to bypass the appname on the local box. Also, you may want to use a factory (if it is conceivable, or for future apps) that would instantiate all your objects. Then, if you migrated the com. part into it, you could just change it in one spot instead of hundreds... Peter Bell wrote, On 3/27/2007 12:57 AM: Hi Aaron, Most common solutions are replicating environments between dev and production or an ant script with a Regex for the changes on pushing to your production server. Best Wishes, Peter On 3/27/07 1:42 AM, Aaron Roberson [EMAIL PROTECTED] wrote: On my local windows machine running XP Pro and IIS 5 I specify the component path like so: createObject(component,appname.com.user.user).init(); But on my remote server running Windows 2000 Server and IIS 5 I have to specify the component path like so: createObject(component,com.user.user).init(); This is a huge problem because it requires that I change the path/package name on every object invocation and within every object that returns a full qualified path and object name as the return type or accepts an argument with the path and object name as the type. Just to let you know, my webroot locally is C:\Inetpub\wwwroot\ (app path as C:\Inetpub\wwwroot) and my webroot remotely seems to be something like D:\home\ (app path D:\home\appname). What is the answer to this? You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] newbie questions about cfproperty and cffunction returntype paths
J MacKay wrote, On 3/26/2007 4:51 PM: - Is there any benefit to using cfproperty in a cfc that is not used as a web service? It might make for better documentation. But it might also make for more clutter. 1) Put all cfcs in a single directory .. Not a good idea if you have lots of cfcs, but you probably knew that. 2) Suck it up and use the full path .. Wouldn't be too bad if you can do it dynamically. 3) Spit in the face of best practices and use returntype=any. I hope Mr. Practices is into that sort of thing, because if not, he must be steaming mad (but not mad enough to fight back, yet). That's my favorite choice, in most situations. You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] ORM: Generic Child Array in Parent Bean
Alpino, Justin wrote, On 3/21/2007 1:21 PM: Hi Robert, I think there are pros and cons for using that approach: Pros - smaller components - less code to maintain - more flexible Cons - too ambiguous (you don't know what the component holds just by looking at it) - increased coupling between objects (calling objects must know the names of internal data structures) I disagree with this, as although you don't need to know the actual name of the variable in the other method, you might as well. Who is going to make getAddress return the person's name? - forces order of calling the setter before getter (when requested arrays are not previously defined. will throw an exception rather than something expected like an empty array) The generic approach could also check that the variable is defined, and then define it. (Of course, there is no check that the variable actual /should/ exist in this way, unless you guarantee that anything valid will be defined before or in the init method.) You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Light framework?
through those terms so i really understand what control is inverted here and why it's helpful for me to understand it that way in order to use ColdSpring. Are you up to that? I easily get the concept wiring my services/CFCs together so they can work together and i think that's easy for most people to understand. I still don't get the inversion of control thing. There's a central config file, i can manage all the dependencies from there. why is that considered inverted? to be honest, the concept just isn't useful to me to understand how to use ColdSpring. (i kinda wish i could have turned the word ColdSpring upsidedown there, made it inverted! ;-) ciao, Nando On 3/15/07, Sammy Larbi [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Nando, Very well said. I can certainly see a disconnect now that you put it the way you did (and particularly after reading your blog entry at http://aria-media.com/blog/index.cfm/2007/3/14/Instantiation). However, I still wonder if even given that explanation (though surely a person would understand better), would they know they needed it if they didn't understand what inversion of control was, and the purpose it served? Nando wrote, On 3/14/2007 1:16 PM: Sammy, As someone who is self-taught, I'm saying that the language, the pattern lingo that is used, can be a barrier to understanding what ColdSpring can do for you in simple terms. It tends to imply to the learner that they need to study OO patterns before they can use a framework. If instead, one says to an aspiring OO newbie who is self-taught: ColdSpring can instantiate (linked to a clear and simple definition) the objects or CFCs that your whole application needs for you, and wire them together so that they can work with each other. As anyone who has tried to architect an application that uses CFCs can tell you, working out how the CFCs should work together can be one of the most difficult parts of designing and coding your application, especially for a beginner. As you progress, it often involves reworking of your code significantly, and can easily introduce mistakes. This is particularly true if someone is inexperienced with object orientation and hasn't come to the point where they have a preferred way of organizing their objects to work together. It's also certainly true for an experienced programmer, because new requirements or unrecognized aspects of the application can pop up at any time, forcing you to rethink your design. ColdSpring uses a simple XML language in it's configuration file that is easy to pick up. Depending on your level of experience, it can take anywhere from a hour or two to learn the basics, to perhaps a day if you are really new to all this. To reorganize the way your CFC's work together or add another CFC to your app, you can simply and quickly rewire them in the config file (and perhaps add a bit of code to your objects). Here are some examples to get you started: Then show some comprehensive examples, so they can start using it immediately (although certainly not as well as an experienced OO architect). Explain a few cavets along the way. And that opens doors to further learning, as experience is an excellent teacher. At the end, you can say: By the way, ColdSpring is based on the Java framework Spring. In object oriented pattern speak, it's an Inversion of Control container. For further reading and study, http://www.martinfowler.com/articles/injection.html is a good place to start. On 3/14/07, Sammy Larbi [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Nando wrote, On 3/13/2007 5:02 PM: IF ... someone is new to CFCs and OO and all this lingo, they can certainly use ColdSpring without conceptually understanding Inversion of Control. But it probably doesn't at all seem like it to them. They could, but how would they know they wanted to, or that it would be beneficial in particular cases? You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects
Re: [CFCDEV] Light framework?
Nando, Very well said. I can certainly see a disconnect now that you put it the way you did (and particularly after reading your blog entry at http://aria-media.com/blog/index.cfm/2007/3/14/Instantiation). However, I still wonder if even given that explanation (though surely a person would understand better), would they know they needed it if they didn't understand what inversion of control was, and the purpose it served? Nando wrote, On 3/14/2007 1:16 PM: Sammy, As someone who is self-taught, I'm saying that the language, the pattern lingo that is used, can be a barrier to understanding what ColdSpring can do for you in simple terms. It tends to imply to the learner that they need to study OO patterns before they can use a framework. If instead, one says to an aspiring OO newbie who is self-taught: ColdSpring can instantiate (linked to a clear and simple definition) the objects or CFCs that your whole application needs for you, and wire them together so that they can work with each other. As anyone who has tried to architect an application that uses CFCs can tell you, working out how the CFCs should work together can be one of the most difficult parts of designing and coding your application, especially for a beginner. As you progress, it often involves reworking of your code significantly, and can easily introduce mistakes. This is particularly true if someone is inexperienced with object orientation and hasn't come to the point where they have a preferred way of organizing their objects to work together. It's also certainly true for an experienced programmer, because new requirements or unrecognized aspects of the application can pop up at any time, forcing you to rethink your design. ColdSpring uses a simple XML language in it's configuration file that is easy to pick up. Depending on your level of experience, it can take anywhere from a hour or two to learn the basics, to perhaps a day if you are really new to all this. To reorganize the way your CFC's work together or add another CFC to your app, you can simply and quickly rewire them in the config file (and perhaps add a bit of code to your objects). Here are some examples to get you started: Then show some comprehensive examples, so they can start using it immediately (although certainly not as well as an experienced OO architect). Explain a few cavets along the way. And that opens doors to further learning, as experience is an excellent teacher. At the end, you can say: By the way, ColdSpring is based on the Java framework Spring. In object oriented pattern speak, it's an Inversion of Control container. For further reading and study, http://www.martinfowler.com/articles/injection.html is a good place to start. On 3/14/07, Sammy Larbi [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Nando wrote, On 3/13/2007 5:02 PM: IF ... someone is new to CFCs and OO and all this lingo, they can certainly use ColdSpring without conceptually understanding Inversion of Control. But it probably doesn't at all seem like it to them. They could, but how would they know they wanted to, or that it would be beneficial in particular cases? You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com http://www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org http://www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Light framework?
Nando wrote, On 3/13/2007 5:02 PM: IF ... someone is new to CFCs and OO and all this lingo, they can certainly use ColdSpring without conceptually understanding Inversion of Control. But it probably doesn't at all seem like it to them. They could, but how would they know they wanted to, or that it would be beneficial in particular cases? You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Matching Field Names
Mark Ireland wrote, On 3/13/2007 2:03 AM: Doesnt everybody have their own conventions for field/column names? Yes, I like the convention that column_name=field_name. There are conventions about naming individual variables as well, but this one makes it easy to map them. (I mean couldnt you guess what you called something if you knew its purpose? Like its existence implies one thing and its value another?) \ Of course. For zip code I might guess it was called zip or postalcode or zipcode. But, if I kept it the same as my column name (or the other way around, if you prefer to think in those terms), then I would know both if I could remember one of them. Other examples abound, I'm sure =) -Sam From: Sammy Larbi [EMAIL PROTECTED] Reply-To: cfcdev@cfczone.org To: cfcdev@cfczone.org Subject: Re: [CFCDEV] Matching Field Names Date: Thu, 08 Mar 2007 13:16:43 -0600 Steve Bryant wrote, On 3/8/2007 12:48 PM: At 11:52 AM 3/8/2007, Sammy Larbi wrote: I've had so much trouble with differing form field names vs. correspondingly different names (say for an update), I'm not sure why anyone would want to have different form field names...=) Sammy, I generally have the same form field names as argument names as well, but what kind of trouble have you had? Oh, just things like what did I name that field again? Oh let me open the file and take forever to scroll through and find it. Stuff like that... nothing that CF has done to me or anything. You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org _ Advertisement: Find new used iPods; designer clothing and more. Join free at http://www.ebay.com.au http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Frover%2Eebay%2Ecom%2Frover%2F1%2F705%2D10129%2D5668%2D323%2F4%2F%3Fid%3D3_t=760348364_r=Findnew_m=EXT You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Light framework?
+1 from me to this and Peter's suggestion of it. Matt Woodward wrote, On 3/13/2007 9:38 AM: The basic concepts of Fusebox haven't changed that much, and to me, spending time learning an old version when you're just starting out doesn't make any sense whatsoever. The underlying framework core has changed to be all CFCs, but that doesn't mean the end user has to know anything about CFCs to use it. Furthermore, I'd disagree with your contention that learning FB3 is any easier than learning the current version. To me it just seems like it's a waste of time and ill advised to learn an old version when you're just going to have to learn the new versions anyway if you intend on keeping up with FB in your development. On 3/13/07, RADEMAKERS Tanguy [EMAIL PROTECTED] wrote: Matt, General comment--I'm not sure why you'd learn a version of any framework that's that old. Two reasons: 1) because it's easier to learn fb 3 than fb 5 (or 6 or 7 or whatever they're up to by now). and 2) because once you have learned fb 3, it will be easier to go on and learn fb 4, 5, 6, whatever. Remember, Joe is looking for something from which he can transition to a heavier framework. /t You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] ArgumentCollection
Brian Rinaldi wrote, On 3/8/2007 6:56 PM: I think using argumentCollection is a completely valid way of doing things. I use it all the time. Why write everything out when you can do things like argumentCollection=form or argumentCollection=url? You'll also find it in my code generator whereby I turn a query row into a struct and init a new bean using argumentCollection. Suffice it to say I use it wherever I can. I think it does a couple of beneficial things, the primary being that when your arguments change you don't need to go around updating your function calls. The second is, it makes handling empty values easier. For instance, let's say you were passing a full name you might say user.init(firstName=firstName,mi=mi,lastName=lastName). However, how do you handle the middle initial (mi) if it isn't defined because it is not required. You could pass an empty string and code your function to check for that, or you could just use argumentCollection. This is actually a poor example, since it works better for numeric and other types where, if you type check your arguments as you should, you can't use empty string as a null equivalentbut I think you get my drift. Absolutely, I use it for similar reasons as well. But, I don't know that if I was hand-coding things, I would use it quite so much. A generator or framework is one thing, but daily use and having to think about it is another. It may makes things easy in the short run, but I would think that having to go back over some code a year after you wrote it (or someone being new to it altogether) would be difficult if the code documents itself like that... -- Brian Rinaldi blog - http://www.remotesynthesis.com/blog ColdFusion Open Source List- http://www.remotesynthesis.com/cfopensourcelist Boston CFUG - http://www.bostoncfug.org Adobe Community Expert - http://www.adobe.com/communities/experts/members/brian_rinaldi.html CFDJ Editorial Board - http://coldfusion.sys-con.com/general/editboard.htm Dave Watts wrote: Q: If you have a ton of arguments, is using ArgumentCollection the best practice? I wouldn't go so far as to say it's a best practice or it's not, but my personal preference is only to use ArgumentCollection when I might have an unknown number of arguments. 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, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] ArgumentCollection
I liked the message (made me smile even!), but, even if you had some method, say calculateTax, you would rather pass an entire form than just pass form.priceWithNoTaxYet? Aaron DC wrote, On 3/8/2007 9:16 PM: fire addfuel=true cfscript ... // save the form (default) someCFC.Save(); ... // save the URL someCFC.Save(URL); ... someStruct = StructNew(); someStruct.someKey = Some value; // etc... // save some structure someCFC.Save(someStruct); ... /cfscript CFC: cffunction name=Save cfargument name=someData type=structure default=#form# ... /fire I've been playing with CFCs for a few months now, having just converted an ASP (OO) framework I developed (loosely based on a PHP framework I studied) into CFML. In my weaker hours I may have possibly developed constructs similar to the one above, but would not admit to it on the grounds that someone may decide it's a bad practice (TM). You will never catch me programming or condoning the practice of passing in individual FORM elements to a function when I can pass in the entire FORM structure. Aaron Nando wrote: Shrug ... you can just as easily accept a struct as an argument, calling it something like arguments.submittedValues, and pass the form scope to the function that way. someService.processMyForm(form) cffunction name=processMyForm cfargument name=submittedValues ... Phillip Senn wrote: Someone recently asked if passing the form scope was a best practice. I found an interesting method called ArgumentCollection, but I don't know very much about it. Q: If you have a ton of arguments, is using ArgumentCollection the best practice? You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] scafold component
Tom Chiverton wrote, On 3/9/2007 6:02 AM: On Thursday 08 Mar 2007, Sammy Larbi wrote: I've had so much trouble with differing form field names vs. correspondingly different names (say for an update), I'm not sure why anyone would want to have different form field names...=) Hang on, are you saying I can update any field in the database by changing a form POST / GET ?!? Can't tell if that is facetious or not =) But, yeah, that's what I've been working on lately - change a DB column and change is reflected throughout application. But not the other way around (I've thought about doing that too, believe it or not - just not sure of its value, since I tend to work the other way) You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] scafold component
Tom Chiverton wrote: On Friday 09 Mar 2007, Sammy Larbi wrote: Can't tell if that is facetious or not =) But, yeah, that's what I've been working on lately - change a DB column and change is reflected throughout application. But not the other way around (I've thought about doing that too, believe it or not - just not sure of its value, since I tend to work the other way) What if I modified your form's POST ? Can I now alter anything I like then ? Tom, Not sure exactly what you mean. I'll describe in better detail what I meant, and then await your reply. Right now, I have it such that there is (for example) a Demographic object that relates to a Client. So, in my database, I have a Demographic table and a Client table. I create a couple of components that extend some base components I have (without any other code), and then I've got a form to insert a new client, update an existing one, delete an existing one, a listing of them all, plus a bunch of methods to allow me to manipulate it (very similar to Ruby on Rails, if you've used it). I've got the same stuff for the demographics. In code, I let the Client know that it should auto-load some columns from the associated Demographic row when it is created, because I want those to be available to me to show with my Client object. I do similar stuff for Demographic. But, Demographic has a bunch of foreign keys to things like Valid Races and Valid Age Ranges, so rather than having a text field to put an int for the key, I tell it to load a select which should be populated from the respective tables (eventually, I may automate a lot of that too). What I was saying about the other way around is basically, instead of relying solely on the db, allow myself to define properties in my objects, and then if they don't exist in the DB, automagically create those respective columns in the DB/table. So, the form wouldn't do it, as that is generated based on the object, but the object definition might effect changes in the database schema. About modifying anything you like -- I'm not sure what you mean by that, but yes, if you want to you can certainly do that. In the controller you could modify the form structure and its keys (not that that may be a good idea), but in the model, it extracts from the form any keys which it has itself, and then you could define a method, beforeSave() where you could do calcualtions if you need. Does any of that hit on what you meant? =) -Sam You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] ArgumentCollection
On Thu, 2007-03-08 at 08:36 -0500, Phillip Senn wrote: Someone recently asked if passing the form scope was a best practice. I found an interesting method called ArgumentCollection, but I don't know very much about it. Q: If you have a ton of arguments, is using ArgumentCollection the best practice? I think in general, you should strive to not have too many arguments in a method. But if you do, and they can all be related, it would be better to use a struct, in that case, as it helps break down the number of arguments and better organize them. As for using ArgumentCollection as a substitute for that, I think that would be valid, but others may disagree. You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] scafold component
On Tue, 2007-03-06 at 17:37 -0800, Jim Cassata wrote: I have a question. is it ok to pass the #form# structure to the CFC as a single variable? Or is it better to pass the individual form arguments? I know both work in CF, just wondering if one way is better for making the CFC more universal (have plans for some Flex down the road) I guess it would depend on how you are using it. If you pass it as a struct and really need everything, then I don't see a problem (as in, you are updating a user, and the form contains all that information you need). But in cases where it would be lying to say I need a struct, which would hide the real value you want, then I think that would be bad. An example of this would be something like calculateTax(form). Well, you don't want form, you want only the price stored in the form. You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] scafold component
Steve Bryant wrote, On 3/8/2007 11:14 AM: At 10:43 AM 3/8/2007, Tom Chiverton wrote: On Thursday 08 Mar 2007, Steve Bryant wrote: needs, you can use argumentCollection to pass in the whole form structure - with each field being used as a separate argument. But you must then never change a form field name - you don't know if it's being used by the CFC or not. Definitely a good point. Any time that you use a shortcut like that you are creating a non-documented dependence. Certainly, using named arguments does a better job of documenting the dependencies (and allowing you to use different field names than your argument names). I've had so much trouble with differing form field names vs. correspondingly different names (say for an update), I'm not sure why anyone would want to have different form field names...=) You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Matching Field Names
Steve Bryant wrote, On 3/8/2007 12:48 PM: At 11:52 AM 3/8/2007, Sammy Larbi wrote: I've had so much trouble with differing form field names vs. correspondingly different names (say for an update), I'm not sure why anyone would want to have different form field names...=) Sammy, I generally have the same form field names as argument names as well, but what kind of trouble have you had? Oh, just things like what did I name that field again? Oh let me open the file and take forever to scroll through and find it. Stuff like that... nothing that CF has done to me or anything. You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] CFC interaction and persistent scopes (newbie questions)
Joe, I didn't have the time to read all of this, but I thought I might answer a couple of the questions that I have read. First, to get a good background in OO, there are plenty of resources available. I'd check out a book on the subject for sure. Also, I always like to point people to Bob Martin's site, where he lists the principles of OO design. Those really helped stuff click for me. http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod ... also, look up cohesion and coupling and understand them. If you need, you might want to read more basic things about the terminology, but so far you sound like you've probably done that ... More follows... Joe Lakey wrote, On 3/6/2007 2:08 PM: I've started reading some of the MVC stuff on the web, but it's still a little above my head. I'm really having trouble differentiating between the model and controller layers. The model is where you put the business logic (also commonly called domain logic) of your application. For instance, if you were doing a shopping cart, you'd want to put classes like Product, Customer, etc in there, and methods that know how to calculate the total of an order, save orders, and stuff like that. The controller does just what it says- it controls the application. It wires together the view and the model, so to speak. This is where you might put authentication checks like if isAuthenticated() show admin stuff. That's really a bad way to describe it, but you'd put the knowledge of how to do the authentication in the model layer (probably) and put the actual authentication in a controller. I suppose you could also put it in the model, but that, to me, would be a lot more hassle and doesn't follow logically (although others may differ in their opinion). Basically, a control would route requests and let the view have the information it needs from the model. That's how I look at it. 2. If a CFC extends another CFC, does the init() method need to call Super.init()? If so, why doesn't this create two instances--one of the parent CFC and one of the child CFC? Does super.init() automatically receive arguments passed to init(), or do they have to be explicitly passed to super.init()? If you redefine the init method, no, it won't call it unless you also call super.init(). And no, it wouldn't automatically receive any arguments. Init is just a convention that was established to get information into your CFCs, as there is no real constructor to call to do that. Therefore, it would behave as any other method. 3. If a method overrides a method of a base CFC, does the child method need to to call super.myMethod()? Not unless you want to perform the super functionality in addition to your overriding of it. This is bad example, but the only one I have in my head right now: suppose in Base.cfc you have a method like displayDiv. Then, in Derived.cfc you want that method that would wrap that div in a box. You could have something like cffunction name=displayDiv div style=border: 1px solid black; super.displayDiv() // this will set whatever was being done originally /div /cffunction Of course, this is a poor example, but my mind is drawing blanks right now. What if the child method is only intended to override part of the parent method's functionality? For instance, the method may set a number of properties, but the child method only needs to override some of those properties. Well, you'll either need to factor better, or override all the properties. I'd prefer to factor better. There are also patterns that you might want to look up after gaining some experience. In particular, there is one that might apply here. I can't think of the name though. I'm not thinking strategy, but something else (strategy is similar in intent to what I'm thinking,... anyone want to jump in and help me?) Also, similar to question 2, does super.myMethod() receive arguments passed to myMethod(), or must they be explicitly passed to super.myMethod()? No, again, you'll need to pass it. 4. How is a method of one object made available to the methods of another object? You can either use composition/aggregation (in which the object you are trying to reuse would be contained within your object), or you can use inheritance, as you've mentioned above. Most of the time, you'll probably be using containment. Inheritance is generally only advised for when what you're doing is really inheritance. Can a property of the second object be a reference to the first object? It can, but generally you don't do that. You'd provide getters and setters (also called accessors and mutators by some) to do that for the properties you want others to be able to edit. This deals with encapsulation (but encapsulation is much more than just that). If you use the this scope on these properties, then you can access them. Most people advise against that. If so, is the first object
Re: [CFCDEV] Notes while attending a meeting
That sounds a lot like my initial attempts at CFCs/OOP in general. Some people might have called them God-Components/Objects. I like to think of them as experiments in anti-patterns. =) Phillip Senn wrote, On 2/28/2007 2:13 PM: When objects attack Objects gone bad Objects gone wild You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Where should I validate form submissions?
Peter J. Farrell wrote, On 2/28/2007 4:48 PM: So after a while, letting the bean know how to validate itself became unreasonable for us. In the end, we don't mind that our beans are very stupid and a bit anemic. Those are my two cents and I'm sure in the future I'll have more to say. I don't see this as an either-or issue. I've not used this strategy in CF, but in Java, I might create a Validator class which would know how to validate very common things, like length, isnumber, isdate, and such. Then, the model would compose an object of type Validator. But, the key is, it would set its own validation rules to be followed in the Validator object. Anything not common enough to make it into the Validator would be performed in the bean itself. So basically, you might have a routine like // in the constructor, we've set up the validator as a private member _validator, and set its rules somehow. public boolean isValid() { result = true; // perform custom validation, building an errorMessage as required. if (somethingDoesntValidate) result=false; return result _validator.isValid(my_info); } I've found the approach does a good job of staying DRY and abstracting don't-need-to-know validation logic. -Sam You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] CFC best practice (was ROI;)
Jim, For those questions I'd take a look at http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod and specifically the first 5 principles listed there. It's a great introduction to OOD. If you encounter a term you haven't seen, I'd look it up to understand it. Finally, I'd have a look at the DRY principle, because that one is pretty helpful too. If you're down for a bigger read, check out Steve McConnell's Code Complete 2 (I'm currently reading it). It has a lot of information regarding the questions you asked (plus a lot more). I've also heard good things about Head First OOAD, which would address some of your questions, but I haven't read it myself. -Sam Jim Cassata wrote, On 2/19/2007 4:04 PM: even the mechanics of using CFC's properly might be a hidden mystery in the beginning, one that you may not find explained clearly anywhere. Nando YES Nando! huge emphasis on properly! I can make the CFCs work real fast and real easy, but am I doing it properly? I have no idea. I have been religiously following the Forta CFMX7-WACK but the examples are so basic. How many fnctions in a CFC are too much? How many CFC invokes in a CFM page are too much? WHen to use CFObject vs CFInvoke? For example one of my cfm pages maybe had a query joining 4 tables and then 4 other queries that get records from some supporting tables. How should I break that logic into CFCs and CFFunctions? Well, by not knowing the answer to that question my approach has been to put the functionality for that page into it's own function, with cffunctions to similar pages grouped into the one CFC. If I did add a feature, instead of updating multiple cfm pages, now I go to one CFC and update several cffunctions. Better than the way it was but is it proper? or best? As for the ModelGlue, if I want an existing app to be in MG am I essentially rewriting the whole thing? Jim You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] CFC best practice (was ROI;)
I haven't read the Head First design patterns book, but I've read the Gang of Four. I always felt like design patterns followed from the principles (which I assumed would be in HF OOAD), and that it might be better to know the principles and then learn the patterns. But, since I haven't read either of them, I can't say for sure. I can say that the GoF design patterns book is not where I'd go to get my feet wet though =). -Sam Peter Bell wrote, On 2/20/2007 7:47 AM: Head first OOAD is a good book, but it assumes a familiarity with OO coding. I'd actually read head first design patterns before their OOAD book (which is good, but to my mind, not intro level). The DP book isn't specifically about OO, but it covers the basics and also introduces a bunch of patterns you're going to need to learn over time to get how to make OO work in practice. Best Wishes, Peter On 2/20/07 7:02 AM, Sammy Larbi [EMAIL PROTECTED] wrote: Jim, For those questions I'd take a look at http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod and specifically the first 5 principles listed there. It's a great introduction to OOD. If you encounter a term you haven't seen, I'd look it up to understand it. Finally, I'd have a look at the DRY principle, because that one is pretty helpful too. If you're down for a bigger read, check out Steve McConnell's Code Complete 2 (I'm currently reading it). It has a lot of information regarding the questions you asked (plus a lot more). I've also heard good things about Head First OOAD, which would address some of your questions, but I haven't read it myself. -Sam Jim Cassata wrote, On 2/19/2007 4:04 PM: even the mechanics of using CFC's properly might be a hidden mystery in the beginning, one that you may not find explained clearly anywhere. Nando YES Nando! huge emphasis on properly! I can make the CFCs work real fast and real easy, but am I doing it properly? I have no idea. I have been religiously following the Forta CFMX7-WACK but the examples are so basic. How many fnctions in a CFC are too much? How many CFC invokes in a CFM page are too much? WHen to use CFObject vs CFInvoke? For example one of my cfm pages maybe had a query joining 4 tables and then 4 other queries that get records from some supporting tables. How should I break that logic into CFCs and CFFunctions? Well, by not knowing the answer to that question my approach has been to put the functionality for that page into it's own function, with cffunctions to similar pages grouped into the one CFC. If I did add a feature, instead of updating multiple cfm pages, now I go to one CFC and update several cffunctions. Better than the way it was but is it proper? or best? As for the ModelGlue, if I want an existing app to be in MG am I essentially rewriting the whole thing? Jim You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] CFC best practice (was ROI;)
Yes, this is akin to magic numbers (which are bad). There is no way to tell that servertype 1 means production or even that it doesn't refer to something like web, file, or print server. It would have even been better just to make the column a string type and just put production and such in there, I think in this case. In general I'd probably put it in another table and have it refer to that if it can change, but for a simple application, I probably wouldn't bother. -Sam Jim Cassata wrote, On 2/20/2007 12:13 PM: while on the subject of best practice, I have a question re CFC practice. In the days I made my app, I have a table (simplified) that lists IT servers. Looks kinda like this: serverid | servername | servertype | 1 |win01 |1| 3 |win09 |2| 2 |win06 |3| Now server type was just 1=production, 2=dev, 3=test. And as such no servertype table was ever made, I just had the cfml convert the number to name in the cfm pages, like this: Server Type: cfswitch... /cfswitch Is this a bad practice? am wondering if this way of handling information is too much putting business logic into presentation layer Might I find out in Flex that I can't display the server type text after retrieving a query result? Thanks all, enjoying the dialog very much! Jim C - Original Message From: Marc [EMAIL PROTECTED] To: cfcdev@cfczone.org Sent: Tuesday, February 20, 2007 10:55:26 AM Subject: RE: [CFCDEV] CFC best practice (was ROI;) I am smack in the middle of the Head First OOAD book right now, reading it rather closely (but not doing the exercises yet... Shame on me!). I can say this book is definitely one to have, although I don't 100% agree with their approach to discovering requirements. I'd say I actually agree to only about 50% of their requirements gathering approach... But it could be that they took their particular route in order not to turn the book into a Head First Project Management book of some sort. ;) The actual process of working through what constitutes a class and when and where you might consider creating new classes or not is actually presented very well; it's definitely one that I welcome, right next to my Head First Design Patterns, Head First HTML/CSS/XHTML, Head First Java, and Head First JSP and Servlets! :) Marc Behalf Of Peter Bell Sent: Tuesday, February 20, 2007 10:31 AM To: cfcdev@cfczone.org Subject: Re: [CFCDEV] CFC best practice (was ROI;) Head first design patterns much easier than GoF and also includes basics from polymorphism on up. While I'd assumed OOAD book would be the basics, my experience was that it was more intermediate, although I was in a rush when I skimmed it and haven't had a chance to get back to it yet for a proper read. It even says somewhere that it is for people who can already do OO programming and is moving you to next level to help with analysis and design . . . Best Wishes, Peter You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] ROI (was CFC best practice)
Phillip Senn wrote, On 2/19/2007 10:33 AM: Will I see a savings of time by the time I am done? That's been the unspoken question for so many people. I doubt the savings of time would be noticed by the time he finished, but it would be evident when maintaining the code, I think. And, its not just time-saving that comes into play here - we also should think about the headache poor design can cause, and the inertia we have to overcome when needing to work on something that was not designed well. I wonder what the group has to say about that. It used to be (back in the 80's) that you could cost justify an expense if you could show a 3 year Return On Investment (ROI). In other words, if a new piece of equipment paid for itself within 3 years, you could more than likely get it approved. Taking that analogy into the time-save category, and recognizing that we are now working on Internet time, Q: What do you think should be a good ROI should be for spending your time on a new technology? This might be helpful in making the millions of little decisions that I've been making all along. I haven't ever looked at it like that. I just like to learn, so when I've got the time, I try to pick up something new. More often, I don't have time, but I'll be able to learn new things as a byproduct of the particular project I'm working on. I would be interested though, if someone did have a way to map the learning of new technology to ROI. If I create this shortcut, will it save the amount of time that it took me to create it over the span of the next x years/months/weeks? That's what I'm working on now. But, it's sort of backward. This stuff took me all these years. A lot of it is not designed as well as it could be, maintenance is a nightmare in some cases, and a lot of it could have been extracted as reusable code. (from a lower level viewpoint than just message boards or login screens). I've looked at it that way, and decided I may as well do something about it. If I put business logic in CFCs… Well, one would have to do it correctly first =). But, I don't think procedural apps have to be unmaintainable. You can screw up procedural code just as easily as OO code - I think we've just come to think of procedural as being poorly designed. This doesn't have to be the case. I think well-designed OO through CFCs still can offer more benefits than well designed procedural code, and possibly enough to justify looking at it from an ROI perspective. Certainly there is a lot of literature and an almost an entire industry preaching the benefits of OO over procedural code... If I learn this framework… What about just writing one? =) -Sam *From:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] *On Behalf Of *Jim Cassata *Sent:* Saturday, February 17, 2007 11:29 AM *To:* cfcdev@cfczone.org *Subject:* Re: [CFCDEV] CFC best practice thanks Nando! I have been looking at ModelGlue in order to get my brain around what it actually is. I do not understand what a framework is and am trying to get a grasp on what it is and how I will benefit. Not sure of the benefits because: 1) My web app is already built consisting of 750 cfm files 2) I am the sole developer I am saying not sure because that is the boat I am in. (which is floating nicely) I just sunk two solid weeks of my life into CFEclipse and am now seeing some benefit. So, as I am going through my web app to put BL into CFCs, should I now be recreating is as a new app in ModelGlue? Will I see a savings of time by the time I am done or will it be like more of a rewrite of my app? - Original Message From: Nando [EMAIL PROTECTED] To: cfcdev@cfczone.org Sent: Friday, February 16, 2007 8:47:12 PM Subject: Re: [CFCDEV] CFC best practice Jim, I've been thinking about your post in the back of my mind for a few days. I have a suggestion for you to think about. Try ModelGlue out. MG, because of the way it's structured, throws you in the water so to speak with CFC's. You use CFC's to do everything except the display . And it's really not too difficult to learn. What will probably happen is you'll soon be making your first design mistakes, which are similar to putting your shoes on the wrong feet, or your shirt on backwards. And that's when you begin to learn something valuable, because you then need to figure out how the shirt or the shoes fit properly in your application design. So the nice thing about MG is that it plops you in a world filled with CFC's to begin with. At first, that might be foreign and a little frustrating, but the MG QuickStart guide is really easy to follow and that helps. Try it out with a simple, personal project first. A disclaimer about Flex tho'. MG is for HTML apps with perhaps Flex widgets. It becomes useless if your app is entirely Flex based. MG is also appropriate if you have a Flex
Re: [CFCDEV] ROI (was CFC best practice)
Eric Knipp wrote, On 2/19/2007 11:29 AM: As far as ROI is concerned - doesn't that depend a lot on the ROI goals of your business? As a small business owner you must have some revenue targets, which somehow map back to what kind of productivity you need to achieve as a developer. I like Barney's explanation of the time it took him to learn CFC's - it could take you more, or less than that. Bottom line, CFC's are going to do a few things for you (a) make you more efficient as a developer (b) make your application easier to manage (c) make your application easier for someone you hire (when your business grows - hopefully) to manage for you more cheaply (d) make your application easier to sell (when the time comes) I know you probably meant this, but just to be explicit: CFCs don't do those things for you, good design does. I've written CFC-based apps that are more horrendous than their non-CFC cousins. =) Sam You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] 2 SoftReferences pointing to the same CFC
Mark, That /is/ strange. I just read the docs on it, and it does mention specifically At that time [the garbage collector] may choose to clear atomically all soft references to that object. Certainly atomically means all both references should be collected. But, you probably already knew that =). Can you share how you are (re)producing the behavior? -Sam Mark Mandel wrote, On 2/14/2007 7:45 PM: Hey all, I'm wondering if anyone has seen behaiviour where you have 2 SoftReference objects pointing to the same CFC, and one soft reference will get picked up by the JVM and garbage collected, but the other one won't? It's doesn't seem like it should be possible, but it seems to be happening to me. Any thoughts? Mark You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] RE: DW vs Eclipse
Tom Chiverton wrote, On 2/8/2007 8:43 AM: On Wednesday 07 Feb 2007, RADEMAKERS Tanguy wrote: before being able to see it on your dev server. Plus this means you will have lots of non-working checkins in svn. You shouldn't get hung up on always having a working HEAD. Why do you say that? I've always been taught not to break builds when you check-in code. Wouldn't that require being hung up on that? You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Source Control Breaking Builds (was RE: DW vs Eclipse)
Tom Chiverton wrote, On 2/8/2007 10:31 AM: On Thursday 08 Feb 2007, Sammy Larbi wrote: You shouldn't get hung up on always having a working HEAD. Why do you say that? I've always been taught not to break builds when you check-in code. Wouldn't that require being hung up on that? Who cares if HEAD is broken ? Not the real web site, because that's on a locked down branch, right ? Not the QA/test site, because that's running against a tag, no ? So it's only you and your fellow developers. If you have some massive, going-to-take-weeks change to make, but still want to check in at internal checkpoints in case your hard disk catches fire, you should be on a branch. If you are hacking at the one file that has a problem, a quick IM or shout around the room should be all that is needed to make sure no one else is goind to update to the 'funny' revision. The only time other dev. members should be running an update is if they are working on a file after someone else has done with it. What if I want to be able to ship/go live at _any_ time? I cannot do that with broken code (I'll have to revert to the last known good state, but who can tell when that was if we don't concern ourselves with having working code in the repository). As far as the hassle it causes developers, you could IM (or shout) to everyone not to check out the latest code, assuming everyone is willing and able to comply with your wish, and not be affected work-wise. They have the latest just-before you committed, then someone else checks in bad code and possibly leaves for the day, then another, now yours is fixed, but someone else's isn't so someone else still can't check out the latest, and so on. I don't see (yet?) why it should be so hard to not check in bad code, or what reasons you might have for wanting to do so. Even in the case you mention, where you might be hacking at one file for some short time, what is the problem with making sure it works before you commit? I'd just rather not check in broken code. It doesn't seem like a sound practice. -Sam You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] RE: DW vs Eclipse
RADEMAKERS Tanguy wrote, On 2/7/2007 12:41 PM: the downside to this approach is that you have to check in a change before being able to see it on your dev server. Plus this means you will have lots of non-working checkins in svn. /t I would have assumed that you'd be testing before checking in the code. But, I may have been assuming wrong. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Stijn Dreezen Sent: Wednesday, February 07, 2007 5:18 PM To: cfcdev@cfczone.org Subject: Re: [CFCDEV] RE: DW vs Eclipse Basically you can edit code where-ever you want with eclipse, if you combine cfeclipse with some version control plugin. We often use subversion to create our repositories and check in/out code on a windows workstation with eclipse using a subversion plugin. Updates can be sent to where-ever you want on your linux dev server by creating a working copy somewhere in your webroot and add /path/to/working-copy and svn up in hooks/post-commit in your subversion repository. This will update the working copy on your dev server each time you check in some code. All transmissions are done via http, so this will basically work everywhere. You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] RE: DW vs Eclipse
RADEMAKERS Tanguy wrote, On 2/7/2007 1:05 PM: I would have assumed that you use your dev server to test your code...no? I just also assumed i knew what was meant and didn't focus too much on the exact terminology, but rather the intent of the statement. Again, I may very well be assuming too much, since that's two assumptions on the same sentence =) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sammy Larbi Sent: Wednesday, February 07, 2007 8:05 PM To: cfcdev@cfczone.org Subject: Re: [CFCDEV] RE: DW vs Eclipse RADEMAKERS Tanguy wrote, On 2/7/2007 12:41 PM: the downside to this approach is that you have to check in a change before being able to see it on your dev server. Plus this means you will have lots of non-working checkins in svn. /t I would have assumed that you'd be testing before checking in the code. But, I may have been assuming wrong. You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] RE: DW vs Eclipse
My assumption was that dev server meant repository. Like, you might have local machine for actual development/testing, then dev server for the code repository, then production server, and so on. I wouldn't check in code before I had tested it, so I agree with you. I probably just scanned it and put in too many assumptions. My apologies for that. In any case, my assumptions and misunderstandings led to a blog post where I've gotten a few good comments. The post is essentially worthless, except to pose the questions, but the comments have been useful to me (so, you can scroll down to them, or answer the question as well, if you wanted). http://www.codeodor.com/index.cfm/2007/2/7/How-do-you-version-control-your-CF/930 RADEMAKERS Tanguy wrote, On 2/7/2007 2:08 PM: I'm not being picky about dev vs. test. My point was about the use of svn to ... update the working copy on your dev server each time you check in some code. You shouldn't have to check in code to see your changes, you should just be able to save your file and then reload your browser (whilst java developers around you gasp in amazement). Once it's all working (well, once there are no more really obvious bugs), THEN you check it in... Or am i still misunderstanding? /t -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sammy Larbi Sent: Wednesday, February 07, 2007 8:56 PM To: cfcdev@cfczone.org Subject: Re: [CFCDEV] RE: DW vs Eclipse RADEMAKERS Tanguy wrote, On 2/7/2007 1:05 PM: I would have assumed that you use your dev server to test your code...no? I just also assumed i knew what was meant and didn't focus too much on the exact terminology, but rather the intent of the statement. Again, I may very well be assuming too much, since that's two assumptions on the same sentence =) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sammy Larbi Sent: Wednesday, February 07, 2007 8:05 PM To: cfcdev@cfczone.org Subject: Re: [CFCDEV] RE: DW vs Eclipse RADEMAKERS Tanguy wrote, On 2/7/2007 12:41 PM: the downside to this approach is that you have to check in a change before being able to see it on your dev server. Plus this means you will have lots of non-working checkins in svn. /t I would have assumed that you'd be testing before checking in the code. But, I may have been assuming wrong. You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] DW? Eclipse?
I'm a big CFEclipse fan. DW started getting slow and having problems with my file system, for reasons unbeknownst to me. I was never a huge fan of it anyway (though I did like it better at first than CF Studio 4.5). I like CF Eclipse now. I haven't studied it enough to have any concrete reasons, it just feels better to me. Jim Cassata wrote: Hi, Just wondering what people coding CF are using, Dreamweaver?, CFEclipse?, and why. I like DW, have been using it for the last few years. As I venture into Flex territory, Adobe has seen fit to introduce me to Eclipse. I am interested in your opinions on IDEs in the CF world. Thanks, Jim Cassata You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] How many objects is too many?
Hi Jaime, Funny enough, I posted about this a little while back at http://www.codeodor.com/index.cfm/2007/1/15/More-classes-in-other-languages-than-in-CF/877. I discussed more from the point of view of having fewer classes, and thought that I may be subconciously writing bad code for two possible reasons (well, I didn't re-read the post for this, but this is what I think I said): 1) I may be concerned in the back of my head about the overhead 2) It may be just some bad habits in CF, as I tend to have many more objects in Java (for instance) -Sammy Larbi Jaime Metcher wrote: Hi, When you're modelling your application, how much attention do you pay to minimizing the number of objects instantiated? Obviously CF has a higher object creation overhead than some other languages. OTOH, the gist of much OO practice (and many patterns) is to create lots of fine grained objects. I often read that a typical noob error is creating too few objects with too many responsibilities. So, how often do you find yourself thinking well, in Java or Smalltalk I'd do xyz, but in CF I'd better not because I'd end up with too many objects? Which is another way of asking to what extent we need to modify existing OO practices to allow for CF's limitations. A couple of points of reference: 1. This post was prompted by a discussion with Mark Mandel on the transferdev list. I'd spotted an issue purely because of the massive slowdown that occurred when 700 objects were inadvertently created. That issue has been resolved, but it left me wondering, if I can't instantiate 700 objects how many can I create? 10? 50? This has huge implications for how we architect our apps. 2. I have a Dolphin Smalltalk image that, from a fresh install, reports instantiating 160,000 objects. Obviously with an object system this slick you don't worry much about throwing in a few hundred more. Given that CF's comfort zone is probably a couple of orders of magnitude lower, maybe a lot of the standard advice on OO design just doesn't apply to CF? Any thoughts appreciated. Jaime Metcher You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Closures, mixins, and udf includes
4. Multiple Inheritance - A person can be an engineer and a husband and any other number of things. How can you have this functionality unless you are putting a bunch of methods in the Person class that don't really belong. Jaime Metcher wrote: I can think of three rationales for mixins: 1. To make dynamically defined helper methods available to clients of the original object. This can't be done by simple delegation - you have to know about a method before you can delegate it, and the mixin might not be known until runtime. 2. Where the methods are known but not always wanted, like debugging hooks. You might have a debugging factory method that mixes debugging methods into all your objects, where the production factory method does not. 3. Where you really could handle it with delegation but are too lazy to write all the delegation methods. I think it's this last one you're expressing a dislike for. In general I would agree with you. Oh, I just noticed you were looking for replies from smart experienced folks. Oh, well, too late now...;) Jaime Metcher -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Barry Beattie Sent: Thursday, 1 February 2007 2:58 PM To: cfcdev@cfczone.org Subject: Re: [CFCDEV] Closures, mixins, and udf includes more like objA = CreateObject(component, A).init(application.kernel.getHelper()); cfcomponent name=A cffunction name=init cfargument name=helper type=any hint=helper routines in a CFC to decorate this CFC / cfset variables.helper = arguments.helper / cfreturn this / /cffunction /cfcomponent (actually for smaller jobs I've just been passing a reference to the kernel into the CFC and running the getHelper() within there, since most of the time the CFC actually decorates the kernel - think of it as a reference back to the parent) What hassle? two things I don't like about includes (within CFC's) are: managing the include files in conjunction with CFC. in a case of an include for each SQL statement where there's 50 of them that's 51 files to move around. documentation: comming across a helper method and asking WTF is this and where did it come from? instead of cfreturn variables.helper.doSomething(result) / and additionally, seeing what helper.doSomething() is in the CFC explorer. Perhaps I've been burnt by Fusebox 3 bad practices? I realise that everyone has their favourite mousetrap. I just prefer to have methods (even static ones) within CFC's. Infact the only time I bother now-a-days with cfinclude is for taglibs for the UI. different strokes, etc. cheers b You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] To Type or Not To Type?
Hi Ryan, I'm not a huge fan of typing my arguments and return types, so I'll get that out of the way and you can take the rest of this with that in mind. 1) There isn't really a parallel that I can think of in the Java world. Basically, any external libraries are built with your code, so there aren't really any mappings to speak of in that regard. 2) I'm not in the habit of providing absolute paths when I do type my arguments, and as you've pointed out, it isn't a good idea at least in that regard. I'll just provide foo as the return type. Not sure how that works in very complicated directory structures, but at least within each component, it will work. It is one of the problems I had with how CFUnit relied within itself all the way down from the org package. -Sam Ryan Guill wrote, On 1/29/2007 12:07 PM: Hey guys, I'm working on designing a new project, and in thinking through some of it I came across this. Sorry if this is a newbie question, but just thought I would get some reactions. When typing objects in cf, the typing depends on how the objects were created, not on the actual path to the objects (physical path). For instance, say I create an object called foo in the {application root}/com/ directory, so {root}/com/foo.cfc and I give it an init call like so: cffunction name=init access=public returntype=com.foo cfreturn This / /cffunction Okay, so now I go to a new page somewhere and I create an obect out of the component like so: cfset variables.foo = createObject(component,com.foo).init() / All good right? The return type says com.foo, the create object uses com.foo and everything works fine. Okay, now lets say I make a new mapping in cf to the com directory, called com_mapping. So now I try to create an object out of the cfc using the following code: cfset variables.fooWithMapping = createObject(component,com_mapping.foo).init() / An error is thrown, because the path to the cfc that you are using the create the object is not exactly the same as the type specified in the returntype of the init... Since foo is still accessible using com.foo, and that is the actual path to the cfc, shouldn't it still work? If you change it to returntype=any both calls work, but you loose that type checking. Now, I know all about duck typing and the possible performance concerns of typing, but at the end of the day, the typing was intended to be used like this, and this seems a little illogical? I don't have a java background and don't know if this issue would translate well to the java world, but I would be interested in seeing if there was some sort of correlation. For an example of why this matters, imagine that you had multiple releases of the same application, myApp v1 and myApp v2 that you wanted to have both available at the same time on the same server. So for example: {domain}/myApp/v1/ and {domain}/myhApp/v2/ The same code base except v2 is just a newer copy with some new features right? Well lets say the application uses an external resources such as some sort of framework. Lets say for example its transfer. So v1 of the application uses v0.5 of transfer, and v2 of the application uses v0.6 of transfer. If transfer uses typing in its objects (I really have no idea, ive never used transfer, this is just an example) then you can't just use a new mapping to get to the new version in v2 from v1. Sorry for the long email, just curious if anyone has ran into this and possible workarounds... because if the framework uses typing in its objects (this would also apply to inheritance of objects I would think) then its not really an option to go through and change return types to any everywhere... You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Spam on the list
Raymond Camden wrote, On 1/9/2007 6:22 AM: As far as I know SmarterMail does not support that option, but I agree it would be a good idea. I think Rob said he was going to look into CAPTHA and a forms based subscribe option. If so we can try that route. A good alternative would be Jake Munson's CF Form Protect (at http://cfformprotect.riaforge.org/). I've been using it for one of our clients, and it has worked well for the past month or so. However, I must note that I haven't actually been checking the false-positives, just noticed there isn't spam coming through. -Sam I see a new spam this morning and I'm honestly surprised. I was worried I had made the spam checker _too_ tight last night. On 1/9/07, Tom Chiverton [EMAIL PROTECTED] wrote: On Tuesday 09 January 2007 05:17, Sammy Larbi wrote: What about a semi-moderated system, where people's posts only go to the list once they have been approved (but not every post- just the first). This works well on FlexCoders. Turning of the subscribe by email option and having a CAPCHA for web based sign up are both good options as well. -- Tom Chiverton Helping to administratively strategize attention-grabbing developments This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at St James's Court Brown Street Manchester M2 2JF. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law Society. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 8008. For more information about Halliwells LLP visit www.halliwells.com. You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] TDD for ColdFusion
Jeff Chastain wrote, On 12/21/2006 5:57 PM: There is always a need for both unit and integration testing, I just don't like mixing them. Part of test driven development as I understand it is to write the test for the object, then develop the object. I'm not sure if you meant this or not, but for clarity's sake, I'll describe it more like write a test, then make that test pass. The way I read what you said above, it sounded like write all the tests, then write the class. How do you do this if you first have to write the dependent objects? You don't first have to write the dependent objects. When you find yourself in need of one, then you create it. But you don't write the whole thing. Just stub the method you think you need and have it return what you are expecting - no real code. When you need real code, you write the test for it first, as you always would. There is a reason for the popularity of the mock and stub frameworks in other languages ... it makes testing more precise. It can do that, yes. But, I'm not sure if that is why they are popular. Several thought leaders in the Agile movement, as far as I've been able to ascertain, either don't use them as extensively as some people do (ie, perhaps they'll only mock database calls so the tests can still run fast, or interaction with the file system, for similar reasons), or promote them for use in projects that are are already well established and have no tests. I haven't seen anyone recommend them just for testing without dependencies. You still are depending on the mock, after all. Yes, you may never run into problems with a dependent object breaking the object you are testing, but I don't really see that as a reason to allow the possibility. If it did happen, you could have a long dependency chain, part of which you might not be able to test (the event object in Mach-II for example) and debugging would be as difficult as it would be without unit tests. I'm not familiar with Mach-II, but I would have thought long dependency chains are not generally advisable. And I'm certainly no expert on that, so I could well be wrong. I can't remember a time when I've had more than 4 or 5 in a chain though. In either case, it is important to note that if they would be there without the mocks, they will be there with the mocks too. And still further, if you had been doing what I attempted to describe, all of it would be under test (that I can see - but I may certainly have not explained it well enough, or I could be missing something). The same cannot be said if you are only using mocks, however. Can you provide an example, to help me see it? I have just seen a lot more posts recently about unit tests and TDD, but I have not seen any examples short of very simple objects with no dependencies. Do you have an example you'd like to see in mind? I sat here thinking of one for a couple of minutes, but I didn't find one in my head. But, perhaps I can think of one later, if you don't have one in mind. -Sam You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Session Facade / Scopes in CFCs -- was Two Quick Questions About CFCs
Peter Bell wrote, On 12/21/2006 5:16 PM: As for Q2, stick the data into a session variable. The biggest question is what should stick the data into the session variable. The view doesn't as it displays state - it doesn't change it (by recording within the session what this person has viewed). Then ask whether if you were using Flex front end you'd want this to still work. If so, it can't go in your (HTML specific) controller, so put it in your model. I like that you've thought about uses in different front ends. It's something I know I should consider, but don't do so as often as I should. It IS OK for your model to be session aware as long as you distinguish the different uses of session state (on my list of things to blog about) and allow the appropriate uses to be handled by model and controller respectively. I think it could be OK. Well, I'm not sure that information is appropriate in a model, but I think it could be ok for a CFC to be session aware. In particular, I can see it would be inappropriate for a CFC to be relying on a session variable it doesn't create itself, or for code outside a CFC to rely on a session variable created within (a different) one, but for the case that it creates and uses it itself, I don't see any immediate drawback. You MAY want to use a session façade as it will help if you ever change the way you implement session state, but the debate as to whether to use scope facades is still open - Doug Hughes posted about this some time back on his blog. If you don't know what a session façade is, just stick this in the model to start with and you can always refactor to a session façade down the line. If you get the big architectural choices right upfront, tweaking the smaller ones down the line is a good approach to avoid overthinking things. You might also have some method setVarInStruct(var, struct), but I'm not sure what advantages or disadvantages that may provide. On the other hand, I don't immediately see what benefit using a facade may provide above the drawbacks I mentioned of using sessions in CFCs directly. I'm fairly sure there are some, so I wanted to ask you all. Well, I could see that it can handle the case a variable doesn't exist for you, so that is a nice thing... but what else? -Sam You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] TDD for ColdFusion
Oh that's sweet. I didn't know version 2 was out now. I'll be using that for my db calls now for sure. -Sam Kurt Wiersma wrote, On 12/21/2006 6:12 PM: Robert Blackburn developer of cfUnit has a nice post about a mock object testing setup he created. http://rbdev.net/devblog/index.php?entry=entry061128-130441 http://rbdev.net/devblog/index.php?entry=entry061128-130441 --Kurt On 12/21/06, *Jeff Chastain* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: There is always a need for both unit and integration testing, I just don't like mixing them. Part of test driven development as I understand it is to write the test for the object, then develop the object. How do you do this if you first have to write the dependent objects? There is a reason for the popularity of the mock and stub frameworks in other languages ... it makes testing more precise. Yes, you may never run into problems with a dependent object breaking the object you are testing, but I don't really see that as a reason to allow the possibility. If it did happen, you could have a long dependency chain, part of which you might not be able to test (the event object in Mach-II for example) and debugging would be as difficult as it would be without unit tests. I have just seen a lot more posts recently about unit tests and TDD, but I have not seen any examples short of very simple objects with no dependencies. Thanks. -Original Message- From: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED]] On Behalf Of Sammy Larbi Sent: Thursday, December 21, 2006 5:47 PM To: cfcdev@cfczone.org mailto:cfcdev@cfczone.org Subject: Re: [CFCDEV] TDD for ColdFusion Jeff D. Chastain wrote, On 12/21/2006 4:00 PM: This is a cross-post with CF-Talk, but I figured this list is a bit more cfc oriented. I am really trying to get into test driven development as the benefits are fairly obvious after having done development any other way. However, in terms of doing this with ColdFusion, I am either not getting it or there is a lot of talk going on regarding TDD, but not much in actual practice. My biggest issue comes with object dependencies. Ideally, your objects are as loosely coupled as possible, but it is simply not possible to have an application full of completely disjoint objects with no dependencies at all. One of the premises of unit testing though is to test only the functionality of one individual object or unit and not test all of its dependencies. Other languages appear to handle this with mock objects which allow for simulating and testing any object dependencies. Of course, you could directly test those too. However, the mock object frameworks for Java and other languages simply don't port to ColdFusion because of language construct differences. Without a mock object framework, the only other option I see is to hand create and maintain stub or mock objects, and this just does not seem like a feasible practice in an application of any size. A while back, I thought of attempting to develop a mock object framework for CF (or better put, I thought about thinking about it). But, as I explain below, I haven't seen much use for one in my own development, so I've pretty much dropped the idea. So, how do you test ColdFusion objects when there are dependencies involved? I haven't yet found myself in need of a true mock. In cases where I'm testing class A which does have a dependency B, I go ahead and create the stubs in B as I need them, and let that class grow into the real thing over time, as needed. I don't think there's anything wrong with integration tests - in fact, we need those too. In the cases where I have needed unit tests (in the proper sense of the term), I might then go ahead and hand create class C, which is basically a mock that extends B. It's not really a mock (well, we had a huge discussion about this on the TDD list a couple of months ago), but it serves the purpose of basically truly isolating A. In any case, I don't find that need happening often. Further, I haven't noticed that I've ever gotten into trouble when something in B breaks the tests for A - it's normally pretty obvious, even if it doesn't break the tests for B. In fact, I've often had more trouble with my fake mocks than with my integration tests. Of course, this phenomenon is not unique to me in Coldfusion. I've also experienced it in Java. Ron Jeffries talked about never (or very rarely) needing to use a proper mock as well. Does that make any sense? -Sam
Re: [CFCDEV] TDD for ColdFusion
I don't know how Robert did it, but I can see how it might be done. 1) instantiate an object of the type passed in to your init method 2) write a temp cfc that extends it. inject your own methods into that cfc. 3) instantiate the temp cfc and return it in your init method 3) overwrite the inherited methods as needed Robert may have a more elegant way than writing to a temp file, but none of mine seemed to work (for instance, in the past I've made parents become their children based on expectations of the user, but that only works if the child already extends the parent.) I could also see injecting your own methods into the object, along with some blank functions as pointers... perhaps using closures when the user overrides a function (which would probably need to be done in the first one anyway)... but even that would require writing to a temp file. -Sam Peter Bell wrote, On 12/21/2006 9:29 PM: I haven't made the TDD jump yet (top resolution for next year - that and FitNess for integration testing), but I'm having a hard time understanding how you'd do unit testing WITHOUT some kind of mock object. BTW, have you blogged about HOW you implemented the mock object? I'd love to get an idea of the approach you used (I WILL download the source code and figure it out, but was wondering if you'd give the lazy part of me a hint first!). Best Wishes, Peter On 12/21/06 10:17 PM, Robert Blackburn [EMAIL PROTECTED] wrote: Thanks for the reference to my post Kurt :o) I just responded to Jeff's CF-Talk post, but I figured I would follow up here too. The mock object is still a rather new feature of CFUnit (only available in the v2.0 beta). And I must admit at first I was not sure how frequently mock objects might be used in CF unit testing. But since launching this I have been using it a lot in my own work. And it has been a real boon to the stability and quality of my tests. On 12/21/06, Kurt Wiersma [EMAIL PROTECTED] wrote: Robert Blackburn developer of cfUnit has a nice post about a mock object testing setup he created. http://rbdev.net/devblog/index.php?entry=entry061128-130441 --Kurt You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] TDD for ColdFusion
Thanks for that. Martin got across the points I was trying to make (plus many more) much better than I could have. Paul Kenney wrote, On 12/22/2006 1:31 AM: Whenever I see someone talking about the need for mocks when unit testsing, this essay by Martin Fowler comes to mind: http://www.martinfowler.com/articles/mocksArentStubs.html http://www.martinfowler.com/articles/mocksArentStubs.html Read it and then ask yourself if its really mocks you need. Paul On 12/21/06, *Jeff D. Chastain* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: This is a cross-post with CF-Talk, but I figured this list is a bit more cfc oriented. I am really trying to get into test driven development as the benefits are fairly obvious after having done development any other way. However, in terms of doing this with ColdFusion, I am either not getting it or there is a lot of talk going on regarding TDD, but not much in actual practice. My biggest issue comes with object dependencies. Ideally, your objects are as loosely coupled as possible, but it is simply not possible to have an application full of completely disjoint objects with no dependencies at all. One of the premises of unit testing though is to test only the functionality of one individual object or unit and not test all of its dependencies. Other languages appear to handle this with mock objects which allow for simulating and testing any object dependencies. However, the mock object frameworks for Java and other languages simply don't port to ColdFusion because of language construct differences. Without a mock object framework, the only other option I see is to hand create and maintain stub or mock objects, and this just does not seem like a feasible practice in an application of any size. So, how do you test ColdFusion objects when there are dependencies involved? Thanks. You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com http://www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org http://www.mail-archive.com/cfcdev@cfczone.org -- Paul Kenney [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] http://www.pjk.us You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Two Quick Questions About CFCs
I would ask/add? if we really need all that for this one example. As soon as the second one popped up, I'd start considering it, but I might follow YAGNI until then... unless I was already using ColdSpring or Lightwire, of course. -Sam Peter Bell wrote, On 12/21/2006 8:45 PM: Agreed 100%. I mentioned that in passing, but if you're still getting up to speed with service layers and DAO's, throwing in AOP as well could be confusing. I agree it is the ideal approach as this sounds like the text book logging cross cutting concern which is used as the example for AOP everywhere. I just pointed out that you could initially put the call to the logging object in your service methods and then refactor it into advice once you got a little more comfortable with OO and CS and all of the other joys of OOP in CF! Best Wishes, Peter On 12/21/06 9:15 PM, Barry Beattie [EMAIL PROTECTED] wrote: considering the counter is a by-product of the getting of the record, wouldn't this be a suitable candidate for AOP? (in this case coldspring) I'm just throwing up the counter is much like a logging process and the getting (and processing) of data might not need direct cluttering with other concerns? just a thought b On 12/22/06, Aaron Roberson [EMAIL PROTECTED] wrote: On 12/21/06, Peter Bell [EMAIL PROTECTED] wrote: Hi Aaron, To take a slightly different tack: Q1: - You don't want to track this in view as responsibility of view is to display state - not to change it (by recording an updated number of views) - If you ever added an AJAX or Flex or web service front end, would you want to keep track of number of those views as well? If so (which would make sense for most use cases) you want to add this to your model - not your (HTML specific) controller. - As to where to put this in the controller, I'd put it into your service objects (or managers if that is what you call them). Why? Well, some time you might add caching so you don't always return to the db, so the DAO/Gateway is probably the wrong place, but you always have to ask the UserService to get a list of users or ProductService to get a list of products, so add the code there. Thank you for filling in some more of the details. Because the counter would have to increment the value of a field in the db record, it seems odd to put this in the service layer however. What do you think about Sammy's suggestion of having two methods - one for views which increments the counter and one for edit forms which does not increment? As for Q2, I am going to have to take a look at Doug Hughes stuff and come back to it, I am at a complete loss not knowing anything about Facades. -Aaron You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] TDD for ColdFusion
Jeff D. Chastain wrote, On 12/22/2006 9:39 AM: Yes, what I thought I said was that test drive development was to write the test the object you are working on before you create that object. The problem comes in when that object then depends upon another object, etc. etc. Jeff, that is indeed what you said. But, if I hear someone say that, I think they are writing the entire suite of tests first, then creating the class to pass those tests. I didn't think you meant that, but I had only wanted to clarify for anyone who may be reading this and misunderstand you, as I might have. -Sam You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] TDD for ColdFusion
Jeff D. Chastain wrote, On 12/22/2006 9:39 AM: Sam, Yes, what I thought I said was that test drive development was to write the test the object you are working on before you create that object. The problem comes in when that object then depends upon another object, etc. etc. If you check out the Martin Fowler link that Paul posted earlier, it discusses very well two possible testing approaches ... state based and interaction base. State based testing tests the entire depenendcy tree in one test. Interaction based testing focuses only on testing the specific object and its functionality. As stated in Wikipedia, unit testing really follows Fowler's definition of interacton based testing. I read it and I guess I'd consider myself more of a state based tester than interaction based. I have used stubs on occasion, and like he mentions (and as did I), there are typically few of them, so no need for mocks if you prefer to test that way. This is the way I would prefer to test as I can quickly pin point exactly where an issue is rather than having a dozen tests fail with different errors because one object they all depened upon had an issue. That's fine. I was simply telling the story of how I practice TDD. If you prefer to use mocks, I certainly have no problem with that! =) I also said I've yet to run into the potential problems you described (and apparently, a lot of people don't, otherwise I would assume everyone would be recommending interaction based testing all the time). But, also a lot of people prefer to use mocks. There are smart people on both sides of the isle so to speak. I haven't found that I often get a lot of tests failing because of one object they depend on being broken. I have had it happen, of course, but even when it does, I've never run into a problem figuring out who was the culprit. But, I've only been doing this for just under a year, and even if I had been doing it 10 years, I'd still think that other people have different experiences and I'd recommend they use the style that they find the most benefit in. Mock objects (and stub objects) fit into the interaction based testing model in that they allow you to stub out the interface of the dependent object, making the assumption that it works as it should and therefore focusing your testing on the single object at hand. Mock objects take a stub object one step further and allow you to perform additional assertions as to whether the depend object's interface is being utilized correctly ... in other words, if function X was called 3 times, was passed a single integer, and function Y was not called at all. Yes, and now that I see Robert Blackburn has introduced mocks into CFUnit, I will be using them for stubs on my db calls for objects that use others who access the database. But, I expect I'll still be using state based testing, as like Martin Fowler said in that article, Personally I've always been a state-based tester and thus far I don't see any reason to change. I don't see any compelling benefits for interaction based testing, and am concerned about the consequences of coupling tests to implementation. I also suffer from the disadvantage of not trying interaction based testing on anything more than toys. However, unlike him, I can see some compelling benefits, at least for some cases that I would have liked to know how many times I've called methodX(). Though, I expect he is pragmatic and would use them if he found the need - I think he probably just meant something more like not enough compelling benefits or something of the sort. Testing objects and their dependencies in a real world scenario is not a bad thing at all. In fact, it is called integration testing. I just want to perform unit testing seperately from integration testing so that when something crops up in my integration tests, I know that the individual objects are doing what they are supposed to. I thought I mentioned that it was called integration testing. In any case, I had meant to. But, I don't think it's useful in the development scenario to focus on what to call your tests, so I may very well have left it out. My apologies if I was confusing, or didn't get my idea across well. =) -Sam -- Jeff Jeff Chastain wrote, On 12/21/2006 5:57 PM: There is always a need for both unit and integration testing, I just don't like mixing them. Part of test driven development as I understand it is to write the test for the object, then develop the object. I'm not sure if you meant this or not, but for clarity's sake, I'll describe it more like write a test, then make that test pass. The way I read what you said above, it sounded like write all the tests, then write the class. How do you do this if you first have to write the dependent objects? You don't first have to write the dependent
Re: [CFCDEV] TDD for ColdFusion
Peter Bell wrote, On 12/22/2006 9:43 AM: Hi Sammy, Just got to jump in on a point here . . . I'm not familiar with Mach-II, but I would have thought long dependency chains are not generally advisable. And I'm certainly no expert on that, so I could well be wrong. I can't remember a time when I've had more than 4 or 5 in a chain though. In either case, it is important to note that if they would be there without the mocks, they will be there with the mocks too. And still further, if you had been doing what I attempted to describe, all of it would be under test (that I can see - but I may certainly have not explained it well enough, or I could be missing something). The same cannot be said if you are only using mocks, however. Lets imagine that ObjA calls ObjB calls ObjC calls ObjD (not best practice, but it does happen sometimes with complex models and interactions). If you mock ObjB then ObjA calls MockB which (if I get mocks right) just stubs out and responds as appropriate to calls from ObjA. If you don't do this you aren't really doing unit testing because you're doing a functional test on ObjA, ObjB, ObjC AND ObjD when you run your unit test on Obj A and all of them have to work right for the test to pass so your ObjA test ISN'T testing the single unit of ObjA but it's entire dependency chain. I have very little sense of unit testing in practice yet, so let me know if I'm missing anything here! :- No, Peter... you are exactly right. I thought I mentioned it *wouldn't* be *unit* testing in my first post, but I'm guessing I didn't now that I've got 2 people explaining it to me =). But, you did help me see that I was wrong when I said In either case, it is important to note that if they would be there without the mocks, they will be therewith the mocks too. I had originally intended that to mean the chain will be there in the real code with the mocks, and it will be in the test code with the mocks as well. But, I didn't think it through enough. Clearly, the chain wouldn't be in the mocks/test, it would only be in the real code. In any case, the chain of four or five that I was referring to was something along the lines of a view calling a controller which called a model which called another class that was a facade to java.sql (to create connections and statements) which also used another facade to the record set returned. Something like that anyway. You might take it a step further and say the chain ended with the classes in the sql package, and whatever they relied on. -Sam You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Session Facade / Scopes in CFCs -- was Two Quick Questions About CFCs
Peter Bell wrote, On 12/22/2006 10:14 AM: Hi Sam, Main benefit I've heard is if you want to change the way you handle sessions in general - otherwise scope facades have limited utility. What do you mean by change the way you handle sessions in general? As in, change all that data to be stored in a cookie, or something? -Sam Best Wishes, Peter You might also have some method setVarInStruct(var, struct), but I'm not sure what advantages or disadvantages that may provide. On the other hand, I don't immediately see what benefit using a facade may provide above the drawbacks I mentioned of using sessions in CFCs directly. I'm fairly sure there are some, so I wanted to ask you all. Well, I could see that it can handle the case a variable doesn't exist for you, so that is a nice thing... but what else? You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Session Facade / Scopes in CFCs -- was Two Quick Questions About CFCs
Teddy Payne wrote, On 12/22/2006 10:30 AM: I use them to remove a shared scope from my CFCs. If I wanted to change where variables are stored, I can just change the facade and my controller never changes. That makes sense. Thanks. Teddy On 12/22/06, *Peter Bell* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi Sam, Main benefit I've heard is if you want to change the way you handle sessions in general - otherwise scope facades have limited utility. Best Wishes, Peter You might also have some method setVarInStruct(var, struct), but I'm not sure what advantages or disadvantages that may provide. On the other hand, I don't immediately see what benefit using a facade may provide above the drawbacks I mentioned of using sessions in CFCs directly. I'm fairly sure there are some, so I wanted to ask you all. Well, I could see that it can handle the case a variable doesn't exist for you, so that is a nice thing... but what else? You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com http://www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org http://www.mail-archive.com/cfcdev@cfczone.org -- cf_payne / Adobe Certified ColdFusion MX 7 Developer Atlanta CFUG (ACFUG): http://www.acfug.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] TDD for ColdFusion
Thanks Jeff. I had thought you were simply asking about dependencies in TDD. I enjoyed the discussion anyway, and learned a thing or two, so thanks to you, as well as everyone else who participated. -Sam Jeff D. Chastain wrote, On 12/22/2006 11:40 AM: Sam - All of your points are valid. This is another one of those areas where there is not a black and white, right vs. wrong answer. As long as the app goes out the door, on time, on budget, and meets the specs, it does not matter a tremendous amount what happened in between. Unless you happen to be the next person that gets to tweak the code. My main question in all of this was that the strict defniniton of unit testing is to test an object without all of its dependencies. Mock and stub objects seem to be the way to do that in other languages, but there had been very little discussion about doing this in ColdFusion (at least that I have seen). So, I wanted to see if and how people developed unit tests in ColdFusion. Thanks. Jeff D. Chastain wrote, On 12/22/2006 9:39 AM: Sam, Yes, what I thought I said was that test drive development was to write the test the object you are working on before you create that object. The problem comes in when that object then depends upon another object, etc. etc. If you check out the Martin Fowler link that Paul posted earlier, it discusses very well two possible testing approaches ... state based and interaction base. State based testing tests the entire depenendcy tree in one test. Interaction based testing focuses only on testing the specific object and its functionality. As stated in Wikipedia, unit testing really follows Fowler's definition of interacton based testing. I read it and I guess I'd consider myself more of a state based tester than interaction based. I have used stubs on occasion, and like he mentions (and as did I), there are typically few of them, so no need for mocks if you prefer to test that way. This is the way I would prefer to test as I can quickly pin point exactly where an issue is rather than having a dozen tests fail with different errors because one object they all depened upon had an issue. That's fine. I was simply telling the story of how I practice TDD. If you prefer to use mocks, I certainly have no problem with that! =) I also said I've yet to run into the potential problems you described (and apparently, a lot of people don't, otherwise I would assume everyone would be recommending interaction based testing all the time). But, also a lot of people prefer to use mocks. There are smart people on both sides of the isle so to speak. I haven't found that I often get a lot of tests failing because of one object they depend on being broken. I have had it happen, of course, but even when it does, I've never run into a problem figuring out who was the culprit. But, I've only been doing this for just under a year, and even if I had been doing it 10 years, I'd still think that other people have different experiences and I'd recommend they use the style that they find the most benefit in. Mock objects (and stub objects) fit into the interaction based testing model in that they allow you to stub out the interface of the dependent object, making the assumption that it works as it should and therefore focusing your testing on the single object at hand. Mock objects take a stub object one step further and allow you to perform additional assertions as to whether the depend object's interface is being utilized correctly ... in other words, if function X was called 3 times, was passed a single integer, and function Y was not called at all. Yes, and now that I see Robert Blackburn has introduced mocks into CFUnit, I will be using them for stubs on my db calls for objects that use others who access the database. But, I expect I'll still be using state based testing, as like Martin Fowler said in that article, Personally I've always been a state-based tester and thus far I don't see any reason to change. I don't see any compelling benefits for interaction based testing, and am concerned about the consequences of coupling tests to implementation. I also suffer from the disadvantage of not trying interaction based testing on anything more than toys. However, unlike him, I can see some compelling benefits, at least for some cases that I would have liked to know how many times I've called methodX(). Though, I expect he is pragmatic and would use them if he found the need - I think he probably just meant something more like not enough compelling benefits or something of the sort. Testing objects and their dependencies in a real world scenario is not a bad thing at all. In fact, it is called integration testing. I just want to perform unit testing seperately from integration testing so that when something crops up in my integration tests, I know that the individual objects
Re: [CFCDEV] TDD for ColdFusion
Jeff D. Chastain wrote, On 12/21/2006 4:00 PM: This is a cross-post with CF-Talk, but I figured this list is a bit more cfc oriented. I am really trying to get into test driven development as the benefits are fairly obvious after having done development any other way. However, in terms of doing this with ColdFusion, I am either not getting it or there is a lot of talk going on regarding TDD, but not much in actual practice. My biggest issue comes with object dependencies. Ideally, your objects are as loosely coupled as possible, but it is simply not possible to have an application full of completely disjoint objects with no dependencies at all. One of the premises of unit testing though is to test only the functionality of one individual object or unit and not test all of its dependencies. Other languages appear to handle this with mock objects which allow for simulating and testing any object dependencies. Of course, you could directly test those too. However, the mock object frameworks for Java and other languages simply don't port to ColdFusion because of language construct differences. Without a mock object framework, the only other option I see is to hand create and maintain stub or mock objects, and this just does not seem like a feasible practice in an application of any size. A while back, I thought of attempting to develop a mock object framework for CF (or better put, I thought about thinking about it). But, as I explain below, I haven't seen much use for one in my own development, so I've pretty much dropped the idea. So, how do you test ColdFusion objects when there are dependencies involved? I haven't yet found myself in need of a true mock. In cases where I'm testing class A which does have a dependency B, I go ahead and create the stubs in B as I need them, and let that class grow into the real thing over time, as needed. I don't think there's anything wrong with integration tests - in fact, we need those too. In the cases where I have needed unit tests (in the proper sense of the term), I might then go ahead and hand create class C, which is basically a mock that extends B. It's not really a mock (well, we had a huge discussion about this on the TDD list a couple of months ago), but it serves the purpose of basically truly isolating A. In any case, I don't find that need happening often. Further, I haven't noticed that I've ever gotten into trouble when something in B breaks the tests for A - it's normally pretty obvious, even if it doesn't break the tests for B. In fact, I've often had more trouble with my fake mocks than with my integration tests. Of course, this phenomenon is not unique to me in Coldfusion. I've also experienced it in Java. Ron Jeffries talked about never (or very rarely) needing to use a proper mock as well. Does that make any sense? -Sam You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Two Quick Questions About CFCs
Aaron Roberson wrote, On 12/21/2006 4:18 PM: FIRST Q: My current application tracks who many times an individual record is viewed by incrementing a value each time it is queried. How would I do this in a MVC app, given that an individual record could be queried for display in a view or for editing in a form? I might have a method say like this (with appropriate syntax and arguments you need -- this is just a shell): function getRecordForEdit() { ...get the record ... return record; } function getRecordForView() { record = getRecordForEdit(); increment the number of times viewed return record } Though, I'm sure there are better ways... that is just what immediately comes to mind. SECOND Q: How do I track what records a user has viewed during a session (such as a product - like how Amazon displays items you have viewed)? I'd probably just use an array of structures stored in the session... At least that seems like the most straightforward way. -Sam You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Spam on the list
I haven't noticed enough to make me annoyed or anything. But, my filters in Thunderbird may be reducing it, for all I know. -Sam Lyons, Larry wrote, On 12/18/2006 6:35 AM: There has been a lot of spam coming through the list lately. Any chance it can be reduced Ray? The way its been increasing you may want to change the name of the list to CFCSpam soon. larry -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Roland Collins Sent: Monday, December 18, 2006 2:04 AM To: cfcdev@cfczone.org Subject: RE: [CFCDEV] PROPOSAL GET BACK TOME Oo.I want 12MM Ray - you know you want to split this with me, and I'm offering this to you as a last chance. If you don't take him up on this, I will :-P RC You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Spam on the list
Well, I must say I did get that one. But, I've long deleted it... Tom Chiverton wrote, On 12/18/2006 8:49 AM: On Monday 18 December 2006 14:10, Lyons, Larry wrote: I've received a number of spam messages from CFCDEV, the most recent was RE: [CFCDEV] PROPOSAL GET BACK TOME. Its not a huge number, maybe 5 or 6 Didn't make it through whatever filters I have here, sorry. Are you sure it came from the list, and didn't just appear to ? Can you post the headers ? You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Does a CFC know what variable name it's stored within?
Interestingly, Per Djurner and I were talking about that very issue just yesterday. His solution, which I thought was awesomely creative, was to throw an error, find the line number of your cfset, read the file, and find the variable name. Well, something basically like that, except we were talking about function names. However, it would still work with variables, since the concept is the same. Now, we both realize we'd like to see a better solution, but it works for the time being (unless of course, you are trying to distinguish between more than 1 on the same line). -Sam Ed Griffiths wrote, On 12/8/2006 8:40 AM: Hi Quick question. If you store an object in a variable like this: cfset myObject = createObject(component,testObject).init() Is it possible to interrogate some method or metadata associated with testObject in order to find out what variable name it has been stored within (myObject in this case)? Thanks for your help, Ed You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Does a CFC know what variable name it's stored within?
I should also note that I haven't looked deep into a meta-data solution, so it would be worth exploring those structures (which I plan to do sometime soon) -Sam Ed Griffiths wrote, On 12/8/2006 8:40 AM: Hi Quick question. If you store an object in a variable like this: cfset myObject = createObject(component,testObject).init() Is it possible to interrogate some method or metadata associated with testObject in order to find out what variable name it has been stored within (myObject in this case)? Thanks for your help, Ed You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Does a CFC know what variable name it's stored within?
One other note - we were not talking about function names themselves, but pointers to functions. Such as: cfset newfunction = oldfunction Sammy Larbi wrote, On 12/8/2006 9:25 AM: Interestingly, Per Djurner and I were talking about that very issue just yesterday. His solution, which I thought was awesomely creative, was to throw an error, find the line number of your cfset, read the file, and find the variable name. Well, something basically like that, except we were talking about function names. However, it would still work with variables, since the concept is the same. Now, we both realize we'd like to see a better solution, but it works for the time being (unless of course, you are trying to distinguish between more than 1 on the same line). -Sam Ed Griffiths wrote, On 12/8/2006 8:40 AM: Hi Quick question. If you store an object in a variable like this: cfset myObject = createObject(component,testObject).init() Is it possible to interrogate some method or metadata associated with testObject in order to find out what variable name it has been stored within (myObject in this case)? Thanks for your help, Ed You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Does a CFC know what variable name it's stored within?
Well, in the case Per and I were talking about, we wanted the method names generated by the cfc, and the programmer only to use those names. But I guess if you work in Java a lot, you're used to having to tell it a million times what to do... so you could look at: function_i_want_to_call(parameters to function it references, function_i_want_to_call) where the last parameter is also part of the function being pointed to as being similar to Class obj = new Class(); It's a bit retarded that way, so ideally I'd like to stay away from it if possible. -Sam Ryan Guill wrote, On 12/8/2006 9:55 AM: Why not just pass the variable name into the constructor when creating the object and let the object hold on to it? On 12/8/06, Sammy Larbi [EMAIL PROTECTED] wrote: One other note - we were not talking about function names themselves, but pointers to functions. Such as: cfset newfunction = oldfunction Sammy Larbi wrote, On 12/8/2006 9:25 AM: Interestingly, Per Djurner and I were talking about that very issue just yesterday. His solution, which I thought was awesomely creative, was to throw an error, find the line number of your cfset, read the file, and find the variable name. Well, something basically like that, except we were talking about function names. However, it would still work with variables, since the concept is the same. Now, we both realize we'd like to see a better solution, but it works for the time being (unless of course, you are trying to distinguish between more than 1 on the same line). -Sam Ed Griffiths wrote, On 12/8/2006 8:40 AM: Hi Quick question. If you store an object in a variable like this: cfset myObject = createObject(component,testObject).init() Is it possible to interrogate some method or metadata associated with testObject in order to find out what variable name it has been stored within (myObject in this case)? Thanks for your help, Ed You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Does a CFC know what variable name it's stored within?
Actually, this is quite a bit easier that I thought. This function will output the names of all the variables (I think) that reference your component, given a scope. I got the idea for inserting a UUID from looking at cfcUnit, so I gotta give credit there. Of course, it will need to be in your component. cffunction name=getTheNameOfTheVariableThatContainsMe output=true cfargument name=variablesScope required=true cfset this.testkey = createUUID() cfloop list=#structkeylist(variablesScope)# index=name cfif isStruct(variablesScope[name]) and structKeyExists(variablesScope[name],testKey) and variablesScope[name].testKey eq this.testKey #name#, /cfif /cfloop cfset structDelete(this,testKey) /cffunction Ed Griffiths wrote, On 12/8/2006 8:40 AM: Hi Quick question. If you store an object in a variable like this: cfset myObject = createObject(component,testObject).init() Is it possible to interrogate some method or metadata associated with testObject in order to find out what variable name it has been stored within (myObject in this case)? Thanks for your help, Ed You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Does a CFC know what variable name it's stored within?
As a caveat, I don't think it will get outside variables in the variables scope unless you call it from outside the cfc, of course. But, you may find a neat way around that. Sammy Larbi wrote, On 12/8/2006 11:31 AM: Actually, this is quite a bit easier that I thought. This function will output the names of all the variables (I think) that reference your component, given a scope. I got the idea for inserting a UUID from looking at cfcUnit, so I gotta give credit there. Of course, it will need to be in your component. cffunction name=getTheNameOfTheVariableThatContainsMe output=true cfargument name=variablesScope required=true cfset this.testkey = createUUID() cfloop list=#structkeylist(variablesScope)# index=name cfif isStruct(variablesScope[name]) and structKeyExists(variablesScope[name],testKey) and variablesScope[name].testKey eq this.testKey #name#, /cfif /cfloop cfset structDelete(this,testKey) /cffunction Ed Griffiths wrote, On 12/8/2006 8:40 AM: Hi Quick question. If you store an object in a variable like this: cfset myObject = createObject(component,testObject).init() Is it possible to interrogate some method or metadata associated with testObject in order to find out what variable name it has been stored within (myObject in this case)? Thanks for your help, Ed You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Does a CFC know what variable name it's stored within?
For me, it was academic. When some one has a tough problem that I can't see immediately how to find an answer to, I like to find an answer. That compulsion gets stronger as the number of this can't be done replies increase. =) I can't answer for Ed as to what his need is, however. But I can say that the use Per and I were discussing was trying to evaluate dynamically what a function should do based on its name. -Sam Teddy Payne wrote, On 12/8/2006 11:35 AM: Now, this looks academic. What would be the use of knowing the name of variable that stores the memory location of the object's invocation? Teddy On 12/8/06, *Sammy Larbi* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Actually, this is quite a bit easier that I thought. This function will output the names of all the variables (I think) that reference your component, given a scope. I got the idea for inserting a UUID from looking at cfcUnit, so I gotta give credit there. Of course, it will need to be in your component. cffunction name=getTheNameOfTheVariableThatContainsMe output=true cfargument name=variablesScope required=true cfset this.testkey = createUUID() cfloop list=#structkeylist(variablesScope)# index=name cfif isStruct(variablesScope[name]) and structKeyExists(variablesScope[name],testKey) and variablesScope[name].testKey eq this.testKey #name#, /cfif /cfloop cfset structDelete(this,testKey) /cffunction Ed Griffiths wrote, On 12/8/2006 8:40 AM: Hi Quick question. If you store an object in a variable like this: cfset myObject = createObject(component,testObject).init() Is it possible to interrogate some method or metadata associated with testObject in order to find out what variable name it has been stored within (myObject in this case)? Thanks for your help, Ed You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com http://www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org http://www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com http://www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org http://www.mail-archive.com/cfcdev@cfczone.org -- cf_payne / Adobe Certified ColdFusion MX 7 Developer Atlanta CFUG (ACFUG): http://www.acfug.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Config.cfc is released and available for download
Peter (and all), I'm probably a bit jaded, since I've spent the last 3 months on a Java project, where XML config is the norm. But, as I see it, the benefits you've mentioned for XML config files, while certainly valid, are not something you can have only with XML. I've written up about it, and may write in more detail later. A lot of that is re-introducing the issue, for anyone who may not be familiar (probably 1/2 of it)... If prodded, I may go more in depth on why I don't think those benefits are exclusive to XML. I neglected to mention any benefits I see exclusive to programmatic config files, except the glaringly obvious it's not XML, unless you're using CFML (which I didn't even mention outright.) Part of that is that I haven't looked deep enough to find if there are any benefits exclusive to programmatic config files. Anyway, feedback is always welcomed and appreciated... it can help me flush out my own ideas, and most importantly well help me (well, all of us really) learn. But, I have to say, don't think I'm saying anything new here: http://www.codeodor.com/index.cfm/2006/11/30/Re-Should-you-use-XML-for-your-config-files/849 Peter Bell wrote, On 11/26/2006 2:48 PM: Hi Sam, Looking forward to your thoughts when you have the time to respond. Truth is I don't like XML, so I'm looking for any excuse not to use it, but I also want to be intellectually honest and highlight all of the benefits that XML provides so hopefully I'll make the best decision for my use case rather than just following my prejudices! Best Wishes, Peter On 11/26/06 8:36 AM, Sammy Larbi [EMAIL PROTECTED] wrote: Peter, You make some good points. I plan to read those articles within the next couple of weeks and write up a response if I'm still not completely convinced. Its just that right now, because the semester is coming to a close, I can't give it the time/attention a good response deserves. I hope you'll excuse the delay =). -Sam Peter Bell wrote, On 11/25/2006 10:44 AM: Hi Sam, There are a few reasons. And what was going to be an email turned into a posting! Here are my latest thoughts on XML for configuration. http://www.pbell.com/index.cfm/2006/11/25/Should-you-use-XML-for-your-config uration-files Best Wishes, Peter On 11/25/06 9:07 AM, Sammy Larbi [EMAIL PROTECTED] wrote: Jim, Don't take this the wrong way, as it is a genuine question, but when I read it, it sound sort of heckling. It is not meant to be, so forgive me if it sounds that way to you. When and why would I want to use this? In particular, why is it better than say cfinclude template=config.cfm where config.cfm sets all my variables? Thanks, Sam jim collins wrote, On 11/24/2006 6:39 PM: What is config.cfc? Config.cfc allows application and session variables in a ColdFusion application to be set from an XML file. Config.cfc is available for download at http://code.google.com/p/configcfc/ For subversion users the link is: http://configcfc.googlecode.com/svn/trunk/ A big THANK YOU to Nic Tunney for his help, code review, and creating the Application.cfc example. You rock dude. You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Config.cfc is released and available for download
Peter Bell wrote, On 11/30/2006 2:19 PM: I do agree about storing the data in a db which is how I handle ALL of my metadata, but if I required everyone to load up a metabase just to use LightBase, it'd never be used. Of course, that would be silly =). But, it's not bad to consider as an optional feature. Given that I'm generating the files, it matters less to me whether they are validated or not as I can validate metadata pre-generation, but I still like the self validating benefits of the XML files with DTD enough to use them as a best practice. Now, when you say self validating ... Might you explain what all it validates? I'm having trouble understanding what benefits that provides above the programmatic variety. I would agree that there are many projects where an XML file would be overkill, but I don't feel on balance that they do any substantial harm and for my use case (a framework) they are worth the extra trouble. FWIW, my conversion came when I actually started USING the programmatic config for LightWire. There were cases where I was getting funky errors and a DTD (and a little additional CF validation) would have helped. I'd love to try and use both versions, if you have them available, to get a better understanding of what you mean. As I mentioned in the post, lately all my configuration has been pretty simple - so I can easily be overlooking something. But even where I need categories (as I think Joe Rinehart called them, or perhaps sections), I still find it easier to do something like: db.dsn = datasource; db.username =sam; db.password = password; app.title_background_color = ##69; app.title_text_color = white; and so forth, as an example, rather than the equivalent XML. But, I could see how that might get troublesome for beans without some care as to the aesthetic structure of the file (I mean, don't be intertwining arrays with different indexes) ... but I'd still prefer to look at, and try to figure out what's going on in a file that looked like that (you know, but still had say, the arrays indexed properly and in order in the file) , as opposed to the XML. You're right about the unit tests, but I'm not sure whether they replace the benefits of the DTD or extend them. Will play with that and let you know! You know, I thought about that as well. But, I don't know enough about DTDs to make the observation. I'm fairly sure I could write a simple one, based on my little experience and recollection, but I can't even tell you what good they are, except to verify the syntax of your own little DSL, as you mentioned. Best Wishes, Peter On 11/30/06 2:24 PM, Sammy Larbi [EMAIL PROTECTED] wrote: Peter (and all), I'm probably a bit jaded, since I've spent the last 3 months on a Java project, where XML config is the norm. But, as I see it, the benefits you've mentioned for XML config files, while certainly valid, are not something you can have only with XML. I've written up about it, and may write in more detail later. A lot of that is re-introducing the issue, for anyone who may not be familiar (probably 1/2 of it)... If prodded, I may go more in depth on why I don't think those benefits are exclusive to XML. I neglected to mention any benefits I see exclusive to programmatic config files, except the glaringly obvious it's not XML, unless you're using CFML (which I didn't even mention outright.) Part of that is that I haven't looked deep enough to find if there are any benefits exclusive to programmatic config files. Anyway, feedback is always welcomed and appreciated... it can help me flush out my own ideas, and most importantly well help me (well, all of us really) learn. But, I have to say, don't think I'm saying anything new here: http://www.codeodor.com/index.cfm/2006/11/30/Re-Should-you-use-XML-for-your-co nfig-files/849 Peter Bell wrote, On 11/26/2006 2:48 PM: Hi Sam, Looking forward to your thoughts when you have the time to respond. Truth is I don't like XML, so I'm looking for any excuse not to use it, but I also want to be intellectually honest and highlight all of the benefits that XML provides so hopefully I'll make the best decision for my use case rather than just following my prejudices! Best Wishes, Peter On 11/26/06 8:36 AM, Sammy Larbi [EMAIL PROTECTED] wrote: Peter, You make some good points. I plan to read those articles within the next couple of weeks and write up a response if I'm still not completely convinced. Its just that right now, because the semester is coming to a close, I can't give it the time/attention a good response deserves. I hope you'll excuse the delay =). -Sam Peter Bell wrote, On 11/25/2006 10:44 AM: Hi Sam, There are a few reasons. And what was going to be an email turned into a posting! Here are my latest thoughts on XML for configuration. http://www.pbell.com/index.cfm/2006/11/25/Should-you-use-XML
Re: [CFCDEV] Config.cfc is released and available for download
Peter, You make some good points. I plan to read those articles within the next couple of weeks and write up a response if I'm still not completely convinced. Its just that right now, because the semester is coming to a close, I can't give it the time/attention a good response deserves. I hope you'll excuse the delay =). -Sam Peter Bell wrote, On 11/25/2006 10:44 AM: Hi Sam, There are a few reasons. And what was going to be an email turned into a posting! Here are my latest thoughts on XML for configuration. http://www.pbell.com/index.cfm/2006/11/25/Should-you-use-XML-for-your-config uration-files Best Wishes, Peter On 11/25/06 9:07 AM, Sammy Larbi [EMAIL PROTECTED] wrote: Jim, Don't take this the wrong way, as it is a genuine question, but when I read it, it sound sort of heckling. It is not meant to be, so forgive me if it sounds that way to you. When and why would I want to use this? In particular, why is it better than say cfinclude template=config.cfm where config.cfm sets all my variables? Thanks, Sam jim collins wrote, On 11/24/2006 6:39 PM: What is config.cfc? Config.cfc allows application and session variables in a ColdFusion application to be set from an XML file. Config.cfc is available for download at http://code.google.com/p/configcfc/ For subversion users the link is: http://configcfc.googlecode.com/svn/trunk/ A big THANK YOU to Nic Tunney for his help, code review, and creating the Application.cfc example. You rock dude. You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
Re: [CFCDEV] Config.cfc is released and available for download
Jim, Don't take this the wrong way, as it is a genuine question, but when I read it, it sound sort of heckling. It is not meant to be, so forgive me if it sounds that way to you. When and why would I want to use this? In particular, why is it better than say cfinclude template=config.cfm where config.cfm sets all my variables? Thanks, Sam jim collins wrote, On 11/24/2006 6:39 PM: What is config.cfc? Config.cfc allows application and session variables in a ColdFusion application to be set from an XML file. Config.cfc is available for download at http://code.google.com/p/configcfc/ For subversion users the link is: http://configcfc.googlecode.com/svn/trunk/ A big THANK YOU to Nic Tunney for his help, code review, and creating the Application.cfc example. You rock dude. You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org