Responsive image

Up next


Composition Vs. Inheritance: How To Choose?

2 Views
Published on 25 Oct 2016 / In Film & Animation

?? Check Out The NEW Simple Programmer YouTube Channel With NEW Programming Videos:
https://simpleprogrammer.com/yt/spnewytchannel ?

SUPPORT THIS YOUTUBE CHANNEL: vid.io/xokw
Visit: http://simpleprogrammer.com/

Composition Vs. Inheritance: How To Choose?

Today we are going to talk about real programming.

Composition Vs. Inheritance. Have you ever heard about these terms? How should you choose between these two terms?

One of the advantages of Object-Oriented programming language is code reuse. There are two ways we can do code reuse either by implementation of inheritance (IS-A relationship), or object composition (HAS-A relationship). Although the compiler and Java virtual machine (JVM) will do a lot of work for you when you use inheritance, you can also get at the functionality of inheritance when you use composition.

As you all know, Inheritance is fundamental to object-oriented programming. A programming language may have objects and messages, but without inheritance, it is not object-oriented (merely "object-based", but still polymorphic).

Composition is also fundamental to every language. Even if the language does not support composition (rare these days!), humans still think in terms of parts and components. It would be impossible to break down complex problems into modular solutions without composition.

So, how can you possibly know what is the best? How to choose between composition and inheritance? Watch this video and find out!

If you have a question, email me at john@simpleprogrammer.com

If you liked this video, share, like and, of course, subscribe!

Subscribe To My YouTube Channel: http://bit.ly/1zPTNLT

Visit Simple Programmer Website: http://simpleprogrammer.com/

Connect with me on social media:
Facebook: https://www.facebook.com/SimpleProgrammer
Twitter: https://twitter.com/jsonmez

Other Links:
Sign up for the Simple Programmer Newsletter: http://simpleprogrammer.com/email
Simple Programmer blog: http://simpleprogrammer.com/blog
Learn how to learn anything quickly: http://10stepstolearn.com
Boost your career now: http://devcareerboost.com

Show more
Responsive image

Log in to comment


0

Up next