Flex Associative Arrays

Never put much thought into it, but it strikes me tonight that OO writers like to use concrete objects. Argue if you will that they’re more maintainable, or the debugger is easier using them, but sometimes they’re just boiler plate if you don’t need a fully developed object.

I mention all this because I’m looking over the LCDS documentation on Publisher objects and they reference that associative arrays are used for AsyncMessage.headers parameters. No sense throwing a Dictionary object or an array of dynamic objects with key and value fully labeled in there to overkill the array. Rather, keep it simple.

var message:AsyncMessage = new AsyncMessage();
                message.headers = new Array();
                message.headers["prop1"] = 5;
                message.body = input.text;
                producer.send(message);

Short. Sweet. To the point. Value doesn’t need to be labeled ‘value’. Brings me back to the Java days. I like it.

One thought on “Flex Associative Arrays

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s