Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought

Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Show Posts

* | |

  Show Posts
Pages: [1]
1  PureMVC Manifold / Standard Version / Thread safety? on: August 01, 2008, 05:13:14
Shouldn't the maps (commandMap, proxyMap, mediatorMap, observerMap!!! ) be threadsafe?
So wouldn't it be better to use java.util.concurrent.ConcurrentHashMap instead of java.util.Hashtable?
2  Announcements and General Discussion / General Discussion / Re: AS3: Why are all maps used by PureMVC Arrays (commandMap, proxyMap etc.) ? on: June 02, 2008, 07:38:25
I don't know if i get the point.
Of course there can be trouble if reserved words are used.
But that's the case for both arrays and objects.

If you instanciate an object in this JASON-like fashion:
var obj = {this:'that'};there will of course be problems.

But in this JASON-like fashion it is not even possible to instanciate Arrays with key value pairs.
An Array would look like this and would be numerical anyway.
var arr = ['this', 'that'];
But the following will work in both cases:
var obj = new Object();
var arr = new Array();
obj['this'] = 'that';
arr['this'] = 'that';
trace(obj['this'], arr['this']);
Although it still remains a bad idea to use reserved words, it will work with both, Arrays and Objects.
And that's exactly the way PureMVC makes use of the Maps.

So for me there is actually no point for using Arrays instead of Objects.
Using Arrays is not really worse than using Objects, but it's also not better.
There is only a difference from a logical standpoint, as i mentioned above.

But as i said, this is only a very marginal issue and nothing of big worth compared to the benefits of PureMVC.
So, even if i don't really understand why you prefer Arrays, the simple notion that you do should suffice in the end.
And i will use this framework anyway, even with Arrays :) !!
3  Announcements and General Discussion / General Discussion / Re: AS3: Why are all maps used by PureMVC Arrays (commandMap, proxyMap etc.) ? on: June 01, 2008, 01:48:40
I would bet that Array builds upon Object in the VM and they share exactly the same functionality concerning their functionality as maps. So i won't believe to detect performance differences in any case. You could even use any other class and declare it dynamic.

My issue was something different.
When talking about PureMVC, we are talking about design patterns.
The aim of design patterns is to provide the most simple and most logical way possible to structure a given complex task.
So my thought was, that the framework implementation itself should also use the most simple and logical structures.
Of course 'if it aint broke don't fix it.', but it won't break in either case.
I just thought it would fit in better from a logical standpoint.

But hey, it was just a proposal and in the end has no effect on the functionality and performance of PureMVC.
So of course there is no need to change it at all.
4  Announcements and General Discussion / General Discussion / Re: AS3: Why are all maps used by PureMVC Arrays (commandMap, proxyMap etc.) ? on: May 31, 2008, 12:32:30
That's true. This is also an AS3 implementation of a map.
But it also provides functionality, i.e. not used by PureMVC.

The Dictionary class...
... lets you create a dynamic collection of properties, which uses strict equality (===) for key comparison

So if you need to use objects as keys for your map, the Dictionary class would be the right choice.
But as PureMVC maps use simple Strings as keys, the Object class would be the right choice.
5  Announcements and General Discussion / General Discussion / AS3: Why are all maps used by PureMVC Arrays (commandMap, proxyMap etc.) ? on: May 28, 2008, 05:50:15
Can anyone explain to me why commandMap (in Command.as), proxyMap (in Model.as) and mediatorMap & observerMap (in View.as) are all Arrays, even if their variable names accurately describe them as Maps?
e.g. commandMap = new Array();

Arrays in ActionScript are numerical and not associative.

And the ActionScript reference states:
Do not use the Array class to create associative arrays (also called hashes), which are data structures that contain named elements instead of numbered elements. To create associative arrays, use the Object class. Although ActionScript permits you to create associative arrays using the Array class, you cannot use any of the Array class methods or properties with associative arrays.

Therefore i would propose to change them into Objects.
This is not a performance or functionality issue, but as everything in PureMVC builds upon logic, this seems very logical to me.
Using Arrays will add functionality to the Maps, that is never used.
Pages: [1]