Комментарии:
best tutorial for advance topics
ОтветитьDependency inversion is the process of introducing a new layer between objects in the form of abstract class to reduce dependancy between objects directly and also means that these can be replaced with their subtypes. - This is hands down the most simple definition I have ever heard. Thank you so much.
ОтветитьThose are authenticators (authN), not authorizers (authZ). The user has the phone, and enters the 6 digits, so you know they're the user.
Knowing the user is who you think they should be is only half the battle! You have to get consent (authoriZation)!
I still don't understand Dependency Injection
ОтветитьThanks!
ОтветитьThis is a wonderfully clear explanation of a potentially very complex topic. Thank you very much. I tend to prefi my instance variables with _ (e.g. self.autborizer) so that mypi will warn if I call it from outside the class. This avoids accidentally introducing coupling through injected components.
ОтветитьArjan, is it not more convenient to use pytest instead of unittest? Seems to be simpler and (maybe?) more flexible?
ОтветитьReally nice videos I have learned a lot.
ОтветитьThat is true in Java but in Python we have other ways to solve this issue.
Ответитьspring
oh, sorry, wrong channel
You are the best 🤩
ОтветитьThis is great, thank you.
ОтветитьThis dude it got it backwards.
ОтветитьIt looks like generate_sms() is not called as part of the new code. How will you retractor the codes so it is included when the class authorise_sms is used and excluded while authorise_robot is used?
ОтветитьIs there a blog post explaining dependency inversion in relevance to file structure?
ОтветитьNice video. One important detail you could add for tests is that instead of instantiating an actual object we normally create a mock object which inherits the abstract class. The mock implementation obviously will have dummy return values. But that will highlight the true power of dependency injection in lieu of unit testing.
ОтветитьAwesome video, explanations, and examples! Thank you!
ОтветитьAt least learn the script for your videos from good sources. It's "Inversion of Control" or IoC, not "Dependency Inversion". And in fact, you are wrong, you don;t need both for high quality code... maybe in your company... but perr recognition is not what we seek, we seek understanding, right? The correct statement is You'll need follow IoC principles, so you can take advantage if it using DI paradigm.
please, language ;)
Awesome explanation thank you took plenty of notes!
ОтветитьThanks.
ОтветитьThis is inacurate. You don’t understand what dependency inversion is. You said: „without dependency injection there is no dependency inversion”
Dependency inversion is a reversal of the traditional dependency wherby high-level class depends on low-level class. It happens when both low level and high level classes start relying on abstract class and for that to happen you absolutely don’t need dependency injection.
But how do you inject objects deeper in call hierarchy??
ОтветитьI'm new to python, I'm wondering why use an Abstract class for the Authorizer, why not use an interface?
ОтветитьI wonder if you can use pyproject.toml instead of files like .coveragerc, I think it should be possible and would be nice to have all these settings in 1 file. Anyway, if you didn't make a video about pyproject.toml, I think you should, it is pretty overpowered :)
ОтветитьFinally I can see an example to understand DI clearly. Thank you Arjan for your explanation :)
Ответитьpytest FTW!
ОтветитьI absolutely love this channel! Its pure joy to watch these tutorials! Thanks a lot!
ОтветитьThank you! I watched a dozen videos on the topic, but this one not only explained it in the best way, but also felt like a way more complete explanation!
ОтветитьYou're too damn good
ОтветитьDependency inversion is then something like the maxim "couple to interfaces, not implementations".
ОтветитьIs dependency inversion just Dependency Injection + Strategy Pattern?
ОтветитьDependencie injection is not the only tool for dependency inversion. If you rely on DI too much, then you'll get into mock hell
ОтветитьCan you check subtitle in video? It seems to not support English.
ОтветитьNice!
ОтветитьAs ever, an excellent video but could I just recommend that watchers follow this up with Code Aesthetic's equally excellent Dependency Injection video.
Ответитьso dependency injection is the way to pass a class and inversion is the interface / abstract so the passed class not tied to one specific class. noted, thank you mr arjan
ОтветитьIs this abstract class or "intermediate layer" as you call it an interface? If not, what's the difference between such an abstract class and an interface?
ОтветитьOOP brings a whole other level to programming. Much more than watching simple C language tutorials. I can't imaging Oracle bringing these OOP concepts to PL/SQL...or GNU Scheme...? Didn't the industry switch to Data Oriented Programming?
Ответитьlove your channel but you seem to break pep 8 from time to time. or maybe I'm not up to date. e.g. class name with mix of snake case and camel case.
Ответитьsuperb.
what should be the guideline to splitting it properly?
You are the coolest developer ever
ОтветитьIs there a reason the PaymentProcessor needs to take an authorizer argument at all instead of there being another process_order method on the Order class which authorizes the user and then takes payment? Is it because payment shouldn't be possible without authorization every time, so the strict usage of authorize inside pay method is necessary?
Would refactoring authorize and pay to happen separately but inside a process_order method also be dependency inversion?
If I understood this correctly an extra layer of abstraction is created between the Authorizer subclasses and the PaymentProcessor, where do we define which Authorizer is used? Am I missing something
ОтветитьFinally clarified the differences between them, Thank You Arjan!
ОтветитьFinally upgraded to better microphones for this video!
Ответить