Cohesion and Coupling: Write BETTER PYTHON CODE Part 1

Writing code, especially in larger software projects can be very challenging. In this video, I'm going to cover cohesion and coupling to help you write better code. I'll go through a Python program in detail and I'll show you how to write code that has low coupling and strong cohesion. Coupling and Cohesion are part of the GRASP principles of object-oriented design, as proposed by Craig Larman in his book (see below for a link).
Here are a few books about software design that might interest you:
- Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and Iterative Development, by Craig Larman: amzn.to/364wgLb
- Design Patterns: Elements of Reusable Object-Oriented Software, by the Gang of Four: amzn.to/39451Cv
💡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 7: 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 Introduction
0:47 What is cohesion?
1:37 What is coupling?
3:59 Code example intro
6:39 Analyzing the code
7:56 Information expert
11:19 Reducing coupling
16:32 Improving cohesion
22:40 Recap
25:37 Outro
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!
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!

Пікірлер: 388

  • @ArjanCodes
    @ArjanCodes3 жыл бұрын

    Learn more about how to launch a software product faster here: kzread.info/dash/bejne/f4lmksOhZdafp9o.html

  • @AlexB-op7kb

    @AlexB-op7kb

    3 жыл бұрын

    Remind Me! 1 week

  • @javierfry97

    @javierfry97

    Жыл бұрын

    @@AlexB-op7kb how goes it?

  • @AlexB-op7kb

    @AlexB-op7kb

    Жыл бұрын

    @@javierfry97 haha remind me 1 year. I forgot to follow up

  • @kannankalidasan
    @kannankalidasan3 жыл бұрын

    Believe me. There are no videos on youtube other than you to my knowledge that explain the design pattern before and after effect with real practice examples . Thank you so much !

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    You're welcome Kannan, happy that you're enjoying the videos!

  • @muyewahqomeyour7206

    @muyewahqomeyour7206

    3 жыл бұрын

    I third this

  • @ZeonLP

    @ZeonLP

    2 жыл бұрын

    True! I have only seen very abstract examples that almost completely overlap with the pattern description. Not bad, but real world examples are much more insightful once you get the general idea.

  • @MaBuSt

    @MaBuSt

    2 жыл бұрын

    have you found any more? This is also exactly what I was looking for. I am concerned his newer stuff is a bit more faster-paced, but still good. I know we can slow the videos down, but this isn't about teaching us 'what to do', this level is all about 'how to think' is this video is a really really great example of this. Looking for more samples around the web if you found them

  • @andgate6204

    @andgate6204

    9 ай бұрын

    aws re:invent has some really good videos on software development, way beyond this. However, arjan’s video is great if you’re still at the level where you need practical examples.

  • @DaviSilveira
    @DaviSilveira3 жыл бұрын

    Thank you for not making 'hello world' tutorials!!!!!!! Keep going! :)

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    Thank you! Will do :)

  • @jsallan7

    @jsallan7

    3 жыл бұрын

    Agreed! Thank you Arjan, this is super helpful stuff!!

  • @ShanilPanara
    @ShanilPanara2 жыл бұрын

    Honestly, this is some of, if not the best, intermediate/advanced level content out there! Too many people focussing on the pure basics, but you presented this in such an easy to understand way! Forget binging Netflix, time to binge Arjan 😂 Thanks a lot ❤️

  • @mrdupreez9061
    @mrdupreez90613 жыл бұрын

    This is exactly the sort of level of information I need at my stage of learning to code. thank you so much really appreciate the thought you've put into this!

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    Thank you! Happy that you enjoy the videos.

  • @larrytroxler7017

    @larrytroxler7017

    2 жыл бұрын

    I'm glad you got something out of this , but read my post.

  • @mrdupreez9061

    @mrdupreez9061

    2 жыл бұрын

    @@larrytroxler7017 Can't see your latest comments, so I can't unfortunately. Why don't you make your own video?

  • @MaBuSt

    @MaBuSt

    2 жыл бұрын

    were you able to find any other examples of this level of code teaching? This is where I landed too.

  • @talhaamir9023
    @talhaamir90233 жыл бұрын

    Highly Underrated Video, should have more than a million views. There are very important concepts which programmers don't even know. Thanks for the High Quality Content !!

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    Thank you Talha, I’m happy you’re enjoying the videos!

  • @larrytroxler7017

    @larrytroxler7017

    2 жыл бұрын

    True, but as a explained in my initial reply, there are some problems with this guy's post.

  • @Dgrayfit
    @Dgrayfit3 жыл бұрын

    I absolutely love this channel. I have always really struggled with the idea of trying to identify what "intermediate" level coding is, and I would say this channel really fills that gap in the existing KZread literature for python coding. I think this channel is going to really level up my skills, can't wait to see more!

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    Thanks Dennis, I’m glad you’re enjoying the videos and that they’re helpful to you.

  • @Dgrayfit

    @Dgrayfit

    3 жыл бұрын

    @@ArjanCodes Certainly very helpful! Do you have any other ideas in the pipeline for content that we can look forward to?

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    Absolutely :).

  • @MaBuSt

    @MaBuSt

    2 жыл бұрын

    did you find any other channels that are similar? I did not but I am also looking to do much better here as well at this level.

  • @5thbatman
    @5thbatman3 жыл бұрын

    It is not even possible to get this kind information from paid sources, but you are great person that making these kind of valuable lessons available on youtube. Thank you very much for all the effort, Respect.

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    Thank you, Space Walker - glad you like the content!

  • @Ben-kz2km
    @Ben-kz2km2 жыл бұрын

    Great video. I'm a data scientist but moving more and more to software development. I'm still having a hard time writing good code, but I'm starting to be able to recognize it when I see it. Videos like this are super helpful with that.

  • @thesupercoach
    @thesupercoach2 жыл бұрын

    Love your work man. Your calm and clear delivery is a breath of fresh air. Keep it up.

  • @michaelmichelotti460
    @michaelmichelotti4603 жыл бұрын

    Fantastic series! I think all of the concepts you're discussing are vastly under-appreciated

  • @robertchang5096
    @robertchang50962 жыл бұрын

    Your videos are absolutely amazing! I can only imagine how much work and hours you have put into this. Thank you for sharing your knowledge to all of us learning Python!

  • @CristianHeredia0
    @CristianHeredia03 жыл бұрын

    This is a such a great series! I've been looking for intermediate level design content for years. You've nailed the delivery and content. Looking forward to seeing more videos.

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    Thank you Cristian, happy you are enjoying the series!

  • @Victorinoeng

    @Victorinoeng

    3 жыл бұрын

    Completely agree! Loving this series! Looking forward to more videos! Great job!!!

  • @ahmedlv5499
    @ahmedlv54992 жыл бұрын

    Your videos have changed the way I code. This is my second time going through this playlist. Since watching your videos I have been writing better code. Trying to do better every time. I have even done better at interviews. Thank you so much for great content. Merry Christmas and Happy New Year!

  • @olegpopov3180
    @olegpopov31803 жыл бұрын

    I noticed cohesion and coupling are pretty similar to the concept of between and within dispersion in cluster analysis. Kinda cluster should be maximized by between-cluster distance and minimize by within distance of elements inside. Why I noticed this only after your video? Your explanations are really genious.

  • @robharwood3538

    @robharwood3538

    3 жыл бұрын

    Nice observation! It makes sense to me.

  • @hudabdulwahab2499
    @hudabdulwahab24992 жыл бұрын

    I was so frustrated of going through tonnes of leetcode interview exercises/tutorials and was looking for a more philosophical understanding of how to design python codes. Then I found your channel, I am now more confident after going through some if not all of your videos. Keep it up! The coding challenge is soon, will update if your content helped me land the job.

  • @marookegberosamuel8238

    @marookegberosamuel8238

    2 жыл бұрын

    Did you land the Job yet ?

  • @hudabdulwahab2499

    @hudabdulwahab2499

    2 жыл бұрын

    @@marookegberosamuel8238 I did! but unfortunately (or fortunately) it's not just python - so a lot of learning curves!

  • @plashless3406
    @plashless34062 жыл бұрын

    This is what I was looking for almost a year. Thanks, Arjian.

  • @vxsniffer
    @vxsniffer2 жыл бұрын

    your work stands out in flood of basics tutorials with silly examples, thank you Arjan!

  • @szabolcsjobbagy30
    @szabolcsjobbagy309 ай бұрын

    You create the Best videos on refactoring, design patterns, OOP, thank you a lot!! Most of the videos on youtube are very basic, with ridiculous, generic "foo", "add_numbers" etc. examples, but you show real, practical examples, and superb refactoring, just as if we asked a senior mentor to review our junior codes and recommend improvements. You are creating fantastic videos, thanks a lot!!

  • @nijataliyev1470
    @nijataliyev14703 жыл бұрын

    Holy cow, this is first video that I am subscribing, liking and sharing right away. This is a gem. Thank you very much Arjan.

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    Thank you very much! I’m happy you liked the video.

  • @omni4376
    @omni43763 жыл бұрын

    Fully agree. Basic concepts like this are highly undervalued by many devs since they struggle to grasp the rather abstract benefits. Unfortunatly todays high demand on devs also has lead to many people working in this field now who better should not be writing code for a living.

  • @ramirotell
    @ramirotell2 жыл бұрын

    Im really happy to have found this channel, I'm really enjoying this Better Python Code playlist!, thank you!

  • @mikaeilnorouzi5631
    @mikaeilnorouzi56313 ай бұрын

    I can even tell how much I love your content sir, thank you for creating these videos all for free, you are a hero.

  • @ArjanCodes

    @ArjanCodes

    3 ай бұрын

    Thank you for the kind words, Mikaeil! I'm glad you like the videos :)

  • @pimdubuf3272
    @pimdubuf32722 жыл бұрын

    This series is great, both the topics and your way of explaining stuff. Thanks for taking the time to make these!

  • @ArjanCodes

    @ArjanCodes

    2 жыл бұрын

    Thanks Pim, glad you like it!

  • @mrdbourke
    @mrdbourke2 жыл бұрын

    Absolutely outstanding video Arjan! I've been coding Python for ~5 years and always saw these techniques in play but never really knew where they were coming from. Looking forward to the rest of the series.

  • @ArjanCodes

    @ArjanCodes

    2 жыл бұрын

    Thank you so much, Daniel, glad you enjoyed it!

  • @GrooveMonkeeloops
    @GrooveMonkeeloops3 жыл бұрын

    Great stuff, thank you!! I really appreciate this kind of intermediate+ material. There is very little available. Looking forward to the rest of the series.

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    Thanks! Happy you liked it!

  • @amardeep.sahota
    @amardeep.sahota2 жыл бұрын

    This is some really good quality video. You covered so many concepts , thanks

  • @kanwaradnan4849
    @kanwaradnan4849 Жыл бұрын

    Sir, you are really amazing teacher. Your teaching style is very explicit and clear. But there are several other parts of the programming world I would like to learn from you, and these are (mentioned based on my interests) 1) Data Structure and Algorithms 2) Programming along with any GUI Library (I prefer tkinter) 3) Also teach us about Databases (SQL , NoSql (mongoDb etc)) Thank you Sir, I hope, We'll be blessed with these videos in future.

  • @raccoonteachesyou
    @raccoonteachesyou3 жыл бұрын

    I just discovered your channel, I always found Design Patterns boring, but I watched almost all your videos about it. Thank you, you make it very playful and concrete and the rhythm is also perfect !

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    Thank you so much! I’m happy that you’re enjoying the videos.

  • @mrskumarvlogs4021
    @mrskumarvlogs40213 жыл бұрын

    One of the best content. Thank you so much for sharing your knowledge. I am going to watch all of your other vedios. Please keep on the great work.

  • @hackergr325
    @hackergr3252 жыл бұрын

    Words can't describe how awesome your job is. Watching your videos makes me want to refactor all my shitty code

  • @cooliospeep7047
    @cooliospeep7047 Жыл бұрын

    Dear Arjan, thank you for sharing such a detailed and thoughtful video. I loved how you explain the though process of improvement. It's hard to find such content out there. Please keep going. I look forward to studying all of your catalogue (see what I did there!) ;)

  • @stewpatterson1369
    @stewpatterson13692 ай бұрын

    great walkthrough. the example code really demonstrates the concepts

  • @DistortedV12
    @DistortedV123 жыл бұрын

    You are a god for uploading this series. Starting out as a python developer, I found myself coming across difficult issues when returning to old code I've written where better understanding of design patterns could've helped. The very few tutorials covering this stuff are either long form lectures, and the best books on software design use Java as a reference. This is such a great niche that you're tackling and I hope your account accrues more subscribers and viewers. Thank you!

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    Thank you so much - glad you like the content!

  • @goulartto5616
    @goulartto56162 жыл бұрын

    I'm so grateful to have found your channel. Very great content. Thank you very much! Cheers from Brazil!

  • @ArjanCodes

    @ArjanCodes

    2 жыл бұрын

    Hi Goulartto, I'm happy to hear you like the content - cheers!

  • @alvaro_ch
    @alvaro_ch Жыл бұрын

    I hate python but I watched the video anyways because nowadays almost nobody talks about cohesion and coupling. As you stated, the concepts shown apply to any language since they are abstract, language independent ones. Grats!

  • @victoradukwu2719
    @victoradukwu27194 ай бұрын

    Great video. I wish I knew about your channel long before now. Thanks a million!

  • @MagnusAnand
    @MagnusAnand2 жыл бұрын

    This series is gold

  • @garm6262
    @garm62622 жыл бұрын

    thanks a lot for your videos, they're really crystal clear!! :D

  • @Eriddoch
    @Eriddoch3 жыл бұрын

    First person I've subscribed to in over a year. Great videos sir :D

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    Welcome aboard!

  • @ewilliamson9696
    @ewilliamson96963 жыл бұрын

    This is such a great series. Thanks so much!

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    Thank you Erik, happy you are enjoying it.

  • @alessandroferrari2166
    @alessandroferrari21663 жыл бұрын

    Great stuff Arjan! You got a new subscriber! Groetjes uit Den Haag!

  • @murghay01
    @murghay013 жыл бұрын

    Yes please. Can't even believe you made a reference to bridger and template pattern. Fantastic.

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    Thank you!

  • @MaBuSt
    @MaBuSt2 жыл бұрын

    Exactly the kind of content that so many are actually looking for!!! If we have developer jobs without great code-review and training practices, we are stuck trying to figure out how to improve our code quality by ourselves. This is appreciated 1000x. Something I'd please ask going forward, and the reason I am responding in THIS video instead of your others - please don't go TOO FAST in your videos. This video was a great speed and I am concerned that in some of the vids you have made since that you are moving too fast. Please remember that this isn't about 'how to do' something, it is about 'how to (structure your) thinking'. This takes time to settle into the brain and the programmers watching are constantly trying analyze the 'why' of what you are doing and fit it back into their own models. Please use this type of video pacing as an example in your newer videos. Also, please always debug on screen, we've all been there and it is really great to watch what you do too.

  • @lorieannecastillano3052
    @lorieannecastillano30522 жыл бұрын

    Super thankful of this content!

  • @cocoonkid4321
    @cocoonkid43213 жыл бұрын

    Well well done! You've got another fan here. I'm digging your videos.

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    Thank you @cocoonk1d! I’m glad you like the videos!

  • @larry6597
    @larry65973 жыл бұрын

    This is great. Thank you for your videos!

  • @mannchuoyyam1509
    @mannchuoyyam15092 жыл бұрын

    Found it, watch it, love it. You're awesome!

  • @ArjanCodes

    @ArjanCodes

    2 жыл бұрын

    Thank you, glad to hear you liked the video!

  • @kubape84
    @kubape84 Жыл бұрын

    Thank you Arjan for sharing your knowledge in such easy and clear way, appreciate

  • @ArjanCodes

    @ArjanCodes

    Жыл бұрын

    Thanks so much Jakub, glad the content is helpful!

  • @GoodOldYoucefCef
    @GoodOldYoucefCef3 жыл бұрын

    Very clear. Thanks a lot.

  • @cetilly
    @cetilly3 жыл бұрын

    What a really great topic that no one ever seems to discuss. And very well presented. New subscriber.

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    Thank you Chuck, happy you like it.

  • @RazmikPoghosyan
    @RazmikPoghosyan2 жыл бұрын

    Thanks for a tutorial. It's really very useful and unique.

  • @janimakermeenmanhom4416
    @janimakermeenmanhom44163 жыл бұрын

    this is very perfect constringe of python code that I never have it's so amazing, it has more knowledgeable pattern design

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    Glad it was helpful!

  • @AdobadoFantastico
    @AdobadoFantastico3 жыл бұрын

    This really pulled the concepts together for me.

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    Glad to hear it was helpful!

  • @wilhelmngoma9009
    @wilhelmngoma90093 жыл бұрын

    Very challenging, yet very interesting, and great to learn and understand. Thanks

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    Glad you enjoyed it!

  • @ljaimovich
    @ljaimovich2 жыл бұрын

    Good channel with very very good content!! Keep sharing your knowledge like this Arjan!!! Thanks so much!!!

  • @ArjanCodes

    @ArjanCodes

    2 жыл бұрын

    Thank you Leonardo, glad you like the content!

  • @kevinjerome5954
    @kevinjerome59542 жыл бұрын

    One interesting concept to add to this: We could define the string we print as the return value of the __str__ method of the class instead. Then in print method of the class put print(self). That way we can both print the str with a call to print or get the str as an output to write somewhere else with str(instance)

  • @janekschleicher9661

    @janekschleicher9661

    Жыл бұрын

    Usually the way would be to overwrite both, the __str__ and __repr__ (the latter should contain a representation similar how we would reconstruct the object in python). __str__ overwriting should be done carefully and usually keep it as simple as possible. Most often, we would not want to have a formatted string containing arguable design decisions. Especially, having newlines in __str__ should always taken with some careness. If these objects are included in other objects, you'll start having problems visualizing them without getting corrupt visualizations. Just think about printing out a little table as one example. There are useful exceptions, e.g. pandas dataframes, so they work very well with interactive environments. Here I'd argue that __str__ should just contain the information a bit more minimal in a one liner. Nowadays in recent python, we'd usually just define the data classes as dataclasses and then we'll automatical get a useful __str__ and __repr__ and __init, what reduces the need to even think and debate it. The usual way to deal with a pretty printing or a formatted output is to add a formatted_str or similar called function. One reason is also, that you want to influence the formatting with options (and you can't really do that in __str__). E.g. whether you want a colon there, or maybe you want output it as a csv (so you can pipe into a database). Indeed, very often, you could even think about delegating it to a specialized library like python-tabular or similar. Anyway, the only thing I really disliked in this video is to call the method "print". I would always suggest, especially to learners, not to use any keywords or global function names as function names. Even if it fits the purpose of the method very well, the chance for both confusion and hard to debug errors is significant. You can even see it in this video. There are three prints in three consecutive lines: the first is in a method name declaration, the 2nd one calls the global standard python print and the 3rd one calls the print method of another object. It's even worse that the three methods will do something similar. It's only a question of time till the wrong print is used, not caught immediately and the ending up in a subtle and close to impossible findable bug. I mean, you still can call print(vehicle) or vehicle.print() that both will do something similar, but different. Anyway, this video is outstanding good!

  • @das_papa4873
    @das_papa4873 Жыл бұрын

    Excellent video. Thank you very much for this serie.

  • @ArjanCodes

    @ArjanCodes

    Жыл бұрын

    Thanks so much Das.

  • @imadetheuniverse4fun
    @imadetheuniverse4fun2 жыл бұрын

    8:00 this is excellent advice, just what I needed tbh. think about the data first before doing any coding, let the data and their relationships guide the program structure!

  • @connorkenway1941
    @connorkenway1941 Жыл бұрын

    Immensely helpful and well explained! Thank you so much...looking forward for more 😃

  • @ArjanCodes

    @ArjanCodes

    Жыл бұрын

    Thanks so much Connor, glad the content is helpful!

  • @NateROCKS112
    @NateROCKS1123 жыл бұрын

    There are a few design things I feel like I'd change: 1. As others have mentioned, Vehicle and VehicleInfo would be good as dataclasses. 2. Using enums instead of a boolean "electric" flag. This would allow for adding more vehicle types in the future, such as "hybrid" or "diesel," if one needs to differentiate the two. 3. __str__() is much cleaner when printing stuff, rather than using a unique print() method. This is obviously a boon if, as you said, one wants to develop a GUI.

  • @devkiwboy
    @devkiwboy7 ай бұрын

    This is outstanding content, creatively and articulately presented. Bravo.

  • @ArjanCodes

    @ArjanCodes

    7 ай бұрын

    I'm glad you enjoyed the video!

  • @benjamincabalona9014
    @benjamincabalona90143 жыл бұрын

    This video is underrated. Well done!

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    Thanks Benjamin, glad you liked it!

  • @ayva1106
    @ayva11062 жыл бұрын

    20:26 Truer words have never been spoken 🙏🙏

  • @golammuhaimeen2825
    @golammuhaimeen28253 жыл бұрын

    great video man! helped me out a lot! Thank you

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    Glad to hear it!

  • @chuckles8519
    @chuckles85192 жыл бұрын

    I'm learning a lot from your videos - thanks.

  • @ArjanCodes

    @ArjanCodes

    2 жыл бұрын

    Glad to hear the videos are helpful!

  • 3 жыл бұрын

    Thanks for this info series. It is nice to know the CS terms for some of the things I have learned from practical experience. In particular, a favourite of mine is to store the info and related methods in an Enum. In this case I would have defined `class Vehicle Registry(VehicleInfo, Enum)` and define the different type of vehicles as Enum members.

  • @larrytroxler7017

    @larrytroxler7017

    2 жыл бұрын

    Exactly. You should never store classifications like these as bools. His final code would never pass a software review.

  • @LookNumber9
    @LookNumber93 жыл бұрын

    I love seeing beautiful code. Thank you for this!

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    Thanks Mark, glad you liked it!

  • @larrytroxler7017

    @larrytroxler7017

    2 жыл бұрын

    It is not beautiful code, unfortunately. See me latest comment.

  • @triple-oe4hw
    @triple-oe4hw2 жыл бұрын

    Thanks man really wished I'd learned this sooner

  • @MrJeeoSoft
    @MrJeeoSoft2 жыл бұрын

    Nice video Arjan!

  • @EW-mb1ih
    @EW-mb1ih2 жыл бұрын

    Great video! If we want to go further, we can create abstract class and give an object VehicleRegistry to the application and thus increase the decoupling We can also create another class to compute financial stuff like prices, taxes and even reduction and thus increase coupling.

  • @kcramo
    @kcramo3 жыл бұрын

    Hallo Arjan. Dank voor je uitstekende uitleg zeer leerzaam ik ga de rest van de video's bekijken educatie moet vrij en toegankelijk zijn voor iedereen een kopje koffie komt zeker. Dank Khaled

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    Graag gedaan, Khaled!

  • @iandthopper
    @iandthopper Жыл бұрын

    Thank you, Arjan. Superb content.

  • @ArjanCodes

    @ArjanCodes

    Жыл бұрын

    Thanks so much Ian, glad the content is helpful!

  • @oscarmartinezbeltran
    @oscarmartinezbeltran2 жыл бұрын

    Fantastic channel !!!! Thank you!!! and keep it up !!!!!!!!

  • @ArjanCodes

    @ArjanCodes

    2 жыл бұрын

    Thanks Oscar, will do!

  • @izzatkhamraev7719
    @izzatkhamraev77192 жыл бұрын

    absolutely great video, thank you very much

  • @ArjanCodes

    @ArjanCodes

    2 жыл бұрын

    Glad you enjoyed it!

  • @MPatrickN
    @MPatrickN3 жыл бұрын

    Easiest sub of my life.

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    Thank you! And welcome onboard ;).

  • @fuuman5
    @fuuman53 жыл бұрын

    You could use dataclasses to save a lot of boilerplate. And I like to implement __str__ methods to print objects. But I guess you left that out to make it not too complicated. Anyway nice videos. Good to watch.

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    Thank you! Yes - dataclasses are really helpful, as are the __str__ methods for printing. It's always a challenge to make sure the examples used to explain a concept do not introduce too many other 'new' things at the same time. I do think a video about these 'helper' libraries would be useful, as they really save you a lot of time.

  • @fuuman5

    @fuuman5

    3 жыл бұрын

    Yeah, that's an important point. But you are doing great at finding the right mix which is shown by your amazing growth over the last month. Will definitly follow your upcoming videos - keep going!

  • @fashionvella730
    @fashionvella7302 жыл бұрын

    best best explanation ever

  • @jake115577
    @jake11557711 ай бұрын

    Thanks, Arjan!

  • @shreedaghatpande1878
    @shreedaghatpande18783 жыл бұрын

    As a senior dev in my team your sample code for bad example gave me a slight headache. But your explanation to all the changes made me way too happy. Thanks for the great content 👍. After completely watching the video this reminded me why people say good code doesn't need any mandane comments.

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    Thank you, glad you liked the example (at least the after part ;) ).

  • @MagnusAnand
    @MagnusAnand2 жыл бұрын

    Fantastic video! Thanks

  • @ArjanCodes

    @ArjanCodes

    2 жыл бұрын

    Glad you liked it!

  • @hashmarker4994
    @hashmarker49943 жыл бұрын

    Just found your channel! Your explanations are great!

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    Glad you like them, Hash Marker!

  • @Musa_Supreme
    @Musa_Supreme3 жыл бұрын

    Really amazing video. subscribed.

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    Thank you! And welcome 🤗.

  • @NegriniDaniel
    @NegriniDaniel3 жыл бұрын

    Excellent Video! Thank you

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    You are welcome, Daniel!

  • @rasimatics
    @rasimatics2 жыл бұрын

    Great explanation!

  • @ArjanCodes

    @ArjanCodes

    2 жыл бұрын

    Glad it was helpful!

  • @mhmt_dmr
    @mhmt_dmr2 жыл бұрын

    Thanks a lot sir.

  • @FernandoGonzalez-ir1bx
    @FernandoGonzalez-ir1bx3 жыл бұрын

    Very very usefull! Thanks a lot!

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    Glad it was helpful, Fernando!

  • @aron_z4720
    @aron_z47202 жыл бұрын

    I love your videos so much

  • @ArjanCodes

    @ArjanCodes

    2 жыл бұрын

    Thank you - glad you like them!

  • @chrisk8703
    @chrisk87032 жыл бұрын

    Thank you for the great video about cohesion and coupling, I can learn a lot from these videos about code structure design. One question about the types you added at minute 10:00 to the classes. When to use it that way compared to when using it directly in constructor e.g.: __init__(self, x: str)?

  • @david2am
    @david2am8 ай бұрын

    Best explanaition, thanks

  • @ArjanCodes

    @ArjanCodes

    8 ай бұрын

    I'm very glad it was helpful, David!

  • @valentinfontanger4962
    @valentinfontanger49622 жыл бұрын

    This is so unique

  • @JaBoss397
    @JaBoss397 Жыл бұрын

    thank you for the great review

  • @ArjanCodes

    @ArjanCodes

    Жыл бұрын

    Thank you Sean, glad you liked the video!

  • @samjoel4152
    @samjoel41522 жыл бұрын

    Loved this..

  • @ArjanCodes

    @ArjanCodes

    2 жыл бұрын

    Thank you so much!

  • @bennykopilov2819
    @bennykopilov28192 жыл бұрын

    Wow , this is something different , there are tons tutorials but you are good ! keep doing . Looking for descriptors and design patterns lecutres, any idea ?

  • @waex7089
    @waex70892 жыл бұрын

    thank you !

  • @alexign
    @alexign3 жыл бұрын

    Great video and talk. Thank you! Want more =)

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    Thanks! The next part will be released tomorrow :).

  • @sergelorenzvillasica2361
    @sergelorenzvillasica23613 жыл бұрын

    Great content!

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    Thanks so much Serge!

  • @harish.bhuvanachandar
    @harish.bhuvanachandar9 ай бұрын

    Great Lessons!

  • @ArjanCodes

    @ArjanCodes

    9 ай бұрын

    Glad it was helpful :)

  • @harish.bhuvanachandar

    @harish.bhuvanachandar

    9 ай бұрын

    @@ArjanCodes Great to see a reply from you. I have two questions, Arjan. 1. You used class variables. And you used instance variable as well. Why are you using both? Instance variables aren't enough? When to use which? Could you please help me in understanding that. 2. While writing functions inside class, when to pass variables to functions and when to use instance variables directly (self.xyz)? Which is best way of writing functions that helps in testing as well.

  • @bigutubefan2738
    @bigutubefan27382 жыл бұрын

    Great video! just a minor vocabulary pointer (business people have committed far worse sins): if you can't actually measure it, it's not a metric by definition. Cohesion and Coupling are heuristics. It's an esoteric word I'm trying to bring back!

  • @Maquirt
    @Maquirt3 жыл бұрын

    Amazing content!

  • @ArjanCodes

    @ArjanCodes

    3 жыл бұрын

    Thank you so much Carol!