Prefer Composition Over Inheritance - A Real-World Example

Опубликовано: 18 Декабрь 2024
на канале: Shiv Kumar
5,130
154

Prefer Composition Over Inheritance is an important tenet of Object oriented programming, but what's so bad about Inheritance? In this video, we'll explore some of these problem with an example of a real-word scenario and then also look at a solution to the problem using Composition.

Source for the Visual Studio Solution discussed in this video:
https://github.com/matlus/PreferCompo...


Bookmarks
00:00 Intro
00:18 What are we learning Today?
01:15 The Real Issue with Inheritance
02:08 Reasons Not to Use Inheritance
02:58 My Opinion On Inheritance
03:32 The Example Code/Project
03:48 Not A Big Fan of Libraries/Reuse
04:28 The Genesis of this Video
05:06 The Rule Of Thirds
06:46 Problems with Libraries/NuGets
08:53 The Root of the Problem
14:03 What's the Solution?
19:07 The Solution Explained
20:42 Visual Studio Solution Walkthrough
22:41 The Specialized Classes
24:22 The Compositing ConfigurationProvider
24:51 Reuse through Composition
27:38 Composition vs Aggregation