incubator-flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Wasilewski <>
Subject Re: FalconJS has landed
Date Tue, 27 Nov 2012 18:23:42 GMT

If you don't care about memory consumption, output file size, long 
prototype chain, inheritance, slow downs on bigger structures than 1 
plain objects... use it.
Again, not saying let's prefer or favour one of the method over another, 
those things keeps changing over the time.
This test just 2 years ago would be a different picture.

All I am saying is to have ability to control he output of grammar of 
JS. I know my English is not perfect but that's my only point i am 
trying to make.
If you feel it's endless... sorry. It wasn't my intention to make it long.
But rather invite to constructive discussion. It is easy to say NO to 
solution I think doesn't suits me without giving any reason.

I would like to hear about pros of module pattern myself. Prove me 
wrong, I will shout up :)
I am not JS expert. But let's not make design decisions based on the 
latests trends, but technical reasoning.


On 11/27/2012 4:38 PM, Erik de Bruin wrote:
> Dan,
> This is my last comment on the subject, as I foresee another endless
> discussion, but:
> Closure (Module Pattern) outperforms any other 'style' at least 2 to 1
> on the test you quote, yet you recommend that we don't use it?
> EdB
> On Tue, Nov 27, 2012 at 5:22 PM, Daniel Wasilewski <> wrote:
>> I'll try to help Alex :)
>> But he may correct me if I am wrong.
>> I believe this little test will show full picture and all 4 common styles of
>> JS programming we are talking about here.
>> Notice there is nothing about inheritance, just plain objects (classes)
>> Once inheritance is involved things are slowing down with different ratios.
>> Current proposed style of JS output is Object Literal (red bar in that
>> test);
>> Prototype (green bar) in plain object test seems to be 2nd solution
>> outperformed by closure (blue bar) these days.
>> But when inheritance is involved blue bar is getting shorter and prototype
>> is catching up.
>> Prototype pattern has also less footprint, since you adding 1 shared
>> behaviour to your object that will be reused wherever possible instead
>> creating brand new object.
>> There is no surprise why Closure style runs very well on web kit based
>> browsers since Google promoting this style and making optimisation just for
>> it.
>> FireFox trying to catch up, but Safari seems to do well both.
>> Here is a little example of inheritance done with prototype pattern
>> var Class = function(){}; //empty function to avoid invocation during
>> Function.prototype.extend = function(C){
>>    Class.prototype = C.prototype;
>>    this.prototype = new Class();
>>    this.prototype.constructor = this;
>>    return this.prototype
>> };
>> now you can easily do this:
>> function EventDispatcher(){}
>> p = EventDispatcher.prototype;
>> function DisplayObject(){
>>; //equivalent of super
>> }
>> p = DisplayObject.extend(EventDispatcher);
>> THis is obviously simplified form of what is really needed but it is good
>> enough to cover lots of aspects already.
>> Don't want to repeat what has been already sent here as examples, but
>> simplicity and speed of this solution will outperform anything in
>> real-project-use-case-scenario.
>> Dan
>> On 11/27/2012 8:06 AM, Erik de Bruin wrote:
>>> Alex,
>>> You keep referring to a "prototype". I might be missing something.
>>> Where can I find it/how do I run it?
>>> EdB
>>> On Mon, Nov 26, 2012 at 10:32 PM, Alex Harui <> wrote:

View raw message