Hi Dude, great content. I have gone thorugh most of the design patterns now. Please share the source code for Facade, Proxy design pattern. Thanks in Advance :)
There is no specific reason for creating the facade in a separate library, you can of course have it in the same library as well. The only reason here is to separate the client component completely.
this is a sample implementation to understand facade - our login module interacts with multiple components and facade hides the complexity of interacting with those components. That way the login module implementor just needs to know about the facade interface and doesn’t need to know about the business complexity that facade deals with. I hope that was pretty much clear in the video. The idea behind introducing interface is that it helps in designing a loosely coupled application where if the authentication component developer wish to add some more authentication logic in future, then it can always do that without impacting the client. The application will work seamlessly as long as the interface definition does not change. But, off course we could have even implemented facade with concrete classes as well (without interface) btw, I have just used 1 interface per component here, but in real-time the system could be quite complex with many dependencies consisting many interfaces. There are many advantages of using interface - watch these 3 videos, I have explained 3 prominent advantage of using interface - IOC Container & DI : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-PAO9fAzz-GM.html writing testable code : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-mIVAhH9J60c.html loosely coupled app : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-tKJY5icC4eM.html
creating an instance with “new” keyword everywhere in your application makes your application tightly coupled. That’s where we use containers which takes the responsibility of creating an instance of our classes and gives us whenever required. Here this code block "services.AddSingleton();" adds our class to the container and gives it to our controller whenever it ask for. We are doing a constructor injection here. Please read about dependency injection You can get good in this video: IOC Container & DI : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-PAO9fAzz-GM.html Let me know if you have any further question, I will be happy to to clarify