Dependency INVERSION vs Dependency INJECTION in Python
What's the difference between dependency inversion and dependency injection? Dependency injection is a design pattern that splits creation of objects from their usage. Dependency inversion is a design principle that promotes using abstract classes and interfaces to better separate code. Watch this video to see a few practical examples in Python, and how these concepts help you write nice code that's easy to test.
The code I worked on in this example is available here: https://github.com/ArjanCodes/2021-dependency-injection-inversion.
? 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-python
The 30-Day Design Challenge: https://www.arjancodes.com/30ddc
? GEAR & RECOMMENDED BOOKS: https://kit.co/arjancodes.
A few interesting links to articles and books:
- Design Patterns: Elements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides: https://amzn.to/3jllgyH
- Principles of Package Design: Creating Reusable Software Components by Matthias Noback: https://amzn.to/2NETK3l
- Clean Code: A Handbook of Agile Software Craftsmanship by Robert Martin: https://amzn.to/3qVZgNs
- The original Design Principles and Design Patterns article by Robert Martin: https://fi.ort.edu.uy/innovaportal/file/2032/1/design_principles.pdf
? If you enjoyed this content, give this video a like. If you want to watch more of my upcoming videos, consider subscribing to my channel!
? Join my Discord server here: https://discord.arjan.codes
?Twitter: https://twitter.com/arjancodes
?LinkedIn: https://www.linkedin.com/company/arjancodes
?Facebook: https://www.facebook.com/arjancodes
? Chapters:
0:00 Intro
0:20 What is a dependency?
1:10 Dependency injection
1:36 Dependency inversion
2:03 Example code
3:22 Example unit tests
5:32 Issues with testing
6:37 Applying dependency injection
8:35 Writing the unit tests
11:20 Applying dependency inversion
12:51 Coverage reports and abstract classes
14:16 The power of dependency inversion
14:49 Adding another authorizer
15:44 Adding tests for the Robot authorizer
17:10 Summary
#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!
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Dependency INVERSION vs Dependency INJECTION in Python», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.