Back to Browse

Dependency INVERSION vs Dependency INJECTION in Python

177.2K views
May 14, 2021
17:51

💡 Learn how to design great software in 7 steps: https://arjan.codes/designguide. 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. 🎓 ArjanCodes Courses: https://www.arjancodes.com/courses. 💬 Join my Discord server: https://discord.arjan.codes. ⌨️ Keyboard I’m using: https://amzn.to/49YM97v. 🔖 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

Download

1 formats

Video Formats

360pmp434.1 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

Dependency INVERSION vs Dependency INJECTION in Python | NatokHD