Mark,

Yes I can see your point here, and knowing Taco and by his emails and of
course by the way I code as well. And yes Java does typecast.

Private String Firstname;
Public String Lastname;

Means that I can't do this

Int var = 100;
Employer emp = new Employer();
Emp.Firstname = var;

But I could do this in both Java and .Net

Int var = 100;
Employer emp = new Employer();
Emp.Firstname = String.valueOf(var);

Which would convert it to a string!!!

Hungry or should that be hunagarian?

Anyway I said it would be good for Taco to use what he thought would best
fit his framework, because I know he would do something like this:-)

<cfset com.strFirstName = "" />
<cfset com.intAge = 100 />

 
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 Mark M
Sent: Tuesday, 29 June 2004 11:30 AM
To: CFAussie Mailing List
Subject: [cfaussie] RE: this

Andrew - 

I do agree with you to an extent - 

However because CF isn't typed, you have FAR less control over what can be
set on those properties.
(Although I've seen properties in .NET where you have fine control, but I've
never seen them in Java... 
maybe I missed that one).

In fact the only way to (sorta) retain some control over type is through
<cfargument> on your getter and setters.

So yes you CAN use them as properties, but I don't think you should because
it's too easy to set a struct to be a string that way (I've done that back
in the day I use 'this' scope... and it took ages to track down).

Just my thoughts.

Mark
------------------------------------------------------------------
E: [EMAIL PROTECTED]
W: www.compoundtheory.com
ICQ: 3094740


Quoting Andrew Scott <[EMAIL PROTECTED]>:

> 
> I so laugh at this statement
> 
> And I quote
> 
> "Although putting data in the this scope is perfectly valid and will 
> not cause any errors, it generally isn't seen as a good idea. The main 
> reason being that you lose the ability to tightly control that data 
> from within the CFC, so breaking the encapsulation. That leads to 
> increased overhead when you try to maintain the code, because you 
> can't just look at what's happening inside the CFC before making 
> changes. You have to also look at where it is used and how it is used 
> to make sure none of the data in the this scope is being added, modified
or removed by external code."
> 
> Then if you treat them as properties, then what is your problem:-)
> 
> This is how OOP works in Java and .Net and should be the way 
> developers treat them in coldfusion! As properties, then you would 
> know that there is an external influence. Even if you had a get/set 
> method then you would have the same problem, treat them as properties and
you will not go wrong.
> 
> Taco if your reading this, I suggest reading on how classes are used 
> in Java and follow there guides on how they do it and apply these 
> rules to your framework and what best suits you.
> 
>  
> 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
> 
> 
> 
> ---
> 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/




---
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/

Reply via email to