Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jul 04 19:02

    RIAEvangelist on master

    ignoring coverage for language … (compare)

  • Jul 04 02:07
    RIAEvangelist commented #2
  • Jul 03 15:05
    abhyuday-tripathi commented #2
  • Jul 03 04:26
    rishabhkeshan commented #2
  • Jul 02 20:56
    RIAEvangelist commented #2
  • Jul 02 17:59
    gems2000 commented #2
  • Jul 02 17:56
    bucharitesh commented #2
  • Jul 02 15:37
    RIAEvangelist commented #120
  • Jul 02 15:34
    RIAEvangelist commented #118
  • Jul 02 15:34
    RIAEvangelist commented #118
  • Jul 02 15:33
    RIAEvangelist commented #120
  • Jul 02 14:50
    RIAEvangelist commented #2
  • Jun 23 23:21
    RIAEvangelist commented #2
  • Jun 23 11:56
    rishabhkeshan commented #2
  • Jun 18 22:09
    RIAEvangelist commented #2
  • Jun 18 22:08
    RIAEvangelist commented #2
  • Jun 18 21:46
    bucharitesh commented #2
  • May 30 14:50
    mattcroat edited #120
  • May 30 14:46
    mattcroat opened #120
  • May 26 14:17
    madelinecameron commented #114
Brandon Nozaki Miller
@RIAEvangelist
Thern again, that's just my experience.
I havent looked at the pricing yet, only Address incase you were working on any of the others.
Once Harmony is officially supported should be easy to port over to the new ECMA Script 6 Class too
Brandon Nozaki Miller
@RIAEvangelist
Also gives control over enumerable methods etc. for lik for in loops Object.keys etc.
Brandon Nozaki Miller
@RIAEvangelist
Also, I was thinking maybe we should make the delivery method a var instead of always needing to pass a string. What do you think? This way users don't have to worry about capitalization etc? not sure if it makes a difference though.
Brandon Nozaki Miller
@RIAEvangelist

was curious about performance so I ran a test. Seems that over thousands of iterations the Object.define is always just slightly faster, like so minimally it may as well be no difference slightly.

console.time('prototype');
var objects=[];

var MyClass=function(paramaters){
    this.ID=paramaters.ID
}

MyClass.prototype.getInfo=function(callback) {
    if( !this.ID || !callback){
        if(callback)
            callback(
                {
                    success: false,
                    message: 'A callback is required to get store info'
                }
            );
        return;
    }
    callback(
        {
            success: true,
            message: this.ID
        }
    );
}

for(var i=0;i<2000;i++){
    objects.push(new MyClass({ID:i+1}));
    var current=objects[objects.length-1];
    for(var j=0; j<5000; j++){
        current.getInfo(
            function(data){
                if(!data.success){console.log(data)}
            }
        )
    }
}

objects=[];

console.timeEnd('prototype');

//case sensitive differences

console.time('class');
var oBjects=[];

function Myclass(paramaters){
    Object.defineProperties(
        this,
        {
            ID:{
                value:paramaters.ID
            },
            getInfo:{
                value:getInfo
            }
        }
    );

    function getInfo(callback){
        if( !this.ID || !callback){
            if(callback)
                callback(
                    {
                        success: false,
                        message: 'A callback is required to get store info'
                    }
                );
            return;
        }
        callback(
            {
                success: true,
                message: this.ID
            }
        ); 
    }
}

for(var i=0;i<2000;i++){
    oBjects.push(new Myclass({ID:i+1}));
    var current=oBjects[oBjects.length-1];
    for(var j=0; j<5000; j++){
        current.getInfo(
            function(data){
                if(!data.success){console.log(data)}
            }
        )
    }
}

oBjects=[];

console.timeEnd('class');

I ran it several times to check.

VM122:43 prototype: 7084.202ms
VM122:97 class: 6936.807ms

VM123:43 prototype: 7205.583ms
VM123:97 class: 7152.946ms

VM125:43 prototype: 7193.067ms
VM125:97 class: 7158.549ms

VM127:43 prototype: 7342.147ms
VM127:97 class: 7233.754ms

VM126:42 prototype: 7185.525ms
VM126:96 class: 7164.016ms

When I removed the calls to methods, and ONLY initialized the Class and prototype, prototype was faster.

console.time('prototype');
var objects=[];

var MyClass=function(paramaters){
    this.ID=paramaters.ID
}

MyClass.prototype.getInfo=function(callback) {
    if( !this.ID || !callback){
        if(callback)
            callback(
                {
                    success: false,
                    message: 'A callback is required to get store info'
                }
            );
        return;
    }
    callback(
        {
            success: true,
            message: this.ID
        }
    );
}

for(var i=0;i<2000;i++){
    objects.push(new MyClass({ID:i+1}));

}

objects=[];

console.timeEnd('prototype');

//case sensitive differences

console.time('class');
var oBjects=[];

function Myclass(paramaters){
    Object.defineProperties(
        this,
        {
            ID:{
                value:paramaters.ID
            },
            getInfo:{
                value:getInfo
            }
        }
    );

    function getInfo(callback){
        if( !this.ID || !callback){
            if(callback)
                callback(
                    {
                        success: false,
                        message: 'A callback is required to get store info'
                    }
                );
            return;
        }
        callback(
            {
                success: true,
                message: this.ID
            }
        ); 
    }
}

for(var i=0;i<2000;i++){
    oBjects.push(new Myclass({ID:i+1}));

}

oBjects=[];

console.timeEnd('class');

VM143:35 prototype: 8.667ms
VM143:82 class: 10.209ms

VM358:35 prototype: 6.140ms
VM358:82 class: 18.715ms

VM361:35 prototype: 3.849ms
VM361:82 class: 9.515ms

But I think the more important thing is when calling the identical methods.

After all, the point is to use the things, not just create them :smile:

Brandon Nozaki Miller
@RIAEvangelist

Even when I reduced the method calls from 5000 to just 500 per object it seems to show the same trend. Basically negligible still.

prototype: 723.964ms
VM58:96 class: 712.170ms

VM63:42 prototype: 711.407ms
VM63:96 class: 700.059ms

VM64:42 prototype: 727.078ms
VM64:96 class: 712.857ms

Madeline Cameron
@madelinecameron

Yeah, I knew that prototype tends to outperform other methods. Wasn't sure if they would be negligible differences (I couldn't have imagined that the new method would not perform as well as prototypes, just wasn't sure if it would outperform prototype).

And I do agree it is nice that all of the functions are declared outright first so at least it lays out a map a bit. I do still contest it is a little intimidating but I am sure that's just me. Did you mention ES6 moves closer to this kind of thinking rather than valuing / teaching prototypes over all.

And the delivery method var is something I had added but it is an easy change so I agree. :)

Also, your comment about prototypes messing with the object and not making it behave correctly, I haven't tested it correctly but if my thinking is correct, this new method could solve an issue with Validate and Price. As it stands currently, if you want to run validate and then update the object, you have to init a new Order object which is craziness. I assume your mention of cowboy coding with prototypes is a response to the ever lovely Order 'initializor' and the insanity of the entire Order object. ;) I will admit that has grown out of control and will take my lumps for it, haha.

Ugh. That last paragraph got jumbled. Basically if you want to run validate and then run purchase, you have to init a new Object variable because prototypes can't modify it's own object (Which I assume is what you were meaning by prototypes messing with this and other scoping issues)
price, not purchase D:
Brandon Nozaki Miller
@RIAEvangelist
:D
hey I just got back, was competing at Pikes Peak International Hill Climb.
Glad to see all the tests are working now. Looks like we don't have too much to do to get v1.0.0 out the door. woot!
race photo
Brandon Nozaki Miller
@RIAEvangelist
took third
Madeline Cameron
@madelinecameron
Oh cool, looks fun!
Brandon Nozaki Miller
@RIAEvangelist
Yeah most dangerous race in America. Sadly another person died this year.
Just finished up with the media stuff for it so I'll be back to work on this now.
Madeline Cameron
@madelinecameron
Oh my gosh D: That totally sucks.
Awesome, I haven't worked a bunch on it. I only fixed that one bug, writing a few more tests and then working on the menu mapping feature.
Brandon Nozaki Miller
@RIAEvangelist
Yeah. He was pitted next to me. Cool guy.
I saw the tests that's awesome.
There's not much left before 1.0.0
Julian Hartline
@julianh2o
Do you guys hang out here often?
Brandon Nozaki Miller
@RIAEvangelist
Not so often lately. Is useful when collabing a lot though.
Plus having the app on phone makes it easy to see when messages are awaiting response.
Added you to collaborators.
Julian Hartline
@julianh2o
How do you get mocha to output full stack traces on test failures? It's pretty hard to debug tests without it..
Hmmm, looks like it outputs full stack traces as long as you install mocha globally and run it directly.. but not when I run "npm test"
Brandon Nozaki Miller
@RIAEvangelist
Really? I did not know that.
I normally use jasmine for my other stuff, and that outputs full stack trace.
Good to know.
Madeline Cameron
@madelinecameron
Yeah, sorry. I got stuck on mocha and it may not be the best choice. D:
Just thought I'd let you all know I am indeed still alive. Was just out of state for a month then I have been working on my final semester along with some other projects.

Along with the other (unrelated) projects, I have a cool project you all might be interested in.

It sort of grew out of a hackathon I was doing with a friend. I'll clean it up and finish it maybe this weekend so I can show it off. Been getting discouraged because Dominos endpoints are spotty and annoying to work with (not like I need to tell you that)

Madeline Cameron
@madelinecameron
Also, if anyone is dying for a sideproject: Build a Gitter app for Android. ;D The current one (or at least the one I've seen) is horribly insecure (Doesn't use OAuth) and the UI is literally a webview.
Brandon Nozaki Miller
@RIAEvangelist
Cool, can't wait to hear about it! I thought you went hiking and fell into a pit or something ;)
The only time I found the endpoints to be spotty is when I built a phone number generation algorithm to get tracking info for all pizzas in transit in Los Angeles.
They have rate limiting per min which blocks you for hours. So long as you don't exceed the per min limit you are good forever. Or round robin your requests.
Actually the block might just be like 10 min or something, I forget really. Once I saw all the moving pizzas I decided to build this api.
And stopped pinging them like that.
Julian Hartline
@julianh2o
How do coupons work? Specifically, if I select coupon X.. how does the Dominos UI know what I need to add to my order to fulfill that coupon? I haven't seen anything in the menu that seems to do this..
Brandon Nozaki Miller
@RIAEvangelist
I think the cupon is an item. The way ibwould checkbis throigh dev tools on their site and look at request in network tab.
Julian Hartline
@julianh2o
Yeah, I was just looking at it.. I didn't see what I was expecting, I'll do some more research. They have this "coupon wizard" that pops up.. but I haven't figured out how it gets its data.
Brandon Nozaki Miller
@RIAEvangelist
Maybe the request after the wuzard will shed some light on the situation.
Brandon Nozaki Miller
@RIAEvangelist
sorry haven't been around this weekend. Working on extending node-ipc with windows socket support ( poor guys have been waiting a long time ) and TLS/SSL socket support which cert generation scared me off of for a while.