Mixins in JavaScript : Object Oriented Programming Series - Part 8

Поділитися
Вставка
  • Опубліковано 21 сер 2017
  • JavaScript mixins to achieve multiple inheritance. By borrowing methods from multiple mixins.
    Article and code samples from this tutorial
    * techsith.com/mixins-in-javascript
    Please help me translate this in your native language. Thanks much :)
    * ua-cam.com/users/timedtext_vide...
    Please be my patreons on patreaon
    * / techsith
    Follow me for technology updates
    * / techsith
    * / techsith1
  • Наука та технологія

КОМЕНТАРІ • 89

  • @obedoseifrimpong
    @obedoseifrimpong 5 років тому +13

    I literally bust out into laughter when he ate the ice cream. 😂😂😂😂😂

  • @crowdmaker
    @crowdmaker 2 роки тому

    Loved the image of a flying, crying superman. 😂Great tutorial too, now I finally know what mixins are!

  • @swapnilpatwa2093
    @swapnilpatwa2093 6 років тому +1

    saw your all videos and let me tell you, you made all the concepts​ super easy to understand. please don't stop, you are doing a wonderful job.. keep it up. thank you

  • @mikhoq
    @mikhoq 6 років тому +7

    11:15 "... and he can dodge bullets, like aliens" LOL :)
    Thanks for a good video. I like that you keep your videos nice and short.

  • @kuiamenhmartin6540
    @kuiamenhmartin6540 4 роки тому +5

    Great Tutorial! For the Object.assign(), alternatively, we could also use the spread syntax in Javascript to achieve the same functionality like this,
    const jsEngineer = { ...jsSkill, ...engDegree }

  • @teshyp
    @teshyp 2 роки тому

    Thanks for all your energy! :)

  • @unavummarunthum7794
    @unavummarunthum7794 5 років тому

    Your way of explaining complicated concepts are very easy to understand :) thanks for posting this video. Very useful.

  • @sabwut1529
    @sabwut1529 6 років тому +1

    Thanks man. :) Your videos helped me a lot in sharpening my skills

  • @gc7042
    @gc7042 6 років тому +1

    Thank you, the best js tutorial on UA-cam

  • @Videosuser
    @Videosuser 3 роки тому

    Thank you and keep going, you tutorials are amazing.

  • @chamnil8666
    @chamnil8666 3 роки тому

    Amazing content,thank you so much Sir.

  • @threeone6012
    @threeone6012 6 років тому +1

    Thanks for the upload, great video as always!

  • @pawandeepchor89
    @pawandeepchor89 6 років тому

    Awesome tutorial again 😊

  • @fdc_8507
    @fdc_8507 6 років тому +2

    thanks for great tutorials
    You are the best in the internet

  • @TheQuestion0mark
    @TheQuestion0mark 6 років тому +1

    Great examples.. clear and focus

  • @GorillaDevFB
    @GorillaDevFB 4 роки тому

    Damn dude great content! I've never watched any of your videos but just subscribed. Thanks!

  • @oluwatobilemon9311
    @oluwatobilemon9311 2 роки тому

    thank you so much, this explains it better.

  • @manendra19
    @manendra19 6 років тому

    Simple and great tutorial. Explained very well . Good job.

  • @pkmkb_0
    @pkmkb_0 3 роки тому

    i liked the way u chose names which will make us easy to remember the functionality..thanks.

    • @Techsithtube
      @Techsithtube  3 роки тому

      My pleasure 😊 Thanks for watching!

  • @gabrielfono844
    @gabrielfono844 3 роки тому

    thanks
    amazing tutorials

  • @mostafaatef4584
    @mostafaatef4584 4 роки тому

    nice tutorial good job

  • @ANREWTROFIMOV
    @ANREWTROFIMOV 5 років тому

    Hello) I would like to say Thank you and keep going, you tutorials are amazing.

  • @gabrielfono844
    @gabrielfono844 2 роки тому

    it is amazing
    thanks

  • @CristianRomero-up1nj
    @CristianRomero-up1nj 6 років тому

    So clear

  • @DevangPatil
    @DevangPatil 6 років тому +2

    Excellent!!

  • @seenuvasanv
    @seenuvasanv 6 років тому

    Thanks.

  • @supriyoranjan6640
    @supriyoranjan6640 5 років тому

    Great Video Sir please add more I am enjoying

    • @Techsithtube
      @Techsithtube  5 років тому

      Thanks for watching Supriyo. which tutorial you would like me to add?

  • @gabrieldefazio
    @gabrieldefazio 6 років тому

    awesome!

  • @majdaleid6648
    @majdaleid6648 2 роки тому

    thank you alot :=)

  • @siddhesh9901
    @siddhesh9901 5 років тому +1

    That was good explanation
    As explained in previous video, it only does shallow copy. Then how can we copy prototypes as well?
    Without explicitly giving entry in assign function?
    Object.assign(null,jsSkills,engDegree) should also do the same work, or not?
    Will that empty object {} have a prototype?
    How can one create an object without a prototype?

  • @querenskylebrun8676
    @querenskylebrun8676 6 років тому +2

    Hi, I thank you for all these tutorials cause they are masterpiece, they help me ny understanding javascript, but i just wondered if you can make one about encapsulation, arguments keyword and the ternary operator
    God bless you

    • @Techsithtube
      @Techsithtube  6 років тому

      Sure I will create a video explaining that. I think that might be useful.

  • @user-rz6bw8oq7k
    @user-rz6bw8oq7k 6 років тому

    I'm from Taiwan. Thanks.

  • @yass-a
    @yass-a 6 років тому +4

    Looks like the decorator pattern. Doesn't it?

  • @rodrigogarcia6842
    @rodrigogarcia6842 3 роки тому

    "Now he's flying and crying at the same time" Man, that Lex Luthor sure whoop his ass.

    • @focusgoal1773
      @focusgoal1773 3 роки тому

      you were seeking someone's attention so i helped you by liking your comment

  • @customxvega
    @customxvega 4 роки тому

    salade of Object.assign() :D i love it hahahaha good job man , good thing to enhance js intelligence .

  • @womeninmovesolutionschanne1065
    @womeninmovesolutionschanne1065 4 роки тому

    Great

  • @CliffStamp
    @CliffStamp 6 років тому

    It would be interesting to compare this to class/extends.

    • @Techsithtube
      @Techsithtube  6 років тому +2

      class/extends is inheritance. object.assign is composition. Using mixins you can sort of achieve multiple inheritance. Class is single inheritance.

  • @sunil24sunil
    @sunil24sunil 4 роки тому

    at 10:40, as we use closures redCar.isMoving() should be the way , redCar.drive().isMoving() is redundant. thank you

    • @Techsithtube
      @Techsithtube  4 роки тому +1

      Sunil , this is mixin example , to show you some of the tricks. In actual use some of that would be redundant.

  • @arch7143
    @arch7143 6 років тому +1

    "All human cry, and he will cry too. ("Tell me, do you bleed?... You will.) " *changes name to Sith Lord*

  • @corethenics
    @corethenics 6 років тому

    Can u please add some interesting examples of JavaScript post message?

  • @lowzhao
    @lowzhao 5 років тому

    Thank you for the tutorial, the pace is perfect and explaination is simple. But I have a question, for the second part, why the variable name(isFlying) can be the same as the function name(isFlying())? Wouldn't there wont be any confusion? For example when we return isFlying, it is returning the function itself? Another question can we use spread operator to achieve the same goal (I am worry about the variable is it by reference or by value)?

    • @Techsithtube
      @Techsithtube  5 років тому +1

      In this case on isFlying is a variable and other is a method of returning object. So its ok to have the same name. However, It make sense to have different name to avoid confusion. if variable is passed is a primitive types like number, string or boolean, its by value and objects are by ref.

    • @lowzhao
      @lowzhao 5 років тому

      @@Techsithtube Thank you for the reply, I understand.

  • @developerui2404
    @developerui2404 6 років тому

    Good smile , while having ice-cream , 😂😂😂

  • @msnfsn754
    @msnfsn754 2 роки тому

    6:53 "aah shit" 😂

  • @LetterSignedBy51SpiesWasA-Coup
    @LetterSignedBy51SpiesWasA-Coup 6 років тому +16

    Object.assign(me, {wantsIceCreamNow: true});

    • @Techsithtube
      @Techsithtube  6 років тому +9

      Console.log('Thank You for watching!');

  • @krishnasagarapusanthoshi8106
    @krishnasagarapusanthoshi8106 5 років тому

    how to write a factory function by using function and how to call object.assign and give values

  • @cseckler
    @cseckler 6 років тому

    Why did you return Object.assign() when you could just as easily return a new object?

    • @Techsithtube
      @Techsithtube  6 років тому

      Object.assign() actually returns a new Object. I think also performance wise its faster than using a constructors.

    • @cseckler
      @cseckler 6 років тому

      techsith awesome. Thanks for the reply. Your videos are so helpful! Hugely appreciate your effort.

  • @cmntkxp
    @cmntkxp 5 років тому

    love

  • @sabareeshk976
    @sabareeshk976 6 років тому

    Great.keep inspiring.

    • @Techsithtube
      @Techsithtube  6 років тому

      Thanks for watching!

    • @sabareeshk976
      @sabareeshk976 6 років тому

      techsith we can use spread method instead of object.assign.which is more reliable.why did you choose to go with object.assign

    • @Techsithtube
      @Techsithtube  6 років тому

      +sabareesh k you mean the spread operator?

    • @sabareeshk976
      @sabareeshk976 6 років тому

      techsith yes

  • @gabrielfono844
    @gabrielfono844 2 роки тому

    again
    this is a terrible tutorials
    it is so amazing

  • @tamalbhowmik1269
    @tamalbhowmik1269 6 років тому

    Why "console.log(superman.fly().cry().isCrying().isFlying());" showing Uncaught TypeError: superman.fly(...).cry(...).isCrying(...).isFlying is not a function

    • @Techsithtube
      @Techsithtube  6 років тому

      Iscrying gives you boolean so you can't call isflying on that.

  • @93kumite
    @93kumite Рік тому

    Superman's crying as he flies cuz' he wants more methods

  • @customdev7078
    @customdev7078 6 років тому +1

    Hi i wanna convert your video in hindi to help indian peoples in learning

    • @Techsithtube
      @Techsithtube  6 років тому

      I really appreciate , please do let me know once you convert it so I can share that info with my hindi audience. Thanks! :)

  • @elinriahi7969
    @elinriahi7969 6 років тому

    Create examples , thanks

  • @prashanth.m.nprashanth8200
    @prashanth.m.nprashanth8200 4 роки тому

    Object.assign({},techSithEnMixinsVideo,techSithHindiMixinsVideo)

  • @anonymous.youtuber
    @anonymous.youtuber 4 роки тому

    Now you got me hungry too ! 👅