Тёмный

Composition over Inheritance 

Fun Fun Function
Подписаться 263 тыс.
Просмотров 509 тыс.
50% 1

💖 Support the show by becoming a Patreon
/ funfunfunction
This is a weekly show where we try to become more confident and excited about programming by learning intriguing things that we didn’t know before. Today, we are are going to talk about composition over inheritance. Inheritance is when you design your types after what they are, while composition is when you design your types after what they cando. We are going to learn about the limitations of inheritance, and how to solve them using composition.
Full script here: / cb6f88070205
💛 Follow on Twitch
We record the show live Mondays 7 AM PT
/ funfunfunction
💛 Fun Fun Forum
Private discussion forum with other viewers in between shows. www.funfunforum.com. Available to patron members, become one at / funfunfunction
💛 mpj on Twitter
/ mpjme
💛 CircleCI (Show sponsor)
Robust and sleek Docker-based Continuous Integration as a service. I used CircleCI prior to them becoming a sponsor and I love that their free tier is powerful enough for small personal projects, even if they are private. Use this link when you sign up to let them know you came from here:
circleci.funfunfunction.com
💛 Quokka (Show sponsor)
Wonder how MPJ evaluates JavaScript inline his editor. Quokka is the answer - use this link when you buy to let them know you came from here:
quokka.funfunfunction.com
💛 FUN FUN FUNCTION
Since 2015, Fun Fun Function (FFF) is one of the longest running weekly RU-vid shows on programming 🏅 thanks to its consistency and quality reaching 200,000+ developers.
🤦‍♂️ The Failing Together concept is what makes FFF unique. Most coding content out there focus on step-by-step tutorials. We think tutorials are too far removed from what everyday development is like. Instead, FFF has created a completely new learning environment where we grow from failure, by solving problems while intensively interacting with a live audience.
Tutorials try to solve a problem. Failing Together makes you grow as a developer and coworker.
📹 Each show is recorded live on Twitch in a 2-hour livestream on Mondays. The host, assisted by the audience, is tasked to complete a programming challenge by an expert guest. Like in the real world, we often fail, and learn from it. This, of course, reflects what the audience identifies with, and is one of the most praised aspects of the show.
⏯ On Fridays, an edited version of the show is adapted for and published on RU-vid.
Content Topics revolve around: JavaScript, Functional Programming, Software Architecture, Quality Processes, Developer Career and Health, Software Development, Project Management

Наука

Опубликовано:

 

7 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 857   
@AlexandriaRohn
@AlexandriaRohn 8 лет назад
07:03 "Inheritance encourages you to build this taxonomy of objects very early on in the project. And you are most likely going to make big design mistakes while doing that. Because humans cannot predict the future." "I think it's just better to use composition from the start. It's more flexible, it's more powerful, and it's really easy to do."
@hugodsa89
@hugodsa89 4 года назад
This is my number one problem in every single project I do. This is coming from someone who always developed in a class oop style, and now changing is so much more difficult because I am so used to what I used to do. However, I agree 100% that it is better in most scenarios, the only scenario that I would use a inheritance over composition is when I am writing a base class and I want to enforce implementation of an abstract behaviour that all objects in future must have.
@schirmcharmemelone
@schirmcharmemelone 3 года назад
@@hugodsa89 So for example you make a base composition that the real compositions have to inherit? like returning the name or type of the composit and some sort of copy function or how to get the 'real' 'raw' data so you can leave that in an array with all other composite data of the same type in sequential memory. I think something the Video has not mentioned is the fragmentation of OOP data. If you want to update all poop states of all Animals then it makes no sense to jump through multiple pointers to get to the data. This would just give you cash misses and make your program slow. If you keep all position data in one sequential memory your cpu will chew right through it. Loading sequential memory can be 100x faster. Nothing beats an array.
@plutopulp
@plutopulp 2 года назад
@@hugodsa89 I completely agree. The only time I use inheritance-type pattern is writing interfaces/abstract base classes, but even there it's not inheritance but enforcing implementation as you say.
@miltonr87
@miltonr87 2 года назад
Amazing quote! 😄
@thiagotimm3668
@thiagotimm3668 5 лет назад
"The problem with inheritance is that encourages you to go predict the future..." Just genius Matt!
@jones848
@jones848 8 месяцев назад
Yeah hearing that has been like an epiphany for me. Such a great way of looking at it
@AlessandroStamatto
@AlessandroStamatto 7 лет назад
Composition gets better with Object Spread (sugar for Object.assign): return {...barker(state), ...driver(state), ...killer(state)}
@trappedcat3615
@trappedcat3615 6 лет назад
is this standardized yet
@hiimshort
@hiimshort 6 лет назад
Red Bear it is standard, but not supported everywhere yet :(
@amypellegrini1732
@amypellegrini1732 6 лет назад
You can use transpilers anyway
@michaelwalker1013
@michaelwalker1013 4 года назад
Was just about to comment the same thing ! That’s great! Good tip!
@can_pacis
@can_pacis 4 года назад
Spread operators are not just sugar for Object.assign. Object.assign mutates the given object, thus may trigger object setters while spread operator creates a brand new iterable making it more useful with immutable techniques.
@ThomasBurleson
@ThomasBurleson 8 лет назад
Inheritance is appropriate for single-level abstract classes where you define expectations of abstract methods that MUST be defined in a subclass. You effectively have written a API-contract. In almost all other cases, I favor composition. I love your videos and the style of teaching [often] techno-jargon.
@funfunfunction
@funfunfunction 8 лет назад
+Thomas Burleson thanks, Thomas! And yeah, that seems like a sensible approach.
@ThomasBurleson
@ThomasBurleson 8 лет назад
Keep up the great work! Your videos are wonderful resources and so appreciated!
@davidtorroija5141
@davidtorroija5141 8 лет назад
Me too very good teacher :D
@FalconFetus8
@FalconFetus8 6 лет назад
Why not use an interface instead?
@BenRangel
@BenRangel 7 лет назад
I blame the overuse of inheritance on college focusing too much on OOP and training us to overuse that pattern, and cram inheritance into our projects. A perfect inheritance hierarchy is a wonderful thing that gives you a sense of structure and a mental model. But it's not feasible in today's agile world cause it's unmaintanable. Most agile projects would benefit from using composition.
@cosname
@cosname 7 лет назад
Exactly! There are very rare situation where we would like to use inheritance, this idea should nailed in very narrow scenario that can be thinked as undividable unit, though should be inherited. For example of how the barker is barking actually.
@velocityra
@velocityra 7 лет назад
What is presented in the video *is* actually *(multiple)* inheritance. See the discussion here: www.reddit.com/r/programming/comments/5dxq6i/composition_over_inheritance/da8bplv
@PHILOSOPHYALPHAMALE
@PHILOSOPHYALPHAMALE 5 лет назад
I think so too. Java was the de facto learning language for computer science in the early 00s and OOP was everything.
@Ahmetfusta
@Ahmetfusta 5 лет назад
@@velocityra that was an interesting read
@ShaferHart
@ShaferHart 4 года назад
@@PHILOSOPHYALPHAMALE Still is in many places and the dynamic is the same if they teach C# instead. It kind of feels very anachronistic that they still have such a heavy emphasis on OOP as if it's the end all be all of programming.
@SlhT-xe1cc
@SlhT-xe1cc Год назад
I really love how extremely simple your example are presented! it really makes me roll my eyes when "beginner" guides use long-winded examples where you have to think about a thousand things at the same time and get confused and lost in concepts unrelated to what you're actually trying to learn.
@ahmarsiddiqui
@ahmarsiddiqui 8 лет назад
07:03 turning point of my perception of programming in general I always found it hard to implement inheritance in real world applications but still used it thinking that's how I was taught oop and that's how I'm suppose to write programs thanks a lot for such a great video
@2thinkcritically
@2thinkcritically 8 лет назад
For those browsers that don't support Object.assign yet: if( !Object.assign ) { Object.assign = function( obj, items ) { var src = Object( items), target = Object( obj ) Object.getOwnPropertyNames( src ).forEach( function( k ) { target[ k ] = src[ k ] }) return target; } }
@ihateyourusernames
@ihateyourusernames 8 лет назад
By Jove! This is the most eloquent explanation as to why composition is a less complicated route than inheritance. Thanks for sharing!
@bobbyadamson2333
@bobbyadamson2333 8 лет назад
I have spent about a week reading things that dance around what you have explained so clearly here. Thank you for all you do
@youAmera
@youAmera 7 лет назад
Program to an interface and not an implementation - this is a good practice
@danmartin1726
@danmartin1726 8 лет назад
Love this "Real World" explanation training style. Great job!
@robroem
@robroem 7 лет назад
I just have to say: You give the best example of WHY composition should be favored that I've ever seen. Anytime someone asks me, or this topic comes up; I immediately link them to your video. You explain so much better than I ever could. Thanks for that!
@JamesSpeirs
@JamesSpeirs 6 лет назад
This was so good. Clear, concise, complete, and humorous.
@juliankrispel-samsel218
@juliankrispel-samsel218 8 лет назад
You are a genius good sir. This is gold! Funniest, simplest, most bestest articulated video thing on software design I have seen to date. Thanks! Keep em coming!
@doug2k1
@doug2k1 8 лет назад
Just found about your channel. Clear and fun explanations! Keep up the good work!
@FairyRat
@FairyRat 2 года назад
This is so cool! I'm totally on board with composition. Also HUGE thanks for your work! Awesome stuff! The Odin Project represent!
@adamzerner5208
@adamzerner5208 7 лет назад
LIGHTBULB! You just made my day. You just leveled up my programming skills in 8 minutes. Thank you!
@praguepanda
@praguepanda 8 лет назад
This is a nice explanation. What you consider "composition" is however called "concatenative inheritance". Composition is achieved by passing more specialized components into a more general one. By doing so, you create an object model tree in which objects reference and use other objects rather than making a type tree (taxanomy) in which objects are tightly coupled to their parents (prototypal delegates or parent classes) as opposed to loose coupling in case of composition.
@SeyferX
@SeyferX 6 лет назад
because js and js devs are 'unique' - they invent own term definitions...
@rebornreaper194
@rebornreaper194 6 лет назад
Oleg Abrazhaev "composition" is a general computer science term, not js specific
@jeffwells641
@jeffwells641 6 лет назад
The way he described it in the video seems very similar to composition in Go, so I think the industry is settling on the term.
@panzerdp
@panzerdp 4 года назад
Exactly! The video misunderstands the term composition, which is actually a delegation of implementation to a delegate object contained within a bigger object (has a).
@klausdupont6335
@klausdupont6335 Год назад
Bro makes the design patterns fun! The use cases are well-chosen and the explanation very straightforward. Nice video!
@keplar7243
@keplar7243 4 года назад
Thank you so much for these videos they're by far the most concise yet clear and straight to the point.
@AndrehHimself
@AndrehHimself 5 лет назад
I've just stumbled upon this video searching composition vs. inheritance for C# to take a second point of view as it was still unclear after watching a lesson from a course on Udemy. Your funny and practical approach was so clear and enlightening that instantly earned both my like and subscription. Thanks for taking your time to share it with lost travelers (:
@tarekghosn3648
@tarekghosn3648 2 года назад
hell the first few lines were enough to put it in place. i found you after15 plus videos and yours was the only one who truly explained the difference in how to use them directly while thinking sanks
@ChristopherOkhravi
@ChristopherOkhravi 6 лет назад
Super good point about predicting the taxonomy being at the core of the problem. Well put. Thank you :)
@darrenandveronica
@darrenandveronica 8 лет назад
I had a dream about trying to flesh out a new program with inheritance. I woke up sweating. That's totally true. Man this video was great. I watched quite a few of your vids now, you crack me up.
@arbitraryCharacters
@arbitraryCharacters 8 лет назад
This is such a clear explanation! Thank you for this! 👏
8 лет назад
I especially like this video! Very exciting to learn about composition :) Really thankful for your videos, they are informative without being boring, and tells me just enough about a topic to get me excited about diving deeper into it. Would be nice to hear about some more ES6 goodies that I should be using!
@funfunfunction
@funfunfunction 8 лет назад
+My Högblom Thanks, My! Might be some ES6 stuff coming in the pipe, we'll see!
@anthonychung1425
@anthonychung1425 8 лет назад
I'd LOVE it if you gave sample "tasks" for us to do to test ourselves. it sounds suspiciously like homework but it's the only way I could ever confirm I understood anything. haha
@funfunfunction
@funfunfunction 8 лет назад
Oh shit, that is a FANTASTIC idea! I'll try to remember to do it next video.
@ChrisGeirman
@ChrisGeirman 8 лет назад
+Anthony Chung I agree... this requires practical application before I'd know I truly understand it.
@anthonychung1425
@anthonychung1425 8 лет назад
yeah it doesn't have to be anything super complex or detailed. maybe just like a brainteaser or something to think about and try till the next week. :) thanks for responding!
@funfunfunction
@funfunfunction 8 лет назад
+Anthony Chung It's a bizarrely good idea, I think. Especially fronting it as a "brainteaser". It would also be a interesting success metric for the video - i.e. how many was excited by the video enough to try their hand at the brainteaser, and how many understood the video well enough to solve it. I'm not commiting to doing this yet because I like to let idea mull over for a few weeks before doing them, but I really like this concept intuitively.
@hyperrealhank
@hyperrealhank 8 лет назад
+mpjme personally, i dont care for it. your videos are enlightening enough where i wouldnt ever feel the need for an exercise. however, i do feel like a github gist for each video would be appropriate
@benjonyc
@benjonyc 8 лет назад
I am a front end developer working in NYC. I really enjoy your explanations and have been watching your videos and coding up all the examples. I really enjoy both your explanations and when you have live coding examples. If you had a paid course I would surely purchase it. Thanks for creating this channel!
@elmarvo7505
@elmarvo7505 2 года назад
Such a brilliant example! Thanks a lot
@priyankamalviya3613
@priyankamalviya3613 7 лет назад
One video and I am an ardent fan!!!!! How amazing is this explanation!!! I kept viewing this link over and over again both here as well as medium.com but never actually spent these 8-9 minutes for some reason and kept myself so confused on this topic!!!! For the first time I am so clear as to why most experienced programmers favor composition!
@ndbass09
@ndbass09 10 месяцев назад
3.5 minutes in and I have to stop the video to like and comment...you made such a clear, sensible, and persuasive case. Thank you!
@peripona
@peripona 7 лет назад
At First.. I felt reluctant to watch the video with such Handsome Poster Image ( : Scarcastic :D ) But then... I am spellbound by the way you have conveyed such a concept with such innovative, indulging and entertaining way.. Kudos. Yo!! your video rocks. I ill subscribe and follow your Videos :) With love from India !
@ariemilner8845
@ariemilner8845 8 лет назад
Absolutely love your show, I think your show is so beneficial (and fun and interesting and awesome etc...) not just because of your skills as a programmer, but also your ability to *keep things simple* in your explanations! Often people explaining things like to over complicate things to "sound smarter".... not fun at all. Please keep it up!!!!
@wypimentel
@wypimentel 7 лет назад
I just discovered you today, you makes things easier. And you code is so elegant, you make art with your code.
@Mr_Wiley
@Mr_Wiley 4 года назад
You know that scene in The Office when Michael says, ok now explain it to me like I'm a 5 year old. Well, I feel like you just did that and it worked perfectly. I'm not learning Java but the two concepts flowed into my brain immediately and easily from this tutorial. Simple and effective, and entertaining delivery. Liked!
@micaevski
@micaevski 8 лет назад
hey, love your show. can you please make an episode about modules and separation to different files. thank!
@Rashomon69
@Rashomon69 7 лет назад
MPJME - I've been a developer for almost 20 years. I've developed in multiple languages - COBOL, ActionScript, Objective C, Java, JavaScript, PHP, etc. I feel like I've always been "behind the curve", because I've had to learn so many languages (frequently starting over). I just discovered your channel last week, and I've been binge watching, because I have learned a LOT from them. You are filling in the pieces that I've been missing from being a "self-taught" developer. I feel like I'm now becoming the top-notch developer that I've always wanted to be. THANK YOU!!!
@jakubrpawlowski
@jakubrpawlowski 6 лет назад
Great video! I've just read 100 pages on inheritance in "Secret of the JavaScript Ninja" by John Resig and I had so many doubts about going this route and now I have an alternative to explore. Thank you so much!
@daliborkozar870
@daliborkozar870 2 года назад
I fist watched this video 2 years ago and now coming back to prepare for an interview
@kunalpareek83
@kunalpareek83 7 лет назад
Man this is such a fantastic vid. Thanks for the wisdom. Inheritance seems like such a natural way to think about things. (I was introduced to classes via Django) but I have faced the exact problem you defined above. Must rethink object construction using composition.
@jeffersonian4
@jeffersonian4 5 лет назад
Fantastic. This is easily the best explanation of classical vs prototypal inheritance I've run across. Great vid! New subscriber right here
@thesravan079
@thesravan079 8 лет назад
A super tutorial I found about Composition and Inheritance in JavaScript. Thanks mpjme!
@AtileonVA
@AtileonVA 6 лет назад
Clear as ever! You're great, Thanks!
@TomLikesGuitar
@TomLikesGuitar 8 лет назад
I'm working on transitioning many years of C++ experience into Javascript for a new job and I just wanted to say that your videos have been a great tool to help me figure out the common standards and concepts (as well as helping me prioritize what, exactly, is worth learning in this crazy-ass, over-complicated language lol). There aren't a ton of educational videos that are entertaining and well-produced, but yours manage to be both.
@steavbun4199
@steavbun4199 8 лет назад
What a good explain!! :D I love your explaining
@purovenezolano14
@purovenezolano14 8 лет назад
Thanks for your awesome videos mpjme!
@tracetv8115
@tracetv8115 Год назад
Absolutely great video! So good examples, thank you very much!
@Avatan5
@Avatan5 Год назад
Here from The Odin Project. Great video, very helpful, and explained in a fun way too! Thank you!
@Dueck25
@Dueck25 7 лет назад
Great video, and a really helpful example and memorable example! Thanks!
@Aarmaxian
@Aarmaxian 7 лет назад
Thank you for your videos. They are fantastic!!
@richie-bonilla
@richie-bonilla 6 лет назад
This explanation is clear AND hilarious. Thank you.
@jesselisser
@jesselisser 8 лет назад
Thank you for another awesome video!!
@traviszito6408
@traviszito6408 10 месяцев назад
After reading a bunch of articles about this topic, I have to say you really show why composition is better in most if not all cases without over complicating things. The way you explain it deliberately and with simple language really helped me understand just what exactly composition is! I have definitely found myself in past projects saying, Well I already made this class, if I break it up or even remove it entirely then the whole program falls apart. Going forward I'm going to be more wary of this.
@adamo901
@adamo901 3 года назад
Outstanding tutorial, thanks a lot. I really liked the way you presented this topic.
@nosajghoul
@nosajghoul 6 лет назад
Dude I just answered a question about composition on quora and referenced this video and the picture it chose to use of you is freaking hilarious.
@edieshockpaw
@edieshockpaw 4 года назад
Bob Ziroll's React video brought me here!
@craftoverflow
@craftoverflow 4 года назад
LOL same
@sc76399
@sc76399 8 лет назад
Brilliant video, loved the Robot Murder Dog made me laugh. It's very thought provoking and I love the idea of composition because you only get the functionality that you need over all the functionality you might need or just because some other children use that functionality I'm going to have to learn more about it.
@drrecommended4850
@drrecommended4850 Год назад
great explanation thank you! will definitely be running with composition over inheritance! long live the prototype!
@fmvilas
@fmvilas 8 лет назад
hahahahaha! I loved it! Best explanation i've seen ever.
@andreasonny83
@andreasonny83 7 лет назад
straight to the point and crystal clear
@georules
@georules 8 лет назад
This is an excellent video. Well spoken and explained.
@xJCHMx
@xJCHMx 6 лет назад
This is an awesome video explaining Composition. Thank you
@shubhamchandra9258
@shubhamchandra9258 2 года назад
Lucky to have found this video. Lesson learned: We can always opt for composition. ex- Car is a vehicle. But Car is also has wheels, engine, seats.
@mohammedlaslaa9549
@mohammedlaslaa9549 4 года назад
Just awesome video! Thanks!
@IntegralDeLinha
@IntegralDeLinha Год назад
Thank you! This was very useful and insightful!
@leojacquemin2037
@leojacquemin2037 7 лет назад
Excellent video, you made me see the light
@carinlynchin
@carinlynchin 6 лет назад
BEAUTIFUL. thanks so much for the easier description. I have been hearing about it but, let's be honest, a lot of the resources befuddle their explanation to a bunch of terms and I personally learn better with examples. So thank you. I actually started learning OOP in college, so it is pretty hard wired into my mind until the job I'm in which they dont' want OOP... I never understood why until I started reading about this recently.
@jamieshelley6079
@jamieshelley6079 2 года назад
It's interesting, I often use both, when I know the inhereted functions will never change. Or they themselves are generics/Utility. Best of both words!
@MichaelAlhilly
@MichaelAlhilly 7 лет назад
Thank you for this!
@TusharShukladevx
@TusharShukladevx 4 года назад
First time here and dude you're awesome. The way you've explained all of this is fun, engaging and entertaining. Liked & Subscribed.
@cakeintech
@cakeintech Год назад
I understand it now tysm! and Very fun it to watch.
@DimaDesu
@DimaDesu 7 лет назад
Very nicely explained. You rock!
@tijilparmar1642
@tijilparmar1642 2 года назад
Love this video..clared the concept with humour...
@dylanking165
@dylanking165 2 года назад
came from the odin project. can't remember if it was linked directly there or if this was linked in an article they had me read. I love your energy and you explained this in a way where somebody who's struggling came away knowing more than I did. thanks so much.
@GabrielRubens
@GabrielRubens 8 лет назад
My eyes are opened! Haha Thanks!
@swaroopbhave651
@swaroopbhave651 4 года назад
Superb comparison. Hats off
@dvirarazi7351
@dvirarazi7351 6 лет назад
Great video, the explanation and examples were very clear and helpful
@samimaameri9925
@samimaameri9925 7 лет назад
awesome video man. Nice one!! Funny too!
@sadhnajoshi2737
@sadhnajoshi2737 6 лет назад
This is one of the best videos. Thanks
@raselkarim2731
@raselkarim2731 3 года назад
I couldn't wait to subscribe to your channel after watching this video. Love.
@klesk44
@klesk44 7 лет назад
As a (French ^^) PHP developer, your JavaScript approach is so interesting and so clear ! Thanks a lot for sharing your skills :p And stay curious ;)
@alittlebyte
@alittlebyte 3 года назад
Excellent information!
@LeonardoFrangelli
@LeonardoFrangelli 8 лет назад
Your videos are awesome for many reasons, but to me, the best thing is that you aways come up with the "But.....". Thanks man, and continue with this great work.
@sudosert
@sudosert 8 лет назад
An excellent explanation and highly entertaining.
@amehybrid
@amehybrid 5 лет назад
This is easy to understand! Thanks!
@addisonfrancisco9007
@addisonfrancisco9007 3 года назад
This is such a great use of analogies.
@Gruak7
@Gruak7 4 года назад
Those examples are absolutely top notch
@jandeman8410
@jandeman8410 6 лет назад
Thanks! I'll try your composition over inheritance principle in practice
@mikekidder
@mikekidder 8 лет назад
Great explanations, great video!
@slherzog
@slherzog 8 лет назад
Excellent presentation!
@Vagelis_Prokopiou
@Vagelis_Prokopiou 6 лет назад
Excellent video. Thanks.
@proclaimm
@proclaimm 8 лет назад
first time seeing your video from a friend's referral, haha, you crack me up and it's interesting to see daily life example that you used to better illustrate the concept. thank you and I subscribed.
@funfunfunction
@funfunfunction 8 лет назад
+Jim Kang Hey jim, that's great to hear. Welcome to the channel and say thanks from me to your friend!
@yuelee1988
@yuelee1988 6 лет назад
感谢老兄!非常清晰明了!thanks a lot !!
@TheTwalnb
@TheTwalnb 6 лет назад
I agree with Antony Chung. Some sample tasks would be greatly appreciated. I am new to coding and find it difficult to find tasks that might further my understanding of the more complex concepts. Thanks!
@StephanHoyer
@StephanHoyer 8 лет назад
You speak to me from the soul, as always. Great video. Composition outperforms prototypal Inheritance not only in simpler structure but also in better readability due to the fact, that you don't have to use that f.....g "this" anymore. Sadly I can't come to this years JS-Conf because some serious childbirth is going one here :). I'd love to have a chat with you there. Have Fun in Berlin!
@Anecxina
@Anecxina 7 лет назад
Great video!! Helped me a lot :)
@78njh33
@78njh33 8 лет назад
Great explanation - really clear.
@michaelffasd23
@michaelffasd23 6 лет назад
I love the idea of mix-and-match types, it's like the best of both worlds between Classes and Interfaces. However, wouldn't it be difficult in a larger scale app to keep track of which properties are in which classes? Say I wanted to add "barker" into the Object.assign - wouldn't I have to check ALL my other factories to make sure I'm not overwriting anything?
@moszis
@moszis 6 лет назад
Good god man.. you just broke my 20 years of Java experience. I'm not even kidding. Big thumbs up for this video
Далее
Factory Functions in JavaScript
6:34
Просмотров 211 тыс.
The Flaws of Inheritance
10:01
Просмотров 906 тыс.
What turned out better to repeat? #tiktok
00:16
Просмотров 1,5 млн
OOP Principles: Composition vs Inheritance
15:38
Просмотров 51 тыс.
Composition Over Inheritance
4:46
Просмотров 13 тыс.
ИГРОВОВЫЙ НОУТ ASUS ЗА 57 тысяч
25:33