Uncle Bob’s SOLID Principles Made Easy 🍀 - In Python!

Sdílet
Vložit
  • čas přidán 4. 06. 2024
  • In this video, I discuss the SOLID design principles by Robert Martin (Uncle Bob) using practical examples in Python. Though the SOLID principles are one of several sets of software design philosophies, and arguably quite specific for Object-Oriented programming, they are the most well-known and easy to apply to your own code.
    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: amzn.to/3jllgyH
    - Principles of Package Design: Creating Reusable Software Components by Matthias Noback: amzn.to/2NETK3l
    - Clean Code: A Handbook of Agile Software Craftsmanship by Robert Martin: amzn.to/3qVZgNs
    - The original Design Principles and Design Patterns article by Robert Martin: fi.ort.edu.uy/innovaportal/fi...
    💡Here's my FREE 7-step guide to help you consistently design great software: arjancodes.com/designguide.
    🎓 Courses:
    The Software Designer Mindset: www.arjancodes.com/mindset
    The Software Designer Mindset Team Packages: www.arjancodes.com/sas
    The Software Architect Mindset: Pre-register now! www.arjancodes.com/architect
    Next Level Python: Become a Python Expert: www.arjancodes.com/next-level...
    The 30-Day Design Challenge: www.arjancodes.com/30ddc
    🛒 GEAR & RECOMMENDED BOOKS: kit.co/arjancodes.
    You can find the code I worked on in this episode in my GitHub repository: github.com/arjancodes/betterp...
    All parts in this series:
    Part 1: Cohesion and coupling - • Cohesion and Coupling:...
    Part 2: Dependency inversion - • Dependency Inversion: ...
    Part 3: The strategy pattern - • The Strategy Pattern: ...
    Part 4: The observer pattern - • Observer Pattern Tutor...
    Part 5: Unit testing and code coverage - • 100% CODE COVERAGE - T...
    Part 6: Template method and bridge - • Two UNDERRATED Design ...
    Part 7a: Exception handling - • Exception Handling Tip...
    Part 7b: Monadic error handling - • Monadic Error Handling...
    Part 8: Software architecture - • Why You Should Think A...
    Part 9: SOLID principles - • Uncle Bob’s SOLID Prin...
    Part 10: Object creation patterns - • QUESTIONABLE Object Cr...
    🔖 Chapters:
    0:00 Intro
    1:08 Example explanation
    1:45 Single responsibility principle
    5:01 Open/closed principle
    7:36 Liskov substitution principle
    9:48 Interface segregation principle
    12:12 Interface segregation variety using composition
    15:25 Dependency inversion
    17:29 Final thoughts
    18:15 Gag reel
    👍 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: discord.arjan.codes
    👥Twitter: / arjancodes
    👥LinkedIn: / arjancodes
    👥Facebook: / arjancodes
    #arjancodes #softwaredesign #solidprinciples
    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!

Komentáře • 508

  • @MaBuSt
    @MaBuSt Před 2 lety +286

    If you are a junior dev or self-taught programmer who watches this video and thinks "but... the original code was much tighter and easier to understand" I hope that you please understand that this is a totally natural thought to have. All of these design principles (as well as software architecture decisions) really shine when you are doing more than writing a quick 1-off script. Many times you will come back later to some code (either yours or someone elses) and need to make changes, or dramatically expand it's capability, and in those moments you will start to wish very much that the original code was written in this way (high cohesion, low coupling, dependency inversion, etc.) because then adding your new feature is not only relatively simple (e.g. a new processor subclass) but YOU CAN ADD IT WITHOUT BEING SCARED THAT YOU ARE BREAKING TONS OF STUFF. I cannot stress how important that last part is. I cannot tell you how many times I have looked at someones high-ly procedural code and tried to add a quick feature to it and though "oh god i hope this doesn't break something!" When you break code up this way, you make it so that adding a new feature capability is significantly de-risked.

    • @luck3949
      @luck3949 Před 2 lety +6

      Yes. They also help to prevent merge conflicts - a thing I didn't know existed before I started working in a team.

    • @Fanmade1b
      @Fanmade1b Před 2 lety +9

      @@luck3949 Yes, working in a team is definitively something where these principles shine. I would also add testing to that list.
      If your code can't be tested, it very probably doesn't follow SOLID. I am a a fan of writing code the KISS way (Keep it simple, stupid!), but now that I have more experience in larger and more complicated projects with more people involved and ever changing requirements, I always say that SOLID trumps KISS. Of course you should still keep it as simple as possible, but not if that means violating SOLID. It probably means that you have to think more in the beginning and have to create more classes (and especially interfaces), but I can almost guarantee you that this makes testing, refactoring and extending the code a lot easier and especially safer.
      I've had too many projects which started as something small and easy which grew over time and are an unstable and unmaintainable mess. A lot of those I've built myself.
      Well, at least for me this has been a lesson learned :)

    • @Roule_n_Scratche
      @Roule_n_Scratche Před 2 lety

      ah ok thanks

    • @QckSGaming
      @QckSGaming Před rokem +3

      Exactly, and to add to that, it also becomes naturally much more testable, which also feeds into the risk aversion

    • @drygordspellweaver8761
      @drygordspellweaver8761 Před rokem +2

      Their gut instinct is correct. OOP is a stain in programmings history and will be eclipsed by procedural and data oriented design.

  • @sergiopietri5370
    @sergiopietri5370 Před 2 lety +207

    Seems like one of those senior devs who you could ask for help and he would gladly explain, I appreciate that vibe

  • @selimrbd
    @selimrbd Před 2 lety +234

    You built a simple and practical example that progressively incorporates in a natural manner the SOLID principles "in the right order". That's not easy ! Really inspiring pedagogical work

    • @ArjanCodes
      @ArjanCodes  Před 2 lety +32

      Thanks so much! Yeah, it definitely took me a while to figure this out, thanks for noticing :).

  • @skycakecrunch
    @skycakecrunch Před 3 lety +356

    Defining the SOLID principles in layman's terms (based on this video alone):
    1. Single Responsibility
    Make things (classes, functions, etc.) responsible for fulfilling one type of role.
    e.g. Refactor code responsibilities into separate classes.
    2. Open/Closed
    Be able to add new functionality to existing code easily without modifying existing code.
    e.g. Use abstract classes. These can define what subclasses will require and strengthen Principle 1. by separating code duties.
    3. Liskov Substitution
    When a class inherits from another class, the program shouldn't break and you shouldn't need to hack anything to use the subclass.
    e.g. Define constructor arguments to keep inheritance flexible.
    4. Interface Segregation
    Make interfaces (parent abstract classes) more specific, rather than generic.
    e.g. Create more interfaces (classes) if needed and/or provide objects to constructors.
    5. Dependency Inversion
    Make classes depend on abstract classes rather than non-abstract classes.
    e.g. Make classes inherit from abstract classes.

  • @rkad93
    @rkad93 Před 3 lety +204

    Absolutely great work! It's such a rare occasion to find a good channel, dealing with intermediary stuff and up. Also, really like 'real life' examples in videos so far - makes it so much easier to memorize.

    • @ArjanCodes
      @ArjanCodes  Před 3 lety +13

      Thank you so much, that’s really kind! I agree having real-life examples helps a lot to put it into a useful context.

    • @kayakMike1000
      @kayakMike1000 Před 2 lety

      Indeed Arjan earned my sub.

  • @GabrielaGonzalez-od4tj
    @GabrielaGonzalez-od4tj Před 2 lety +10

    This Software Design series fills a gap that almost nobody else seems to be addressing. The real world examples + refactoring process make these videos truly amazing!

  • @adjbutler
    @adjbutler Před 2 lety +26

    Someone in Python who is discussing SOLID! All I can say is "Solid man!"

    • @ArjanCodes
      @ArjanCodes  Před 2 lety

      Thanks! :)

    • @adjbutler
      @adjbutler Před 2 lety

      @@ArjanCodes No worries. Really dude, you seem to be the only one doing intermediate level stuff in python. All other intermediate stuff is in C, C++ C#/Java etc... but there are so many people learning to code with python (Go and Rust are looking exciting as well, oh and JavaScript) and need to learn how to write clean code. You are making the world a better place with this channel. So thank you.
      Please also setup a Bitcoin Lightning wallet (Wallet of Satoshi mobile app is good) and show the code in a video so we can donate to you for no fees (everyone charges too much fees when we try to tip guys like yourself.)

    • @monochromeart7311
      @monochromeart7311 Před 2 lety +1

      @@adjbutler watch the Clean Code series by Uncle Bob, "Coding a better world together".

  • @cjgamble21
    @cjgamble21 Před 2 lety +16

    Dude you are the absolute best!!!! I am a computer science student in university, and they would never dream of teaching good design like this. This is the first time I've been able to actually understand the usefulness of Inheritance/Polymorphism in OOP.

    • @ArjanCodes
      @ArjanCodes  Před 2 lety +3

      Glad to hear the videos are helpful to you!

  • @matrixtoogood5601
    @matrixtoogood5601 Před 2 lety +18

    I keep coming back to this video from time to time, it is so well-explained. The order of examples is so good that I was not only able to understand SOLID but make some small refactors in my day-to-day as well to make it adhere to the principles. Amazing work!

    • @ArjanCodes
      @ArjanCodes  Před 2 lety +3

      Thanks, glad to hear you like it. It was indeed quite a challenge to have the example make sense for each of the five principles and also be explainable in that order 😁.

  • @proud22beme
    @proud22beme Před 3 lety +23

    the way you walk through examples is brilliant!
    the way code is structured has always fascinated me to no limit, and seeing a live rework done this well is a gem to watch!
    i have started to use composition over inheritance for vast majority of cases for a while now due to it being more flexible.
    and you can apply inheritance to composition as well, so its the best of both worlds in a lot of cases

    • @ArjanCodes
      @ArjanCodes  Před 3 lety +1

      Thank you very much! I’m happy you’re enjoying the content. I fully agree regarding inheritance vs composition. I went through that same process a while ago.

  • @Moody0101
    @Moody0101 Před 2 lety +1

    this is exactly the channel I was looking for for a year, thanks for this great solid content!!

  • @liquidpebbles
    @liquidpebbles Před 2 lety +1

    Good quality set, good camera, good clear concise speaker, good audio, good editing, good music, good examples, good explanations, good pacing. Good video. Probably one of the best SOLID vids out there

  • @junaidrehmat6186
    @junaidrehmat6186 Před rokem

    This is the best demonstration of SOLID principles.

  • @zokisvasta
    @zokisvasta Před 2 lety +4

    This is the first video I've seen clearly explaining LSP, how and why it's used, and its violations. Great job.

  • @tommypauker2600
    @tommypauker2600 Před 2 lety

    Your Code example is chosen perfectly and your explanations are on the point. No waffleing, just the pure information in an easy to understand language. Great stuff.

  • @Mixesha001
    @Mixesha001 Před 2 lety +3

    You have an incredible talent to explain things clearly and in a very pedagogical way. Your channel is a gem.

  • @iChrisBirch
    @iChrisBirch Před 2 lety

    EXCELLENT work! Love your videos, so helpful with the examples and explanation. The pace of the video and explanations and sound and video quality are spot on as well!

  • @guitarcrax127
    @guitarcrax127 Před 2 lety

    Absolutely love your explanation. I bought a Design Patterns book and your pedagogy was an amazing overview of what I can dive deeper into.

  • @kannankalidasan
    @kannankalidasan Před 2 lety +3

    Finally, Solid Content about the SOLID principles in Python 👏👏👏

  • @goldensea9999
    @goldensea9999 Před 3 měsíci

    I will begin a new job next week and really need to refresh my programming skill. Have to agree with all the comments here. Exactly what I have been looking for.
    A+ for your great work!

    • @ArjanCodes
      @ArjanCodes  Před 3 měsíci

      Glad the video was helpful in your learning journey! :)

  • @haneulkim4902
    @haneulkim4902 Před 2 lety +2

    This is amazing stuff. I've been having hard time finding python tutorials that covers more than just the basics. Thanks a lot Arjan!

    • @ArjanCodes
      @ArjanCodes  Před 2 lety +1

      You're most welcome - glad you like it!

  • @rogvids
    @rogvids Před 2 lety

    Suddenly discovered this channel and now addicted to this. Please continue the good work.

  • @Matfen815
    @Matfen815 Před 2 lety +1

    Nice to finally see a solid video without using the employee pay calculatkr example

  • @shi76b
    @shi76b Před 2 lety +2

    Well written, good presentation, high production value.
    This is easily the best programming advice channel on CZcams.
    Everybody should subscribe to this.

  • @alejandroraulleivailabaca5749

    I've seen this video and followed it's examples several times. Thank you so much for this!

  • @pghilardi
    @pghilardi Před 2 lety

    For me this was one of the best videos that I found to explain SOLID principles! Kudos to you!

  • @0DoLLFin0
    @0DoLLFin0 Před rokem

    Very clear explanation makes it sound as smth easy to understand.
    Thank you, mate.
    Good job.

  • @picassoofai4061
    @picassoofai4061 Před rokem +1

    Best channel on CZcams for software design and architecture, Man you just saved us from those weird and complicated tutorials.

  • @tongluo9860
    @tongluo9860 Před rokem

    thank you Bob for this great series. You explain the concepts very clear and concise. looking forward to more episodes.

  • @quarduroy1
    @quarduroy1 Před 2 lety +1

    Incredible. Thank you for your efforts in making these videos!

  • @minhajabidin
    @minhajabidin Před 2 lety +3

    This channel is super helpful and quite frankly deserves much more appreciation and attention.

    • @ArjanCodes
      @ArjanCodes  Před 2 lety +2

      I'm happy the channel is helpful to you - please spread the word! ;)

  • @chachki24
    @chachki24 Před rokem

    OMG, I truly think this is the best SOLID video!!!!

  • @sval4020
    @sval4020 Před 2 lety

    Probably one of the best channels on Software Engineering/Development out there! Great job Arjan!

  • @mithunmanoharmithun
    @mithunmanoharmithun Před 2 lety +4

    I have watched many SOLID priciples videos on You Tube and this is by far the best one. Thanks for all the efforts you put in these videos to share your deep knowledge with the world !

    • @ArjanCodes
      @ArjanCodes  Před 2 lety +1

      Thank you so much, glad you liked it!

  • @joshstir8659
    @joshstir8659 Před 2 lety

    Just really well done videos. Clear, concise, easy to understand, great stuff!

  • @simonanderson80
    @simonanderson80 Před 8 měsíci

    Best explanation & example of SOLID principle I ever found on CZcams.
    Thank you so much for making this video

  • @KeatonIsBlackLOL
    @KeatonIsBlackLOL Před 2 lety +6

    Loving all the best-practice examples and patterns! They're really helping me get off the ground with my latest personal project of building a chess enginer B) Thanks for all the good content!

    • @ArjanCodes
      @ArjanCodes  Před 2 lety +1

      Great to hear, Tyler! Good luck with your personal project, sounds like a nice topic to dive into!

  • @ArjanCodes
    @ArjanCodes  Před 3 lety +18

    uncle un·cle a) the brother of one's father or mother b) the husband of one's aunt or uncle c) annoying, pipe-smoking computer scientist.
    PS. don't forget to check out the gag reel at the end! ;)

  • @pedu71
    @pedu71 Před 2 lety

    perfect explanation for this problem. To the point, with practical examples. Others are using 1000 words to beat around the bush. Love your explanation style

  • @golammuhaimeen2825
    @golammuhaimeen2825 Před 2 lety +1

    Arjan, thank you so much for your content. I've been learning so much form you over the past month!

    • @ArjanCodes
      @ArjanCodes  Před 2 lety

      Thank you - glad you like the content!

  • @vladimirkraus1438
    @vladimirkraus1438 Před 2 lety

    I like your examples. They so precisely chosen to illustrare the problem at hand. They are neither too complex nor too simplistic. Kudos!

    • @ArjanCodes
      @ArjanCodes  Před 2 lety

      Thank you Vladimir, I do pay a lot of attention to creating the right examples - At the moment I think it's about 2/3 of the work that goes into producing a video.

  • @davethorneycroft6166
    @davethorneycroft6166 Před rokem +1

    You have a gift of making this stuff understandable using real examples . I enjoyed your course as well. Great stuff

    • @ArjanCodes
      @ArjanCodes  Před rokem

      Thanks you so much Dave. Glad that you like the video.

  • @foobar4344
    @foobar4344 Před 3 lety +1

    Great video! I love all your content, it has been so very helpful! It is so insightful to hear you talk about design concepts *while* you are implementing them with a simple example. In my experience, this is a rather rare feature of programming related educational videos -- most of the time they're focused on outcomes and not principles (and if they are focused on principles, they're seldom integrated into a single example that is refined -- with explanations -- over the course of a video). You have such a great style and approach to these videos!
    This is video is a gem that I will return to several times in the future just to check myself on future projects. I initially discovered your channel while looking for some info about the observer design pattern and I just kept watching more because it was really well done. I would love to see some discussions/examples of frameworks like MVC vs other architectures, perhaps as a series where you roll out a small full-stack app. Love your content! THANK YOU for the work that you do!

    • @ArjanCodes
      @ArjanCodes  Před 3 lety +1

      Thank you @foobar for your suggestions, and I’m very happy that my videos are helping you!

  • @alanbalsan
    @alanbalsan Před 4 měsíci

    If I'm not mistaken the pattern you choose to use instead of creating a new interface for the SMS Processor (favoring composition over inheritance) is the Strategy Pattern, this pattern defines a family of algorthms across different concrete classes and can be interchanged at runtime by the class that requires them.

  • @zeroheisenburg3480
    @zeroheisenburg3480 Před rokem

    Great Job. Not easy to find a example small and compact yet enough to show how the idea works out. I was ready to procrastinate but the pace was so good it kept me on the seat!

  • @TheSweetKizs
    @TheSweetKizs Před 2 lety

    one of the best programming/ software design explanation channel. Keep this up. You vids really clear explain and easy to understand example. Really appreciate the afford.

  • @tomkirbygreen
    @tomkirbygreen Před 2 lety

    Thank you kind sir. Clear, Calm and Humane. Just what I’m looking for right now.

  • @Musicall60
    @Musicall60 Před 3 lety

    Thanks for making videos this clear. These concepts are quite difficult as a beginner and you make them seem easy.

  • @heljhumenad
    @heljhumenad Před 2 lety +1

    This is so good that my brain synapses rewire for SOLID topic in Software Design

  • @eskevv446
    @eskevv446 Před 2 lety

    Great work!! Your videos are the best I've seen and what's helped me the most to understand core OO principles for better code design and easy solutions. You're the best at teaching this stuff!

    • @ArjanCodes
      @ArjanCodes  Před 2 lety

      Thank you - glad to hear you like the videos!

  • @judegomolina
    @judegomolina Před rokem

    I got a real understanding of the SOLID principles the first time I watched this video (well... I had to rewatch it a couple of times 😂), and I've been applying them in my code ever since with really noticeable improvements; moreover, today I gave a talk at my job on this topic based mostly on the things I learned from this video and it all went super good. Thanks for the fantastic content and keep up the great work Arjan!

  • @szabolcsjobbagy30
    @szabolcsjobbagy30 Před 8 měsíci

    The most understandable video on SOLID I have ever seen,
    thanks a lot!
    And every time I am amazed how much simpler and more readable Python code is than JavaScript :},
    there is no nested curly braces hell...

  • @florentinanggrainipurnama6952

    One of the best videos out there on design patterns in Python! Instantly subscribed!

  • @MisterDeGreg
    @MisterDeGreg Před 2 lety

    Thanks for the high quality video and easy-to-understand explanations!

  • @peterkomos8349
    @peterkomos8349 Před 7 měsíci

    I start learning design principles and design patterns and I have discovered your YT channel, I think, nothing better could me happen. Nice code, nice explanations and very good inspiration to studying. Thanks for alls.

    • @ArjanCodes
      @ArjanCodes  Před 7 měsíci

      That is wonderful to hear, Peter! I'm glad the content has been helpful :)

  • @awaitingforsunrise
    @awaitingforsunrise Před 11 měsíci

    You've done one of the best SOLID explains I ever saw. Your code and explanation is really understandable. Wish I could have such teammate as your. Thank you!

  • @thobiaslarsen693
    @thobiaslarsen693 Před rokem

    Just a small side note if anyone reads this, what he shows as the variation of interface segregation is actually not composition, it is segregation. If each of the payment processors CREATED the smsAuth inside of the class, it had been composition, there is some kind of important detail here! :) Anyways, awesome video! :D

  • @stanislawcronberg3271
    @stanislawcronberg3271 Před 2 lety

    Phenomenal explanation, thank you!

  • @nadirabdulhaqq5601
    @nadirabdulhaqq5601 Před 2 lety

    Wow! I learned so much in just under 20 minutes! Great example too.

  • @rutwikhiwalkar9583
    @rutwikhiwalkar9583 Před 3 lety +2

    The only video I understood on SOLID. Keep up the solid work!

  • @robertbrummayer4908
    @robertbrummayer4908 Před 2 lety

    Great and also entertaining video about the SOLID principles. Good job!

  • @kurosakishusuke1748
    @kurosakishusuke1748 Před 2 lety

    This is exactly what I have looking for in understanding OOP concepts in full picture in many years.

    • @ArjanCodes
      @ArjanCodes  Před 2 lety

      Thanks, glad you found it helpful!

  • @pthube
    @pthube Před 2 lety

    Thanks Arjan for explaining the advanced concept in programming with code.. this channel really help to take leap from intermediate level to expert level..

  • @neoluis2003
    @neoluis2003 Před rokem

    Hi Arjan. I just wanted to thank you. There is material in SOLID to talk about for hours, but you have done a great job of distilling the fundamentals in a less than 20 min video with a very clear and didactic python example. Kudos and Thank you very much! 😊

  • @angelosplastropoulos5047

    Fantastic video Arjan. Keep up the good work!

  • @MohamedAli-dk6cb
    @MohamedAli-dk6cb Před 2 lety

    I am really glad to find this channel by the beginning of the 2022. Thank you very much for the wonderful content. You deserve 100+ Millions subscribers.

    • @ArjanCodes
      @ArjanCodes  Před 2 lety +1

      You're so kind - I'm happy you like the videos!

  • @dennycrane2938
    @dennycrane2938 Před 10 měsíci

    Single Responsibility Principle is often misunderstood and I think it happened again here in the common way which is to conflate it with separation of concern. SRP is a people-focused problem whereas SoC is a modular cohesion problem. The examples given in Uncle Bob's book explains it pretty well. In short, it addresses an issue where you have multiple different stakeholders giving you requirements for the same package/service/etc -- in DDD you would see this as an invalid overlap of subdomains. For example, when payroll and Human Resources have cause a conflict in the same "employee" table as they have a different definition of "salary" and how its calculated (or if it's calculated at all; it might static). SME/VP 1 says you have to do it one way whereas SME/VP 2 says you have to do it another way which could take the entire department down because of that conflict. Or where Sales and Marketing have two different definitions of "Customer" with different journeys. The entity has more than one reason to change in that you are getting conflicting requirements from what is essentially two opposing forces. So the problem is similar in that the class is conflicted, but with SRP, the conflict is caused by people, and with SoC the problem is caused by low cohesion (actually doing too many unrelated or loosely related things).

  • @johanneszwilling
    @johanneszwilling Před rokem

    🙃 Really great and brief illustration. Will be watching this way more than once!

  • @kayakMike1000
    @kayakMike1000 Před 2 lety

    Love it! Posse of One! Uncle Bob was one of OG agile manifesto signatories.

  • @AvocationNation
    @AvocationNation Před rokem

    VERY informative. Thanks!

  • @voinywolnyprod3046
    @voinywolnyprod3046 Před rokem

    Very detailed explanation! Thank you so much for making me understand Liskov Substitution principle. This was that tough part fo me.

  • @KonstantinPrydnikov1
    @KonstantinPrydnikov1 Před rokem

    the best way of solid describing for last 10 prog-year i saw )

  • @seanoverton798
    @seanoverton798 Před 2 lety

    Awesome content, I always learn so much from your videos. Thanks heaps for the content.

  • @teyiowuawi7758
    @teyiowuawi7758 Před 3 měsíci

    really enjoyed this video and how you broke it down! Definitely up there in terms of simplification and seeing a example similar to the real world!

  • @OrtoInScatola
    @OrtoInScatola Před rokem

    well done! I liked how you were able to incorporate each principle progressively in your code.

    • @ArjanCodes
      @ArjanCodes  Před rokem

      Thank you Francesco and thanks for noticing! I remember it was quite tricky ;).

  • @DandyBallbag
    @DandyBallbag Před 2 lety

    Just came across this channel and it is very informative.
    I was following along with this video and with each iteration I was thinking "well, that makes sense" until we got to the 4th.
    I then found myself wondering how we changed the code so many times and became lost. 🤣
    Clearly I need to watch this video a few more times to be able to get my little head around it.
    The video is time stamped and each section I feel is concise. So it should be easy enough.
    Thank you for sharing your wisdom!

  • @sabirshakirov4034
    @sabirshakirov4034 Před 2 lety

    Man, you're the best! love this explanation and examples.

  • @TimTurnquist
    @TimTurnquist Před rokem

    New(ish) to python. Have been struggling to wrap my head around (and use) SOLID principles for years. This video made BOTH much clearer. Thanks Unkl Arjan!

    • @ArjanCodes
      @ArjanCodes  Před rokem

      Thanks so much Tim, glad it was helpful!

  • @ArmstrongNigere
    @ArmstrongNigere Před 2 lety

    Absoluttely great work .. very clean and simply . finally understand this principles fully

  • @richardvdoost
    @richardvdoost Před 3 lety +2

    Lekker bezig Arjan!
    I admire your discipline and consistency of doing a video every Friday. That's the way to grow. It's great to see you covering higher level topics like design principles / architecture / clean code in the context of Python, which is not common here on yt.
    I just happen to be reading Bob's 'clean architecture' book right now after finishing 'clean architectures in python' and `architecture patterns in python` (all great) because I've started designing a complex piece of software for my startup and want to keep it clean & maintainable.
    Uncle B writes there's a bit of misunderstanding about the SR principle. People tend to think a module/class should "do only one thing". That is a good principle too, but SR originally means a module/class should only be responsible to one "user" or "stakeholder". I guess that's the group of humans (or robots) that ends up using the business logic described by the code, not sure if I understand it 100% myself. But it's ok if a class does a bunch of different things, as long as it's being done serving a common goal. This way the class only has one "reason to change" and that's useful.
    Curious to see what else you have in the pipeline. If you need suggestions, going deeper into Clean Architectures, TDD, Event Driven, if you resonate with those, would be amazing 👌

    • @ArjanCodes
      @ArjanCodes  Před 3 lety +2

      Dankjewel Richard!
      You make a good point that having a single responsibility doesn’t mean doing only a single thing. In the example, the order class also has multiple methods doing different things. In my experience, how responsibilities are divided over classes is for a large part decided by the structure of the data. For example, moving the total price method outside of the order would introduce a lot of coupling, because it needs to know a lot of details about the order data, which is not the case for payment processing.
      Thank you very much for those suggestions, keep them coming! I’ll add those to my list of video ideas (which is getting quite large).

  • @orie239
    @orie239 Před 2 lety

    Great video, I was looking for a channel that talks beyond the basics of programming for a while, there's a lot to learn here!

  • @sep69
    @sep69 Před 3 lety +1

    Thank you very much for this great video. So well explained in 20 mins only. This will surely help me !

    • @ArjanCodes
      @ArjanCodes  Před 3 lety

      Thank you Mark, happy you liked it!

  • @kalik54
    @kalik54 Před 2 lety

    Man, you made the best video about SOLID, thanks!

  • @zhalie12345
    @zhalie12345 Před 2 lety

    Just wanna say thanks ArjanCodes !
    Your video really helps me. ^^
    Have a great day sir !

  • @eZwoodb1ne
    @eZwoodb1ne Před rokem

    You're my favourite python youtuber! Always great examples and beautiful code

  • @vasanthikannekanti1178

    Thanks for this video, very helpful

  • @maxitorres7
    @maxitorres7 Před 2 lety

    It is amazing, this videos are been so helpful for my first job in a US company (From South America). Thanks a LOT!!

    • @ArjanCodes
      @ArjanCodes  Před 2 lety +1

      Very happy to hear that the videos have been helpful to you!

  • @vurmyr
    @vurmyr Před 2 lety

    Very simple and straightforward

  • @joaotextor4094
    @joaotextor4094 Před rokem

    Best SOLID explanation video! I came from JS/TS, but I could totally relate how I can implement those principles into my code.

  • @shashank21j
    @shashank21j Před rokem

    Great explanation of solid principles. Thank you

    • @ArjanCodes
      @ArjanCodes  Před rokem +1

      Thanks so much Shashank, glad you liked it!

  • @ConnorJohnson318
    @ConnorJohnson318 Před 3 lety +15

    This was a great video, thank you. The composition step, after Interface Segregation and Dependency Inversion, looks a lot like Dependency Inversion. I had expected you to use a mixin on the subclass, but instead you added authorizer argument to the initializer. When I think of composition, I usually think of mixins. Can you touch on the pros/cons of mixins, versus adding functionality through the initializer, in the context of composition?

    • @ArjanCodes
      @ArjanCodes  Před 3 lety +12

      Hi Connor, thanks! I don’t use mixins very often, for a few reasons. First, they don’t adhere to what a parent-child class relation means in traditional OO programming (the ‘is a’ relationship). Second, I don’t like how mixins potentially create strange coupling issues, for example mixin A might define a method X, mixin B uses that method X, and finally, a class C then inherits from both A and B to combine the two. But at the same time, both mixins A and B can’t be used independently in a meaningful way. I much prefer composition/association (a ‘has a’ relationship), which models the dependencies explicitly and doesn’t break OO philosophy.

    • @ConnorJohnson318
      @ConnorJohnson318 Před 3 lety +2

      ​@@ArjanCodes Thank you, that sounds like a pretty good reason to avoid mixins, then. Come to think of it, I recall running into unexpected behavior when I used multiple mixins in one class. In Python, the order in which you include mixins affects how the child class works. Thank you for taking the time to address my question.

  • @boertush
    @boertush Před 2 lety

    Thanks, I read simple architecture, it skimps over the solid principles and only demonstrates the principles on a design level and I really needed some implementation examples!

  • @Moody0101
    @Moody0101 Před 2 lety

    I thought I was decent in oop, but after watching this video, I am not really that good at applying good design to my code, that helped alot bro, thank you alot, and btw, I love the way you code and the sound of the keyboard and all that stuff.
    further more, I would like to point out something hat I w I like about your python videos, it seems like you bring alot of use cases and real world applications for the language which something I always have wanted to do in youtube since no one does it, but now since I found that channel, I can enjoy seeing such great practical content that really does what I always wanted people to do (but probably I will make some videos if I get a new laptop soon).
    anyways thanks, I will subscribe with my 4 youtube accounts lol.

  • @blanky_nap
    @blanky_nap Před rokem

    Great one! Helps to better understand solid principles!

  • @oggyoggyoggyy
    @oggyoggyoggyy Před rokem

    Thank you so much for always creating such a useful content!

    • @ArjanCodes
      @ArjanCodes  Před rokem

      Thank you so much, James! I really appreciate it.

  • @mehmetcakoglu866
    @mehmetcakoglu866 Před 2 lety

    Perfect explanation. Thanks for your great effort to teach this complicated subject to who wants to know about OOP principles.

    • @ArjanCodes
      @ArjanCodes  Před 2 lety

      Thank you Mehmet, glad to hear you liked it!

  • @islamimankhodzhaev543

    Чоон рахмат! )) Эн сонун видео !

  • @katyafervent
    @katyafervent Před rokem

    Thank you! I like the way you structuring videos ^)

  • @michaelkosciewicz1623
    @michaelkosciewicz1623 Před 2 lety

    That 's a video rich of content and concrete...thank u! I need to watch many many times;)....

  • @KulasangarGowrisangar
    @KulasangarGowrisangar Před 2 lety

    superb and simple explanation to the SOLID principles