The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Design Patterns: Mixin

Design Patterns: Mixin

4:50
AngularJS supports "mixins" with angular.extend, but this approach has some drawbacks. In this video Brett takes a look at a more robust approach to mixins inspired by the Ruby programming language.
Watch this lesson now
Avatar
egghead.io

AngularJS supports "mixins" with angular.extend, but this approach has some drawbacks. In this video Brett takes a look at a more robust approach to mixins inspired by the Ruby programming language.

Avatar
eric

I felt like this lesson moved far to quickly, and didn't have the kind of immediately practical takeaways as a lot of the other lessons. I'm trying to dig into this kind of pattern right now and was hoping for the same kind of insights other lessons have provided. Using this pattern without a practical example, immediately jumping into a 3rd party library, and only showing how it applied to testing didn't really help me understand Angular.extend or a lot of the core principals that make this pattern so good. I'd love to see a deeper dive into the mixin pattern, and maybe with a little more background into when something like this is useful.

Avatar
Joel

I'd love to see a deeper dive into the mixin pattern, and maybe with a little more background into when something like this is useful.

Since watching this lesson I've started using this pattern quite a bit. I love it, in fact. I've got some practical uses for it and it is on my backlog!

In reply to eric
Avatar
Mark

in app.spec.js do you need a
var superArray ;
with a small s after
var SuperArray;
?

Avatar
Joel

as it is now it is implicit assignment of the variable, which is definitely not the best way to go (though it should work). You should always be explicit with variable declaration in JS!

In reply to Mark
Avatar
Mark

Thanks, I realize now that I had added 'use strict' to the top of the file that was not in the original source.

In reply to Joel
Avatar
Attend

This was brilliant, thanks!

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?