Design Patterns: Dependency Inversion Principle Explained Practically in C# (The D in SOLID)

Поділитися
Вставка
  • Опубліковано 28 вер 2024

КОМЕНТАРІ • 775

  • @JamCram00
    @JamCram00 6 років тому +330

    These are the best series on SOLID in youtube. Thanks a lot.

    • @IAmTimCorey
      @IAmTimCorey  6 років тому +24

      I appreciate the kind words.

    • @aaen9417
      @aaen9417 5 років тому +5

      It's true. These are the videos with the best and simplest explanations.

    • @ChengZhangWhyNot
      @ChengZhangWhyNot 5 років тому +3

      It's true!

  • @liferide2002
    @liferide2002 6 років тому +65

    Dependency inversion is the principle; dependency injection is one way of making the principle work. - I love you man 5*****

  • @mralex6543
    @mralex6543 3 роки тому +5

    Man, I watched these videos as an experienced developer, I almost didn't learn something new.
    BUT I'm so amazed at your skills to explain things in such an interesting and ordered manner. I couldn't stop watching you.
    I'm so amazed that such quality content is available for free here.
    Thanks, man, you're doing a gorgeous job, hope more people will see these vids.

    • @IAmTimCorey
      @IAmTimCorey  3 роки тому +1

      Awesome! Thanks for the kind words.

  • @brendonanderson8673
    @brendonanderson8673 4 роки тому +15

    I actually finally understand abstract classes, interfaces and their purpose. This SOLID series helped me a lot!

  • @femloh
    @femloh 5 років тому +48

    By far the best explanation I have seen on dependency inversion. Thank you.

    • @IAmTimCorey
      @IAmTimCorey  5 років тому +1

      You are most welcome. Thanks for watching.

  • @Funkfreed
    @Funkfreed 4 роки тому +1

    My eyes lit up while watching this! 3 years ago a small company on a conglomerate project we had went live. They were using an automation approval tool that didn't allow much programming but had all the tools i.e. API call, SQL, WS, message builder etc. They were so dependent on this that the business logic was built into each approval flows. We had to do a lot of code changes every time the approval level change. I eventually had to implement a matrix table where all the approval flows adhere to. It made the application dynamic and they can control it however they want as long as they follow certain rules(like the interface).
    It's funny how this principle can be implemented on many other platforms. I think ServiceMesh also has the same concept. You have a lot of containers and they all follow a certain set of rules and all reports back to the command center.
    Thanks Tim for this wonderful lesson! As always you untangle the complication of many programming concepts. God bless you!

  • @jaminbenjamin6360
    @jaminbenjamin6360 5 років тому +3

    Finished with your SOLID videos and a few others about interfaces and generics. The way you SHOW the reasons to use SOLID and the fact that your examples are very similar to real life situations....it makes the content very easy to understand and retain in my mind. Can't thank you enough, I'm gonna watch ALL of your videos!

    • @IAmTimCorey
      @IAmTimCorey  5 років тому +1

      Awesome! I'm glad you are getting so much out of the content.

  • @Velreine
    @Velreine 6 років тому +3

    I just started looking at Design Patterns not more than a few weeks ago, even bought a course on Udemy.
    What are the odds that the best guy to explain complex principles comes in to rescue the day, just as I'm about to learn all this stuff.
    Thanks for these videos they are great.

  • @princeonukwili996
    @princeonukwili996 Рік тому +3

    Thank you Mr.Tim. You're like a father and a mentor to most developers out there, and a grandpa to newbies😂. I really learnt a lot. What brought me here is your tutorial on Dapper and minimal APIs where I asked why you created interfaces for each of the classes, and you replied because of Dependency injection. Since then I've been curious and I'm glad I finally got an answer. Thank you again sir. May God bless you in Jesus Christ name. Amen😌.

  • @nickfotopoulos5323
    @nickfotopoulos5323 5 років тому +4

    I learned more from this short video than I did in weeks of browsing and reading on the topic.

  • @faizalvasaya2998
    @faizalvasaya2998 5 років тому +1

    3 shots to the approach for explaining Dependency Inversion. It goes and sits into our heads and stays there for a long time.
    Keep up to good work Tim.
    You are really making it easy to learn software development.

    • @IAmTimCorey
      @IAmTimCorey  5 років тому

      I appreciate the kind words.

  • @xcyron
    @xcyron 2 роки тому +1

    This part was probably the most eye opening video of the series. I didn't really get why i should do this implementation at first, but after some time it clicked and became obvious why this is so powerful.
    Should i ever persue a career in c# programming, i will make sure to return the favor.
    Stay awesome Tim.

  • @Napkinholdin
    @Napkinholdin 2 роки тому +2

    OMG I watched only this one in the SOLID series and my mind is -blown-
    This is exactly how I always thought programming was supposed to be like but my formal education did not go over SOLID, I didn't even know it existed... Thank you so much!!

  • @heinzeckner3655
    @heinzeckner3655 4 роки тому +1

    After numerous videos and blogs, I understood for the first time how easy a factory method can be and where it can be placed. Most authors can or just want to explain it abstractly and academically - but you got to the point. Thanks a lot! ... An open question for me is whether the factory class from your specific example now violates the SRP principle... That's where it's going to be confusing to me all the time in OOP (coming from 15 years of procedural languages). Though I am firmly convinced and excited about the superiority of OOP - sometimes all that conventions/patterns seems to a large extent being busy clearing a lot of stuff from the living room into the kitchen and the hallway - only to conclude that at the end I am mostly in the living room and need most of the things right there :-)

    • @IAmTimCorey
      @IAmTimCorey  4 роки тому

      Yeah, you have to be careful how you do OOP that you don't just do it because you should. I try to be very pragmatic about what I do so that the patterns and systems work for me rather than against me. Now to answer your question specifically about the factory pattern, no, I don't think it violates SRP because it is doing one thing - instantiating classes. Now, it does have more than one reason to change in some ways but not if you look at it as the reason to change is when a class is added or changed. Ideally, you use a dependency injection system to make this even cleaner and easier to work with.

  • @nytofteAS
    @nytofteAS 6 років тому +102

    I have been taught here and there about the SOLID principles for over a year now. This seems to be the first time that I have really grasped these concepts completely and now also know how to use them. Thank you and great material in general.

    • @IAmTimCorey
      @IAmTimCorey  6 років тому +8

      Awesome! I'm glad it finally clicked. Using these principles can really improve your code.

    • @mihowbogucki4928
      @mihowbogucki4928 5 років тому +1

      Alexander Markussen totally agree. Thanks Tim Corey

  • @parko1965
    @parko1965 4 роки тому +1

    Brilliant, I didn't realise the power of interfaces until now.

  • @dancelmarkyosef
    @dancelmarkyosef 5 років тому +8

    "At some point, you have to new up an instance " this cleared my confusion

  • @DaNoob_777
    @DaNoob_777 6 років тому +7

    Hi Tim!
    Wow! Excellent series on design patterns! I didn't know syntax learning is only 10% and 90% is pattern designing.
    I enjoyed your teachings very much.
    Question 1:
    I understand you created the factory in the UI because it is the high level module. And the high level module
    should control the low level modules, not the other way around. However, you also said for simplicity sake, you
    created the factory class in the UI which is what you normally don't do. Where should we place the factory in the real world?
    Question 2:
    I think it would be beneficial to make the last video in the Design Patterns series to be a combination of all the principles applied
    and code it as if it was a real world example. Maybe use the C# Application From Start to Finish: Tournament series as the example.
    Better yet, it would be the ultimate series of videos that applies all the Design Pattern principles, Generics, Delegates, etc with the
    Tournament application. It would be more complicated but I think it would be beneficial for people who are beyond the syntax learning and
    principles. What do you think?
    Thank you for all that you do! You are simply awesome!

    • @IAmTimCorey
      @IAmTimCorey  6 років тому

      It is 10% syntax, 90% logic (which design patterns would fall into but it isn't limited to just them). As for your questions, where I place my factory depends a bit on the application but it usually goes in the UI or in a high-level class library. However, typically I just use a Dependency Injection tool called AutoFac and don't bother with a factory.
      As for combining all of the design patterns, yep, I'm thinking through how to do that. It probably will be a start to finish course or something like that.

    • @whatsupbudbud
      @whatsupbudbud 6 років тому

      Tim, let's say I'm making a Winforms app that has three layers: 1) Model library; 2) View (UI); 3) Presenters + Controller. How would I actually go about implementing the controller part? Most videos, including yours, put the main logic flow code in the Main() class of either the console app or a forms app but this gets quite complicated fast.
      Ideally, I'd like to implement a design like this: Program entry point is the main controller which works in collaboration with data handling (separate library) and multiple view presenters.
      Let's say I click a button on my app. I'd like for the form not to have any logic except to propagate this event to the controller which would invoke this particular form's presenter to DoStuff(). Not quite sure how to accomplish this, especially if I have a MainView that the controller launches but into which I need to add other forms with, preferably, their own separate controllers. Where does Autofac go in this model? It seems that to use it you have to instantiate the container in just one place and do all the controlling logic from that place...

  • @mondem211
    @mondem211 3 роки тому +3

    Thank you, Tim. This series has been eye-opening! I might have to go over Liskov Substitution principle once more but I look forward to it. You have a fascinating skill in articulating what some would find difficulty in explaining. Thank you so much!

    • @IAmTimCorey
      @IAmTimCorey  3 роки тому

      I am glad my content has been helpful.

  • @BeLKa4444
    @BeLKa4444 5 років тому

    I spent +/- 4 hours (with breaks and by making a lot of notes) to finish your video. You know what? It is definitely worth your time.
    Thank you for sharing this knowledge with people!

    • @IAmTimCorey
      @IAmTimCorey  5 років тому +1

      I am glad you got a lot of value out of this video. Good job going beyond listening to actually studying what you watched.

  • @RalfsBalodis
    @RalfsBalodis 4 роки тому +10

    0:00 - Intro
    1:43 - Demo code walk through
    4:40 - Dependency Inversion Principle: DI Explained
    7:42 - Implementing DI: Demo code refactoring
    26:15 - Benefits of DI: Changing the code
    27:18 - Benefits of DI: Modular code
    29:10 - Benefits of DI: Dependency injection
    33:03 - Benefits of DI: Unit testing
    37:32 - Summary and concluding remarks

  • @paulroos8517
    @paulroos8517 4 роки тому +1

    Wow! I have years of experience and I think your tutorial is very useful. What I like is, you get to the point. I am going to look at more of your tutorials. Thank you very much.

  • @vartikagupta8816
    @vartikagupta8816 3 роки тому +1

    The best explanation of SOLID principles I have ever seen/read. Tim, you should also do a series on the various design patterns like Factory, Observer etc.

  • @thesophisticatedvelocirapt7320
    @thesophisticatedvelocirapt7320 3 роки тому

    If I watch all of Tim Corey's videos, I'm pretty sure I can get 2 or 3 promotions at once. Seriously, these are the best videos I have ever seen.

  • @subashbarik
    @subashbarik 2 роки тому +1

    It is so nicely explained that it is impossible not to understand. Great Video, I wish I would have watched these SOLID videos before.

    • @IAmTimCorey
      @IAmTimCorey  2 роки тому

      I am glad they were so helpful.

  • @SuperPizdolizac
    @SuperPizdolizac 6 років тому +12

    finally, I understand this principle...thank you Tim, as always!

  • @papillonx101
    @papillonx101 6 років тому +1

    Tim, your SOLID principle explenation is far better and superior to any other tutorial on SOLID so far.

    • @IAmTimCorey
      @IAmTimCorey  6 років тому +1

      I'm glad you think so. Thanks!

  • @rajnhard
    @rajnhard 5 років тому +1

    One of the most useful C# channel out there. Thank you for your will to share the knowledge with us Tim!

  • @MonteMusicChannel
    @MonteMusicChannel 3 роки тому

    Absolutely one of the best SOLID youtube series, well done ! I was struggling refactoring my highly dependant codebase and now i'm refactoring all of my apps one by one, making it more modular/extendable. Big thanks !

  • @muhamadhanifsafwanabrazak551
    @muhamadhanifsafwanabrazak551 5 років тому

    i learned at my university what is interface, abstract and so on... but have no idea how and when to use them in my development (im a noob obviously), but after watch your SOLID videos, i finally have a strong understanding on how to use them. Thank you so much

  • @tomarik
    @tomarik 3 роки тому +2

    Thank you for making these videos. Watching them SOLID in practice has been immensely helpful.

    • @IAmTimCorey
      @IAmTimCorey  3 роки тому +1

      I am glad my content has been helpful.

  • @kbtravels
    @kbtravels Рік тому

    Best explanation on DI I've found on UA-cam. Thanks!

  • @thePavuk
    @thePavuk 3 роки тому

    This is very important part of SOLID. It completely changes way how to solve problem with class dependency.

  • @alinapostol2230
    @alinapostol2230 3 роки тому

    Indeed as many comments state, THIS IS THE BEST SOLID-SERIES ON UA-cam. Thank you for taking the time to explain these concepts in an easy-to-understand way & using accurate examples. I've read about SOLID and watched many YT videos about them, but YOUR videos are the one who made see through and clearly understand why they exist and how they make our life so much easier... Thank you for all the effort, you deserve MORE SUBS!!

  • @tin3089
    @tin3089 7 місяців тому

    Thank you so much for your content, this helped me A LOT with one of my more difficult courses in college. I've watched all 5 of your SOLID videos, and I'm continuing :D.

  • @kanha12297
    @kanha12297 11 місяців тому

    Best explanation, after struggling to understand dependency inversion and watching tons of youtube videos which just describe what the principle definition is, found this amazing channel ❤

    • @IAmTimCorey
      @IAmTimCorey  11 місяців тому +1

      I am glad it was helpful.

  • @nedbog
    @nedbog 6 років тому +1

    Just wow. One of the best! The gang of four: Tim Corey, Mosh Hamedani, Colt Steele and Brad Traversy.

  • @abdulrahmannady6953
    @abdulrahmannady6953 2 роки тому

    I was struggling to understand why I do this by default in .NET core after watching this video everything is clear now I'm very thankful for you sir and your free content which helps me a lot through my entire career and wish you all the best God bless you

  • @mjbarge
    @mjbarge 4 роки тому +1

    Thanks to this, finally I get Dependency Injection - such a relief, thank you so much Tim!

  • @ldiniz_x
    @ldiniz_x 2 роки тому +1

    Thanks for these amazing SOLID classes, Tim.
    I'm reading Clean Architecture by Uncle Bob and your videos helped me a lot in terms of seeing things working on the real world.

  • @torrvic1156
    @torrvic1156 25 днів тому

    After some time passed and I’ve got some experience I really understood what this video was all about. Thanks a lot! Now I finally understood it.

  • @chad.williamson
    @chad.williamson 3 роки тому +2

    I've been writing code for 15+ years. I still watch Tim to remind myself of best practices.

  • @gdk870
    @gdk870 4 роки тому +1

    This was an excellent series on the SOLID principles. I am not a patreon member so i am aware of how this next request will seem out of place. The request is to consider an idea for your next video series called "Signs That You Might Be Misusing the SOLID principles". These series goes through each of the said principles from SRP to DIP, and examines how each could be misused. It would be useful for those like myself, who tend to overdo (obsessively compulsive).

    • @IAmTimCorey
      @IAmTimCorey  4 роки тому +2

      I will add it to the list. Thanks for the suggestion. And the request was not out of place. I encourage people to leave their suggestions. I create content based upon the expressed needs of people. I don't require people to pay to make a suggestion. My paid content is solely their to help fund my free content.

    • @gdk870
      @gdk870 4 роки тому

      @@IAmTimCorey Okay that's really gracious of you. I'll keep a look out. Thanks you for all you do.

  • @VaderFaderVader
    @VaderFaderVader 6 років тому

    When i started learning to program, the first thing i focused on was syntax and semantics. I thought that once I understood that, programming would be easy.
    But then I realized that understanding how to structure and design an application is equally important to learning the particulars of the language, if I wanted to progress past simple "Hello World"'s.
    That's when I understood the benefit of - and necessity of learning - design principles.
    Your series on SOLID is pure gold for someone like me struggling to cram all this stuff into my tiny, little brain.
    It also seems to me that studying SOLID is a more productive path than the GOF Design Pattterns; it relates better to the real and actual situation of writing and thinking code.
    I'm really looking forward to the follow ups on DI and IOC, and have one request for when you do:
    If possible, I would prefer to not deal with external frameworks, but rather focus on implementing DI/IOC direclty in plain C#.
    The reason is that I feel that frameworks can sometimes become an obstacle, when I'd prefer to just focus on the raw implementation.
    Thanks for this excellent series!

    • @IAmTimCorey
      @IAmTimCorey  6 років тому

      Yep. I tell people that the syntax is 10% of what you need to know. The other 90% is the logic of how to put it together. People often get stuck on learning the 10% but forget to learn the 90% (which is mostly learned through practice). As for doing DI/IoC without a framework, I'm not sure I'll do that right out of the gate. There is so much to learn if you roll your own. I will probably do that at some point but it is the difference between teaching ADO and Dapper. Sure, ADO is closer to the bare metal but Dapper gets you there so much faster. I'm working hard to teach it in a very clear manner that can provide you with more benefits than drawbacks. Still working through the scenario.

  • @dionkllokoqi6981
    @dionkllokoqi6981 3 роки тому

    Best software development channel on youtube by far!

    • @IAmTimCorey
      @IAmTimCorey  3 роки тому +1

      Thanks! Be sure to check out the Blog and Podcasts at IAmTimCorey.com

  • @casualoverwatcher2283
    @casualoverwatcher2283 2 роки тому +1

    Even with your clear and beautiful diction recorded in this video, I needed a subtitle because English is my second language. I can't stop laughing at the auto-generated subtitle "nude up" when you said "new'd up". Yes, I'm still childish 🤣

  • @MichalSmola8
    @MichalSmola8 5 років тому

    This is gold! Finally I can say I understand DI - thank you. And in case you don't overuse mouse only to make it easier for us to follow what you are doing (like when you were replacing commas with semicolons) - by pressing Ctrl+Left/Right you can move cursor through code much faster.

    • @IAmTimCorey
      @IAmTimCorey  5 років тому

      Awesome! And thanks for the tip.

  • @anass9487
    @anass9487 5 років тому +15

    I genuinely loved this video. Thank you!

  • @michaelreynolds4816
    @michaelreynolds4816 4 роки тому

    I concur with JamCram00's comment below. I have also been a Pluralsight subscriber for more than 5 years and I find these videos to be at least as good and as thorough. Please keep them coming, Tim and I will support you with a donation as soon as I find the link to do so.

  • @JohanVergeer
    @JohanVergeer 5 років тому

    Just like all other videos I've seen from you so far. Amazing. This is the first time for me everything comes together and makes sense as a whole. Thank you for that.
    I have heard and read about the SOLID principles a couple of times now, and when dealing with just (C#) code, it starts to make a lot of sense. Where I'm still struggling at this point is how these principles apply to IO. Like in databases or on screen. (Users these days don't really know how to work with a console.)
    As an example, what I would be really interested in seeing is how you would persist the models you created in the last two video's (employee and library) and what this would look like with MS Entity Framework. This would also apply for Java Spring, or other ORM's, but as you say, this channel focuses on C#.

    • @IAmTimCorey
      @IAmTimCorey  5 років тому

      If you stay tuned to my current series (the TimCo Retail Manager), you will see DI being used in a WebAPI and probably the WPF app too.

  • @maheshrajputcollege
    @maheshrajputcollege 10 місяців тому

    The way explained Dependency Inversion is super easy. Create a video on the Inversion of Control too as Dependency Injection is one way to achieve the goals of both Dependency Inversion and Inversion of Control.

  • @Developer-404
    @Developer-404 4 роки тому

    You are a big fan of S.O.L.I.D ,and I am big fan of S.O.L.I.D and you both . Thank you for this.

  • @paulofernandoee
    @paulofernandoee 2 роки тому

    These are the best series on SOLID in youtube.(2)
    Great job!

  • @atul121984
    @atul121984 6 років тому +1

    Best description of Dependency Inversion...Thanks a lot Tim...

  • @mhady
    @mhady 5 років тому

    This is by far the best tutorial about Dependency Inversion principle, it's the first time i really think i understand the concept. great work Tim

    • @IAmTimCorey
      @IAmTimCorey  5 років тому

      Awesome! I'm glad it finally clicked for you.

  • @XDBjoernXD
    @XDBjoernXD 5 років тому

    I like that you explain it in the bigger picture. That's a way I can easily understand through your great video. I am very glad that you take your time for this great YT channel. Have a good day!

    • @IAmTimCorey
      @IAmTimCorey  5 років тому

      I appreciate the kind words.

  • @danielbreen3945
    @danielbreen3945 5 років тому

    Came here to learn about the DIP; Got the added bonus of learning about factories.

  • @ionutiancu5395
    @ionutiancu5395 2 роки тому +1

    Reaching the end of the SOLID series, i have to say that it feels Tim had the worst bosses in the world. Besides that these videos on SOLID are timeless, amazing work, awesome explanations and on point examples to understand real life scenarios.

    • @IAmTimCorey
      @IAmTimCorey  2 роки тому +1

      I've had some great bosses and some...challenges. Now I work for myself, so...no comment. 😆

  • @mijaved
    @mijaved 3 роки тому

    After watching tons of videos, this practical tutorial made the DIP concept crystal clear, thanks a lot!

  • @kopilkaiser8991
    @kopilkaiser8991 Рік тому

    Thanks Tim. You are the best. I found this video very helpful and informative. You have a talent to explain concepts simply and easy to understand. At times, I struggle to understand these concepts from other sources because they over complicate the concept. But, you on the other hand cover all spots but still being able to make sure the viewer understands most of the explanation! At least I understood almost most of the part, it is just I have to review it couple of times to make sure it all makes sense.

  • @secretsquirrel5566
    @secretsquirrel5566 3 роки тому

    Wow is this good. I know I have to watch it like three more times to completely get it all, but did I ever learn a lot from this. THANK YOU TIM

  • @always90s
    @always90s 4 роки тому

    I did not realize that factory methods get replaced by a DI framework. Not replace but I see how they are no longer needed if you have a DI framework. Great videos.

  • @pepperplume
    @pepperplume 5 років тому

    I watched your series, i find that SOLID principles attempt to tackle a different facet of programming that everyone will encounter, i believe the follow is a fair summary of these principles:
    S => is for changing existing code, to reduce any side-effects or bugs with the change
    O => is for adding new code, again to reduce any side-effects or bugs with the addition
    L => provides guidelines for Inheritance, which i hear no one defends anymore and is far less favored than composition
    I => provides guidelines for interfaces because everything will depend on interfaces
    D => is designing your software to be modular which is possible because everything depends on interfaces
    Its clear to see how these principles synergize with each other

    • @IAmTimCorey
      @IAmTimCorey  5 років тому

      I would say that is a mostly accurate assessment. I would disagree on LSP. LSP basically defines the "is a" relationship of inheritance. Composition doesn't affect that, it just reduces the amount of inheritance we do. In fact, LSP actually encourages composition because we were abusing inheritance before.

  • @abhaynath5833
    @abhaynath5833 2 роки тому

    This is hands down the best explanation of dependency inversion. Thanks a lot 🙏🙏🙏

  • @Calex23
    @Calex23 6 років тому +5

    These are so helpful and clear. Thank you for taking the time to make these. It's greatly appreciated

    • @IAmTimCorey
      @IAmTimCorey  6 років тому +1

      Awesome! I'm glad they are clear and helpful.

  • @iuriikryvenko3775
    @iuriikryvenko3775 6 років тому +1

    Great explanation in code samples, great english diction, fabulous video quality with understandable extra info about every topic! Many thanks! You've made me to write a comment... I did it only few times in my life! PS : Intresting topics for me: DI, IOC, mocks, some project examples with DAL, BAL separation. Thanks a lot and good luck in all your hard work!

    • @IAmTimCorey
      @IAmTimCorey  6 років тому +1

      Excellent! Those videos are all coming soon. Thanks for the suggestions.

  • @GuySymonds1
    @GuySymonds1 4 роки тому

    Dependency Inversion without Dependency Injection, this is pure gold.

  • @nils1543
    @nils1543 3 роки тому +1

    Wait, you spent 4.5 hours taking out the trash!? :D
    Seriously, great video! I wish I'd understood this a long time ago...

  • @AnanndDhamane
    @AnanndDhamane 4 роки тому +1

    You are really making Coding Simple. Thanks a lot Tim.

  • @n9434178
    @n9434178 6 років тому +2

    Thank you Tim! I really learned a lot from the SOLID series and looking forward to what's up next.

    • @IAmTimCorey
      @IAmTimCorey  6 років тому +2

      Excellent. I'm going to cover a couple of one-off topics next but I will be returning to add more to the design patterns series. I'm glad you've enjoyed it so far.

  • @LONGLACA
    @LONGLACA 5 років тому +1

    Thank you, Tim, your examples are very easy to understand the principles

  • @321zipzapzoom
    @321zipzapzoom 4 роки тому

    Truely awesome explanation of concepts Mr. Corey ..I feel now confident enough to recommend this SOLID series to folks in my circle to extend the ongoing Chain of Viewers.

  • @KentBrakewell
    @KentBrakewell 3 роки тому

    That refactor involving commented code when updating existing code to use the Factory class reminded me that I want "with blocks" in C#, like VB.

  • @Billbillbillhahagdvdve
    @Billbillbillhahagdvdve 4 роки тому +2

    Bigup to Tim ! Love your channel - your pace is perfect and your emphasis on the key parts is amazing (e.g. We are looking to great rid of "new" is such a great way to describe dependency inversion) - Shared, Liked and Subscribed !

    • @IAmTimCorey
      @IAmTimCorey  4 роки тому +1

      I am glad you are enjoying the content.

  • @arnabbiswas4832
    @arnabbiswas4832 4 роки тому +1

    Very nice explanation. Thanks. Are you planning for any video series on Design patterns in C#?

  • @zulhishamtan4308
    @zulhishamtan4308 3 роки тому

    This is the SOLID video in the world of programming.

  • @TuncTurel
    @TuncTurel 2 роки тому

    Love it! Succinct and thorough. I read five different sources but your video is what made it crystal clear for me.

  • @PS-vj6jz
    @PS-vj6jz 2 роки тому

    THE BIGGEST THANKS FOR THIS VIDEOS ABOUT PRINCIPLES!

  • @muralidharmoka
    @muralidharmoka 3 роки тому +1

    These videos are awesome. Really useful videos for jobs.

  • @peterlustig3077
    @peterlustig3077 5 років тому

    Hi Tim, you bring a light to me. I have a way better understanding of these principles. Greetings from Berlin, Germany.

  • @mahaswamy
    @mahaswamy 4 роки тому

    SOLID simplified in the right way, great refresher course...

  • @pierrebertin4364
    @pierrebertin4364 2 роки тому

    As always Tim, huge content, very well explained. Do thank you for that! I did like the fact that you insist on differences between DInj and DInv.

  • @FD286
    @FD286 5 років тому +1

    Very cool, different than the way I normally program but your example at the end of switching out the database framework is very good. Unit testing seems like it could be useful as well. Will try to integrate these ideas into my coding style.

    • @IAmTimCorey
      @IAmTimCorey  5 років тому +1

      Awesome! It can definitely be really helpful.

  • @GuRuGeorge03
    @GuRuGeorge03 3 роки тому

    I came to the conclusion of using this principle on my own after struggling and trial and erroring a TON. Then a coworker said to me "man, why are you overusing DI so much?" and I had no idea what he meant, then I started googling it and now I am addicted to the world design patterns, lol.

  • @Neo8019
    @Neo8019 4 роки тому +1

    Just completed your series on SOLID for the second time with a month break in between to make sure It stays in the brain. First of all thanks for great quality videos, they are easy to understand. Now I have to go and change a lot of code.
    I got one question about this video. You say its best not to use "new" and instead put it in the factory class. Would that apply to everything? What about new List, array or stringBuilder etc., would I have to do a similar thing with them so I don't break SOLID?

    • @IAmTimCorey
      @IAmTimCorey  4 роки тому +2

      It typically does not apply to List or Models. Usually you only apply it to dependencies that might need to be replaced.

    • @Neo8019
      @Neo8019 4 роки тому +1

      @@IAmTimCorey Thank you for taking the time to reply.

  • @stefanlarie2151
    @stefanlarie2151 3 роки тому

    man, cleaning the code is a art

    • @IAmTimCorey
      @IAmTimCorey  3 роки тому

      It really is. Programming in general is an art rather than a science.

  • @josebaiturregui37
    @josebaiturregui37 Рік тому

    Tim.. when i see your videos i have to put the speed in 1.5x.. so my advice is make a simpler point for the videos.. you're much around to get on the point.. i'm telling you this as a constructive input.. congrats for your acomplishments which are many.. cheers

  • @lucmagnee4633
    @lucmagnee4633 3 роки тому +1

    An excellent tutorial‒as are all the other tutorials you have published so far. Thanks again for all your efforts and for sharing these high quality videos !
    Consulting Wikipedia (en.wikipedia.org/wiki/Interface_segregation_principle) I found this story that perfectly illustrates a use-case in the "real world" of the two last principles (ISP and DIP) in your SOLID series:
    " (ISP) was first used and formulated in 1996 by Robert C. Martin while consulting for Xerox. Xerox had created a new printer system that could perform a variety of tasks such as stapling and faxing. The software for this system was created from the ground up. As the software grew, making modifications became more and more difficult so that even the smallest change would take a redeployment cycle of an hour, which made development .
    The design problem was that a single Job class was used by almost all of the tasks. Whenever a print job or a stapling job needed to be performed, a call was made to the Job class. This resulted in a 'fat' class with multitudes of methods specific to a variety of different clients. Because of this design, a staple job would know about all the methods of the print job, even though there was no use for them.
    The solution suggested by Martin utilized what is today called the . Applied to the Xerox software, an interface layer between the Job class and its clients was added using the (DIP). Instead of having one large Job class, a Staple Job interface or a Print Job interface was created that would be used by the Staple or Print classes, respectively, calling methods of the Job class. Therefore, one interface was created for each job type, which was all implemented by the Job class."

  • @BillyNeverDies
    @BillyNeverDies 2 роки тому

    My sense of shame about my code has increased 10X since watching this series. This will change how I approach it from now on.

    • @IAmTimCorey
      @IAmTimCorey  2 роки тому +1

      I hope you can move past that. There's no need for shame. We all have to learn over time. You just found something new to make your code even better. That's great! Keep it up.

  • @olivier5431
    @olivier5431 Місяць тому

    Very informative, fascinating and very well done! Thanks.

  • @gravytrain1547
    @gravytrain1547 6 років тому +2

    You are a great teacher! Thank you so much.

  • @rasulseidagul
    @rasulseidagul 3 роки тому

    Everyone:
    Oh, man, your video is amazing. Thank you so much! I Learned A Lot!
    My bleeding eyes:
    Why? Why you need to create Logger class instance each time you just log something?
    You at least could wrote it as struct...

    • @IAmTimCorey
      @IAmTimCorey  3 роки тому +1

      We create a new instance in each class so that it can pick up which class called it.

  • @SachidanandUpadhyay7
    @SachidanandUpadhyay7 5 років тому

    your content is very strong to understand the concept, I would like to suggest if you bit brief with live type project or content. Best Video I ever found

    • @IAmTimCorey
      @IAmTimCorey  5 років тому

      Thank you!

    • @SachidanandUpadhyay7
      @SachidanandUpadhyay7 5 років тому

      @@IAmTimCorey ASP.net MVC or Web Api N-Tire Architecture. can you explain or can i get good source code ? how much i have to pay?

  • @argelpamintuango1956
    @argelpamintuango1956 5 років тому +1

    I caught the thought! Thanks Mr. Tim!

  • @giridharamadhavan2200
    @giridharamadhavan2200 3 роки тому

    The best SOLID explanation. Thanks a ton Tim! :)

  • @queenstownswords
    @queenstownswords 4 роки тому

    Tim, yet another good video. You had me lol on the example "What if the boss wants to move from SQL Server to Oracle?"... good one!

  • @everettbuddenberg7729
    @everettbuddenberg7729 6 років тому

    Tim. Much appreciated. This complex principle was made easy to understand.

  • @GrahamStw
    @GrahamStw 4 роки тому

    To take your example one step further, the Factory itself could also have an interface.
    That way you can have different IFactory implementations that represent different valid configurations of your application.

  • @sparshprasad621
    @sparshprasad621 3 роки тому

    Wonderful explanation of S.O.L.I.D !!!

  • @STUPIDYOUTUBE_HIDINGMSGS
    @STUPIDYOUTUBE_HIDINGMSGS 4 роки тому +2

    Thank you for this, that differentiates (or clears the distinction) with dependency inversion vs. injection. You're awesome, Tim!