Protocol Or ABC In Python - When to Use Which One?
ArjanCodes ArjanCodes
249K subscribers
202,683 views
6.7K

 Published On Oct 29, 2021

When should you use protocol classes vs abstract base classes? Here's an example where I use both, talk about the trade-offs, and give you a suggestion of when to use each of them.

The code I worked on in this video is available here: https://github.com/ArjanCodes/2021-pr....

💡 Here's my FREE 7-step guide to help you consistently design great software: https://arjancodes.com/designguide.

🎓 Courses:
The Software Designer Mindset: https://www.arjancodes.com/mindset
The Software Designer Mindset Team Packages: https://www.arjancodes.com/sas
The Software Architect Mindset: Pre-register now! https://www.arjancodes.com/architect
Next Level Python: Become a Python Expert: https://www.arjancodes.com/next-level...
The 30-Day Design Challenge: https://www.arjancodes.com/30ddc

🛒 GEAR & RECOMMENDED BOOKS: https://kit.co/arjancodes.

💬 Join my Discord server here: https://discord.arjan.codes

🐦Twitter:   / arjancodes  
🌍LinkedIn:   / arjancodes  
🕵Facebook:   / arjancodes  

👀 Channel code reviewer board:
- Yoriz
- Ryan Laursen
- Sybren A. Stüvel
- Dale Hagglund

🔖 Chapters:
0:00 Intro
2:01 Explaining the example
5:56 About abstract base classes
8:47 Protocols, nominal typing and structural typing
10:41 Using protocols
15:34 Splitting the Device class
20:05 When to use protocols vs abstract base classes

#arjancodes #softwaredesign #python

DISCLAIMER - The links in this description might be affiliate links. If you purchase a product or service through one of those links, I may receive a small commission. There is no additional charge to you. Thanks for supporting my channel so I can continue to provide you with free content each week!

show more

Share/Embed