Best practice is to use class instances over objects because of changes 
made in the new VM that runs AS3 code.  In AS2, it didn't matter, but 
AS3 handles class instances differently.

Typed objects have properties accessed by an offset (say, the 
"firstName" property is at the object location + 5 bytes away), whereas 
generic objects use hashtables to store and retrieve properties.  Use 
class instances as much as possible to take advantage of the faster 
execution speed possible with AS3.

Also, using typed objects gives you help from the compiler (code 
hinting, errors when spelling a property wrong, etc).

It's not "bad" to use generic objects, and in a dynamic language they 
can make some things easier to code.. but, I'd say it's better to use 
class instances when you know what the object is going to look like.

-d

dorkie dork from dorktown wrote:
>
> It seems I never see anyone using objects anymore. Is there any
> advantage to me creating property holding classes like this where I
> could use objects? What if no other class will ever use my value
> object?
>

Reply via email to