Category: dev

Topics loosely related to development and development environment.


Dictionary vs Object

Recently I was wondering about different between using Object and Dictionary. One of the biggest pros about using Dictionary is possibility to use weak reference in key. This mechanism do not create an obstacles during Garbage Collection. Important fact is that weak references is quite expensive for collecting process, there is impact on overhead.

I have crated some test to show differences between Objects and Dictionaries.

 
0 Kudos
Don't
move!

Fun Fun Fun with Array and Vectors conversion

One of the most important benefit of using vectors is performance, and ability to fixing memory.

Arrays are better in:

  • copying whole structure (Array to Array, using slice())
  • as a source to create typed Vector (using statement: Vector.<T>(sourceArray))

Vectors are better in:

  • iteration over collection by index
  • more familiar in IDE (auto-complete syntax of generic)

But what is the range of those benefits and how write program to see the difference?

 
0 Kudos
Don't
move!

Abstract class in ActionScript

There is a shame that we have to emulate Abstractions or virtual members. In most cases we can use Interfaces to define some required structure. Of course this is useful to valid composition.

When we would like to set composition over inheritable that will goes to use some tricks.  We can image situation in normal implementation:

public interface IFactory
{
	function create(description:Object):Object;
}
 
0 Kudos
Don't
move!

Flash main loop

Flash is platform like another one, but specific is that we have a quarantined loop cycle.

Ramka

 

That means if we set 30 FPS in our app/game that in the best way we achieve exactly 30FPS (or less in some cases), and each next ENTER_FRAME broadcast event will be dispatched in next 33,(3)ms. Rest of this time will be spend in idle mode. 

 
1 Kudos
Don't
move!