Archive for Februar, 2009

26
Feb

Flex’ mx_internal_uid considered harmful

Actually, not that harmful. But you should be aware of a special meaning of this Flex object property. Here’s the story:

Today, I tried to develop a method the create shallow and deep copies of objects. Finally, I prepared this method, initially without the line marked with __MARK__:

static private function clone( source:Object, deep:Boolean = false ):Object
  {
    if ( null == source ) {
    return null;
    }
    var copy:Object;
    if ( true == deep ) {
       copy =  ObjectUtil.copy( source );
    } else {
      copy = new Object();
      for( var key:Object in source ) {
        if (  ( 'mx_internal_uid' != key ) ) {     // __MARK__
          copy[ key ] = source[ key ];
        }
     }
  }
  return copy;
} // clone

Without the line marked by __MARK__, the method copies (more or less raw) objects, but the dataProvider-driven controls gets in trouble: List-based control add each managed object a ‘mx_internal_uid‘ to identify each data object. Thus, if you copy the ‘mx_internal_uid’ property, e.g. a DataGrid will no longer be able to distinguish the original source object or the clone(source) object.

Thus, it’s appropriate to not copy ‘mx_internal_uid‘ from source to clone.

18
Feb

InfoQ article compares Blaze DS and LCDS

In case you are interested in figuring out details of Blaze DS and LCDS or you need to compare both solution, have a look at this InfoQ article: http://www.infoq.com/news/2009/02/Blaze-LiveCycle