Why you should choose composition over inheritance | Javascript OOP Tutorial

Dave Gray • June 8, 2021
Video Thumbnail

About

Web Development tutorials with full courses on HTML, CSS, JavaScript, React, Node.js and more! My goal is to help you learn how to build the web. Teaching helps me learn, too. I work full-time as a Solutions Architect / Developer and part-time as a university web dev instructor. Thank you for subscribing, supporting my channel and sharing the videos you think may help others. Keep striving for progress over perfection. And a little progress every day goes a very long way. Milestones: July 20, 2020 - 1st video Jan 1, 2021 - 1k subs April 2021 - 4k watch hours Nov 2021 - 10k subs Jan 21, 2022 - Video at 100k views Feb 16, 2022 - 100k watch hours Feb 19, 2022 - 1m views Dec 13, 2022 - 100k subs Dec 2022 - Over 1m views in 1 month April 7, 2023 - 10m views May 26, 2023 - 1m watch hours Sept 22, 2023 - Video at 1m views Dec 25, 2023 - 250k subs

Video Description

Web Dev Roadmap for Beginners (Free!): https://bit.ly/DaveGrayWebDevRoadmap Why you should choose composition over inheritance when you are creating objects. This tutorial will look at both approaches to creating objects and show you why composition is the best choice as well as the problems that arise with inheritance. 🚩 Subscribe ➜ https://bit.ly/3nGHmNn 🚀 JavaScript for Beginners: Full Course (8 hours): https://youtu.be/EfAl9bwzVZk Advanced Javascript Tutorials mentioned in this video: 🔗 Javascript Classes Tutorial: https://youtu.be/5fmifZZeJJ4 🔗 Javascript Prototypes Tutorial: https://youtu.be/mQ4oCgcgHOA 🔗 Pure FunctionsTutorial: https://youtu.be/ZXxahQS1PN8 🔗 Shallow Copy vs Deep Copy Tutorial: https://youtu.be/4Ej0LwjCDZQ 🔗 Decorator Functions Tutorial: https://youtu.be/wYs3rv_KFvk 🔗 Currying Functions Tutorial: https://youtu.be/I4MebkHvj8g 🔗 Source Code: https://gist.github.com/gitdagray/e3452b267fffb05ee25f0166ab15511f Why you should choose composition over inheritance | Javascript OOP Tutorial (00:00) Intro (0:18) Problems with object inheritance (4:45) Composition to the rescue (10:41) Data structure mutation (12:51) Cloning to avoid mutation (16:15) Bonus: Refactoring to a declarative expression (17:49) Review of Composition ✅ Follow Me: Twitter: https://twitter.com/yesdavidgray LinkedIn: https://www.linkedin.com/in/davidagray/ Blog: https://yesdavidgray.com Reddit: https://www.reddit.com/user/DaveOnEleven Was this tutorial about choosing Javascript object composition over inheritance helpful? If so, please share. Let me know your thoughts in the comments. #composition #inheritance #javascript

You May Also Like

No Recommendations Found

No products were found for the selected channel.