This was a great explanation on Composition vs Inheritence. TLDR for others: IS A vs HAS A. If both applies, go for Composition (HAS A) One small issue with the video: What is a that duck/wheezing noise in the background? lol. It was a tad bit distracting in the beginning, but not a big deal overall.
Hi @NutshellJawahar Sir, Could you please provide an example which cannot be done by composition over the inheritance ?..... I think whatever we can achieve via inheritance can be done by composition right?
But my question from the example is when we use composition you said the rule of encapsulation is keeping, but we can access eat functionality using flyable object just like f.fly() we can also call f.eat(). Maybe I misunderstood your explanation can you give me a context, please? about this
You are designing inheritance wrong if you find composition better than it. Like in this example 'Flyable' has nothing to do with 'eat' functionality. Inheritance and composition are two very different tools. You've to use them wisely. In a good design, building blocks are created using inheritance and then, the business logic is built using composition of those building blocks.
This was a great explanation on Composition vs Inheritence. TLDR for others: IS A vs HAS A. If both applies, go for Composition (HAS A)
One small issue with the video: What is a that duck/wheezing noise in the background? lol. It was a tad bit distracting in the beginning, but not a big deal overall.
Thanks for your feedback. 💡
The noise, I am not sure. May be it’s the air conditioner. 😜 Hope it didn’t impact the experience.
First time watched this video from this channel, subscribed immediately. Great explanation.
Candid explanation. Nice one!
Thanks for watching Nutshell. 😊
Excellent explanation! Simple and clear
Clear and simple Explanation, Thank you :)
Thanks for watching nutshell. 💡
wow! great explanation.Thank you!
Thanks for watching Nutshell 💡
Simple, yet clear. Thank you!
Thanks for watching Nutshell 💡
Great Video. Highly appreciated
nice explanation
Beautiful and simple understandable example you explained, thank you. Thank You!
Thanks for watching Nutshell 💡
excellent explanation
Well done mate!
Great video in simple logic
Thanks Anirban for watching Nutshell. 😊
you gave me very clear insight into inheritance and composition. Thanks a lot sir.
The best point was regarding dependency injection and how composition helps via constructor to dynamically resolve dependencies
as usual, on point, great video
Thanks Michelle 😊
You explain it greatly.
I got the picture now
Nice Explanation !
Thanks Mukul for watching Nutshell. 😊
Thanks for the detailed explanation, expecting more video like this
Thanks Kumaran for watching Nutshell. 😊
Thank you. This video is so helpful. Keep up the good work.
Thanks for watching Nutshell. 💡
This video is really helpful.. expecting more like this
Thanks for following Nutshell Jisha. 🙂
excellent
🔥🔥🔥
Great explanation. Please complete Object-Oriented Programming Series.
Sure Suraj. Thanks for watching Nutshell. 💡
Good
Could you please create a playlist of solid principles and design patterns?It will be so helpful.
Sure. Will consider doing it. Thanks for watching Nutshell 💡
Hi @NutshellJawahar Sir, Could you please provide an example which cannot be done by composition over the inheritance ?..... I think whatever we can achieve via inheritance can be done by composition right?
But my question from the example is when we use composition you said the rule of encapsulation is keeping, but we can access eat functionality using flyable object just like f.fly() we can also call f.eat(). Maybe I misunderstood your explanation can you give me a context, please? about this
You are designing inheritance wrong if you find composition better than it. Like in this example 'Flyable' has nothing to do with 'eat' functionality.
Inheritance and composition are two very different tools. You've to use them wisely.
In a good design, building blocks are created using inheritance and then, the business logic is built using composition of those building blocks.
Great explanation, thanks!
Thanks Gaureesh for watching Nutshell. 💡
great explanation