Firstly,
Pull your head in snapper-head, I and Sean aren't attacking you, if i were i'd prefix my reply with "you stupid monkey".
Secondly,
We are *trying* to illustrate a flaw in how a simple procedure like the one you outlined can go wrong.
If you want to use the "this" scope, and you feel it rox your world, then hell do it. In fact if you want to store your shopping cart order in an application scope, because you feel the word "application" is much prettier then the word "session" then DO IT.
BUT...
When the time comes, and it will eventually, when someone *ELSE* uses your application, sees a public property and notices there aren't any setters/getters around to manipulate data in that property, decides "..oh its time i added a value to that..", inputs the wrong data and suddenly an application isn't working and you spend the next hour or so debuging as to why...
I'll hold up my big banner that says "We told you so.." - You've asked the question as to why the "this" scope sux in CFMX, yet you still persist in wanting to campaign to us and others as to how wrong we are so that your point of view dominates. Simple fact is, its wrong, and its wrong for the main single purpose in that its public property. Not all people have access to your source code or look inside a CFC, sometimes its quite possible they will see an object in its "metadata" form and go take that as face value - and its quite ok to assume that if you see a public property on an object that maybe it has some kind of transparent server-side validation going on.
As i have illustrated before it would be *nice* if coldfusion could use its own public function get myVariable() {} type approach, but it doesn't and so you have to wear the fact that CFMX is cumbersome when it comes to public property and type casting.
I'll call you on that challenge by the way.. in that lets have a pepsi challenge on why its a good idea to use the "this" scope with Coldfusion MX.
:)
Scott.
Andrew Scott wrote:
Sean,
If Macromedia wishes to use that as a standard that is fine, then macromedia should then remove that scope from existence!
My point and I think you missed it, I chose to look at execution times as
well like I said it is a very complicated framework.
And if you have a company standard that is good, but lets say you had a job opening and I came along and applied but choose to see execution time as a bigger benefit would I not get hired because I don't see your full point?
Now to claim that Macromedia DON'T use the this scope is a very big statement I know you can not back up. In either Coldfsuion or your Java programming I bet if I looked hard enough I could show you thousands of examples where you do!
Coldfusion maybe not, it is very spaghetti code to start with. But Java I think I could without evening trying!
Regards
Andrew Scott
Technical Consultant
NuSphere Pty Ltd Level 2/33 Bank Street South Melbourne, Victoria, 3205
Phone: 03 9686 0485 - Fax: 03 9699 7976
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sean Corfield Sent: Thursday, 1 July 2004 7:38 AM To: CFAussie Mailing List Subject: [cfaussie] RE: this
On Thu, 1 Jul 2004 07:19:18 +1000, Andrew Scott <[EMAIL PROTECTED]> wrote:
Ok maybe this example would be better for you
Nope.
I don't need to do encapsulation here, and again this one of many examples in our framework were I don't need to worry about it... My choice not yours,
And here we agree. It is *your* choice. And it is my choice to recommend folks don't use "this" scope under any circumstances. You missed a point I made earlier even tho' you actually confirm it here:
Like I said I understand the risks and the dangers and it is all taking into consideration when I design my component.
*You* may understand but a newbie won't necessarily. And newbies tend to see code and just run with it. If there is a sense that "this" scope is 'good', newbies will program that way and then be very confused when everyone starts telling them their code is crap. All I'm trying to do is ensure that folks see "this" scope as a very rare exception.
And if you were writing code in Macromedia, you wouldn't be using "this" scope even in the examples you gave - you'd add get/set methods and use "variables" scope. And that's our choice :)
Pretty much every coding standard for every OO language prohibits the use of public data members - to preserve encapsulation - a term that any newbie going anywhere near OO needs to learn and understand.
--- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/
--- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/
