RE: [flexcoders] Doubts about static keyword

2005-10-24 Thread Matt Chotin










An object that is declared static goes on
the class object instead of on the instance object. In general there is only
one copy of the class object in memory so a variable declared there will save
you some space. So if you are talking about things like constants a static
variable is a good thing to use. A function on the other hand generally does
not take so much memory that you get a lot of benefit out of it being static. So
if the function is truly a utility, fine, make it static, but dont try
to go optimizing code by changing functions on a class into statics, you wont
see much benefit.



Matt











From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Pradeep Chaudhary
Sent: Friday, October 21, 2005
1:35 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Doubts about
static keyword





Can anybody please explain me how the static keyword works in Flex. As
per my understanding staic variable or a method is
created in memory
just once and is shared after that.
If i create a static method in a Actionscript
class, is it actually
created just once in memory?.
Is it similar to _javascript_ functions which are
created on loading of the page?

Does having static methods really save memory
usage.

Thanks in advance.

Pradeep








--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





  




  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  











Re: [flexcoders] Doubts about static keyword

2005-10-24 Thread Aldo Bucchi
aloha,

there are some other issues associated to using static members that
you should take into account.
Personally, I only use static members for constants.

take a look at this short description

http://www.simonwacker.com/blog/archives/cat_flash.php#method_scope_per_class

best,
aldo

On 10/24/05, Matt Chotin [EMAIL PROTECTED] wrote:



 An object that is declared static goes on the class object instead of on the
 instance object.  In general there is only one copy of the class object in
 memory so a variable declared there will save you some space.  So if you are
 talking about things like constants a static variable is a good thing to
 use.  A function on the other hand generally does not take so much memory
 that you get a lot of benefit out of it being static.  So if the function is
 truly a utility, fine, make it static, but don't try to go optimizing code
 by changing functions on a class into statics, you won't see much benefit.



 Matt



  


 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of Pradeep Chaudhary
  Sent: Friday, October 21, 2005 1:35 AM
  To: flexcoders@yahoogroups.com
  Subject: [flexcoders] Doubts about static keyword



 Can anybody please explain me how the static keyword works in Flex. As
  per my understanding staic variable or a method is created in memory
  just once and is shared after that.
  If i create a static method in a Actionscript class, is it actually
  created just once in memory?.
  Is it similar to javascript functions which are created on loading of the
 page?

  Does having static methods really save memory usage.

  Thanks in advance.

  Pradeep



  --
  Flexcoders Mailing List
  FAQ:
 http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
  Search Archives:
 http://www.mail-archive.com/flexcoders%40yahoogroups.com



  
  YAHOO! GROUPS LINKS


  Visit your group flexcoders on the web.

  To unsubscribe from this group, send an email to:
  [EMAIL PROTECTED]

  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

  





--
: Aldo Bucchi :
mobile (56) 8 429 8300


 Yahoo! Groups Sponsor ~-- 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/nhFolB/TM
~- 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/