Arjan, thank you so much! You are filling a void in programming tutorials. So many tutorials are way too basic, way too advanced, or way too light on details. And almost none of them go into the how or the why of design and architecture. There's a lot that you learn from just doing it, but you are hitting a sweet spot of advanced concepts without making me feel like a newbie. Your material is beyond beginner level and pre-expert, which is a difficult thing to accomplish, but you do it well. Thank you and keep it up!
@kevon217 Жыл бұрын
^
@absoluum3 жыл бұрын
Thank's for the videos Arjan. I've been programming with python for about a year with no formal training, and hearing about these methods and seeing examples have been very beneficial.
@ArjanCodes3 жыл бұрын
Glad that you like them and that it helps you!
@diegol_1162 жыл бұрын
I am an industrial engineer from Colombia, I study programming in a self-taught way and I am enormously grateful for the content you upload...
@doublegdog3 жыл бұрын
One of the most underrated youtube channels out there. Great informative videos! I am a senior engineer and it is always nice to expand my knowledge, even if I have forgotten a lot of these.
@ArjanCodes3 жыл бұрын
Thank you so much, glad you like it!
@ArjanCodes3 жыл бұрын
I'm wondering: did any of you use one of these two patterns in your code recently? Let me know!
@stevev4693 жыл бұрын
Me! Implementing the Bridge as a final assignment when following your course system development methods. Great to see my former teacher making clear KZbin videos about complex subjects. Passed with a 7.5!
@ArjanCodes3 жыл бұрын
Yes! - and I can officially confirm you got that grade without bribing anyone ;).
@stevev4693 жыл бұрын
@@ArjanCodes Phew that was a close call😅 Ps: Great videos by the way. You must have practised alot with the sound effects during that course. Looking forward to an abstract factory sound effect reference😉 Keep going!
@ArjanCodes3 жыл бұрын
Thanks Steve! I did learn a lot about video editing since teaching that course, so I hope things are a bit less "cringeworthy" this time around 😂
@bubblefoil3 жыл бұрын
No, but I had to maintain a codebase full of template methods and learned the hard way that it is the worst of all programmer's nightmares. It should be listed as an anti-pattern because it basically validates sharing code via inheritance. Never ever re-use code via inheritance. We have composition for this purpose.
@PavloOrynchak3 жыл бұрын
Wow! Arjan, thank you very much! I've started rewriting my code using your advices already after second video in your channel. This channel is a gem! Exactly what I have been missing for years!
@ArjanCodes3 жыл бұрын
Glad to hear the videos are helpful to you!
@ke30_3 жыл бұрын
Very cool, thank you! I would love to see more design patterns explained by you
@ArjanCodes3 жыл бұрын
Thanks Kevin, glad you like it + there’s more in the pipeline 😉.
@matsim03 жыл бұрын
Thanks again Arjan! I really liked the "Head first design patterns" book (which I bought some time ago in a HumbeBundle sale). But I've not yet actually worked through all the examples, because while it is explained excellently, the examples are somewhat more involved than yours (and they are in Java...). Your examples on the other hand are reduced to the minimum which I like very much - it is a joy to just go along with them and try them out while following the video.
@ArjanCodes3 жыл бұрын
Thanks matsim0, glad you like the examples!
@UgoAno2 жыл бұрын
First time commenter. Your tutorials are outstanding and clear. You are helping me in a different way. I find I implement a lot of these patterns by attempting to be as SOLID as possible. But you're highlighting what those patterns are and their names. I'm going to recommend the people I manage to watch your videos.
@sergioquijanorey74262 жыл бұрын
This video was pure gold. Thanks for explaining two complicated patterns for me with such a good example,
@ArjanCodes2 жыл бұрын
Thank you Sergio, happy you liked it.
@ryanperkins39292 жыл бұрын
I've come to consider you one of my primary instructors. Thanks for your presentations.
@davia.sampaio86332 жыл бұрын
I just discovered your channel and I'm without words to express my love for your work. Thank you very much
@ArjanCodes2 жыл бұрын
Glad to hear you like the videos!
@PillesPlace2 жыл бұрын
You run the best python channel that I know of. Many thanks for this education!
@ArjanCodes2 жыл бұрын
Thanks so much, glad the content is helpful!
@ulrickpspgo3 жыл бұрын
Hi! I came across one of your videos and couldn't stop watching for 3 hours! You provide such an interesting information! Thanks a lot for your effort. You earned a new subscriber!
@JackReacher12 жыл бұрын
I like the clarity that you have when you explain the design pattern. Most of the other people who understand them don't actually explain it well. Thank you
@ДмитрийДобровлянский3 жыл бұрын
Hello from Russia! Thanks a lot for your lessons! Very practical material! Your chanel is great!
@ArjanCodes3 жыл бұрын
Thank you very much, glad you like the content!
@viniciusmeireles62672 жыл бұрын
This channel is PURE GOLD! I think this two patterns will help me in my current project. I'll try to implement it in my code right now! Needless to say that I've subscribed and liked lol
@ArjanCodes2 жыл бұрын
Thank you - glad to hear the videos are helpful to you!
@GuRuGeorge033 жыл бұрын
I am in the 2nd week of my software engineering job now and there are tons of patterns in the huge code base that are being used and I love analyzing them and sometimes I even find ways to improve the patterns, in part thanks to your videos :)
@ArjanCodes3 жыл бұрын
Good to hear the videos are helpful to you. And good luck with your new job!
@lioneluran Жыл бұрын
Thank you Arjan! I've been programming for a while, now, but I'm self-taught and never heard about design patterns until very recently, with this series. Can't really see the difference between the Template and Strategy design patterns. They both use abstract classes depicting a backbone of abstract methods that are later defined in the actual class implemeting the non-abstract method. I'd love to see a video disambiguating these two, if you think it's appropriate. Cheers a keep up this great work!!
@watashiwan2 жыл бұрын
Really good explanation about the importance of design pattern. I can’t agree you anymore.
@coert3 жыл бұрын
Hey Arjan, just finished a cloud metrics and measurements implementation using your ABC/abstractmethod examples. Thanks for the great videos and explanations!
@ArjanCodes3 жыл бұрын
Hi Coert! Good to meet you here 😊. And happy that the examples were helpful.
@EW-mb1ih2 жыл бұрын
Thank you for your video! I don't get exactly what the templast design pattern do but I like the bridge pattern which looks like an extension of the strategy pattern.
@govindasharma86193 жыл бұрын
Why don't you write a book for design patterns in python? There may be 50 books out there but we all like how you explain and demonstrate with practical examples.
@t6u9343 жыл бұрын
You’re a great teacher! Thanks for all these videos.
@ArjanCodes3 жыл бұрын
Thank you! Glad you like the videos!
@Formulka3 жыл бұрын
it's hard to build larger projects without these patterns, at least if you care about your sanity, very nice explanation and the sneaky semicolon is becoming a meme :)
@ArjanCodes3 жыл бұрын
;
@ArjanCodes3 жыл бұрын
Perhaps I should hide a semicolon in my next videos and see who finds it first :).
@michaelhart89282 жыл бұрын
Arjan, these videos have been fantastic. I actually just left a role as an HFT (funny enough watching a trading example) and wanted to brush up on my python, given I have been primarily using Java for the past five years exclusively. Funny enough, the last video on event based systems (observer pattern) is a great use case for an HFT trading system!
@murghay013 жыл бұрын
If I may ask a question: I am creating a little application to start understanding which behavioral design pattern makes more sense. I make calls to any API. There are basically two functionalities that it has, First, on a 200 response, the JSON will get the id, user, personal information of a character. Second, there is a second key in the JSON response that will ultimately make a second request and do things. Both scenarios lead to adding values into the DB, but two different tables. I can't quite tell which would make sense: Chain of Responsibility Pattern, Template, maybe even Strategy (but I dont think this one). What makes one far more excellent than the other. Honestly, all of the behavioral design patterns seem like a riff of one another.
@ArjanCodes3 жыл бұрын
What I would suggest is to start from the principles instead of the patterns. What function has what responsibility (cohesion) and how are they coupled? Then, imagine how each pattern changes that. Any of these patterns may work considering what you describe, but the way data is stored and used in your code also plays a big role (especially for coupling), so some patterns will probably lead to a better result in terms of reduced coupling and strong cohesion.
@murghay013 жыл бұрын
@@ArjanCodes thank you very much
@diegorodriguezv3 жыл бұрын
Great videos! Thanks. A heads up: The code coverage video is missing from the Software Design in Python playlist.
@TimGrob3 жыл бұрын
I have not fully understood what's the difference between the method template pattern and the strategy pattern. The two look very similar. Can you tell me the difference once more? Thank you.
@jufenico3 жыл бұрын
This is great mate! I'm forcing myself to learn oop coming from functional and this is exactly what I was looking for. Your videos explain the concepts which is super helpful to understand and implement
@ArjanCodes3 жыл бұрын
Glad you liked it, Juan!
@shashishekhar---- Жыл бұрын
Arjan you are a true Guru , 🙏👌
@michalzdanowicz28162 жыл бұрын
It's a pleasure to watch your videos. Thanks for sharing your knowledge.
@ArjanCodes2 жыл бұрын
Thanks Michal, happy you’re enjoying the content!
@grzegorzryznar51013 жыл бұрын
I like format of these videos very much! Practice combained in really good way with theory :)
@JorisNonnast3 жыл бұрын
May I ask, what is the difference between the bridge pattern and dependency injection?
@bonmec1012 жыл бұрын
That there is association on abstract class level?
@SweetSummerChildern2 жыл бұрын
Hi Arjan! I have watched your video of Strategy pattern. I felt the template pattern is quite similar. I don't understand the diffrence.
@JohnMatthew13 жыл бұрын
Thank you for all your videos, you have a very nice presentation and make it so easy to understand.
@ArjanCodes3 жыл бұрын
Thank you John, glad you like the videos!
@rsrini73 жыл бұрын
Thanks. Unknowingly i used both the patterns in my code.
@Ejik532 жыл бұрын
Very good channel ,with good explanation and examples, thanks a lot!
@sreddy10243 жыл бұрын
Thank you, Arjan, for the great explanation. Is it correct to say that, "bridge design pattern is made of dependency inversion"?
@robertbrummayer49083 жыл бұрын
Excellent quality as usual. Great job!
@MrTrebor22 жыл бұрын
Python's world like to do things in "pythonic" way. Design patterns are a next step game changer. Template (state), bridge, observer/pubsub patterns + asyncio -> critical mass to build complex trading bots in a simple and managable way. East or west Arjan is the best!
@taneliharkonen24633 жыл бұрын
This was veeeeeery useful! :D Not very often u see people go explaining useful design patterns or techniques in utube. People go ooonanooon about frameworks and such, which is not that useful in learning. Frameworks come and go... design patterns and techniques dont! :o
@davidsyengo189311 ай бұрын
Amazing vid. The bridge pattern implementation seems to work similar to the proxy pattern.
@ArjanCodes11 ай бұрын
Glad you enjoyed the content!
@Karujin2773 жыл бұрын
Hello Arjan, thank you for the videos. Compared to these patterns you have used on the video what do you think of completely seperating the exhange and trader classes where you would get the prices from exhange class and then you would call the check prices method with a list of prices. That way you control what you want to pass and also you don't need mock exhange objects to test your trader. You just need a list of prices.
@ArjanCodes3 жыл бұрын
Thanks! Good suggestion. Most design patterns focus on separating things by looking at behavior. What you suggest is an alternative which separates things by data. This can be really helpful and is commonly used in for example REST APIs that separate different components of an application by (JSON) data.
@Megosks3 жыл бұрын
Thank you very much! I have actually used those a lot but I've never knew how they are named :D
@Han-ve8uh3 жыл бұрын
At 14:20 you were editing the Trading strategy and Exchange source code to change it's behaviour, Practically should this really be done? It feels really clunky. This video tells us to open the python file and edit it everytime we want to change some details, but I was expecting changes to be made through command line arguments during script calling with something like argparse to parse the selections.
@vladyn25223 жыл бұрын
Brilliant video series! thank you so much for making it available and accessible!
@ArjanCodes3 жыл бұрын
Thank you, glad you like the videos!
@SM-vg6xk Жыл бұрын
You're awesome. Please don't stop making videos
@ArjanCodes Жыл бұрын
Thanks!
@talibuddeenabdulhakeem3 жыл бұрын
If you were building an application. Would you keep all of these classes in one file? Also when you would start breaking you code into multiple files or modules? I struggle on when I should break something into another file because of too many classes. For example would averageTrader become its own module at some point and you have all the abstract base classes in one module... Maybe I am overthinking.. Thank you for the content, I have loved all your videos so far!
@ArjanCodes3 жыл бұрын
Thanks, glad you like the videos! I would definitely put each class in a separate file (including abstract classes). That also makes it much easier to find them later on when your codebase grows larger. The only reason I'm keeping everything in a single file here is that I don't have to switch to another view in the video.
@jasongen3 жыл бұрын
Thank you for the video! But what is the difference between Bridge and Dependency Injection?
@amnanajib81672 жыл бұрын
The template pattern seems to me very close to the strategy pattern presented. What is the fine difference?
@dennbauer3 жыл бұрын
Great video!! I like the way you explain with simple Examples - super cool. One question on bridges: let's assume I have to bridge over three abstract classes - in your Example maybe a Bot, an Exchange and a Trading Indicator. Would you rather build a fourth abstract class and use it as a bridge or would your bridge two classes from one? in case of the latter: How to decide which one to put in the "middle"? Hope the question makes any sense at all :-)
@jonasj.12643 жыл бұрын
Discovered your Videos about a week ago, absolutely love them! ❤ They may be the same principles i should already know from university, but ur examples and explanations definitly improved my understanding of them. Already recommended your channel to some fellow students 😀 In regards to this video, the bridge pattern seems to be very much in line with the whole composition principle, isnt it?
@ArjanCodes3 жыл бұрын
Thank you Jonas! Yes - the Bridge pattern is a great example where composition is applied tastefully.
@vivek773 жыл бұрын
Hello Arjan, First of all thanks for the work you are doing, I really enjoy your content and look back into my code and wonder why I didn't know this earlier. I can image it takes a lot of time and effort to create videos of this quality. Would you also through some light into factory pattern and when it is ok to follow this pattern ? Wishing you all the luck in reaching 10k subscribers soon.
@ArjanCodes3 жыл бұрын
Hi, thank you very much, I’m happy you’re enjoying the videos. Factory pattern is definitely something I’m going to cover soon.
@fuuman53 жыл бұрын
Congratz to 1k subscriber!
@ArjanCodes3 жыл бұрын
Thank you! I’m still looking in disbelief at that number...
@fuuman53 жыл бұрын
@@ArjanCodes You deserve it. This is just quality content. I am a professional developer for years and I would still watch basic videos from you just because you explain it so well :D Love from germany!
@kotslike Жыл бұрын
nice example Arjan! Well done :)
@ArjanCodes Жыл бұрын
Thanks a lot!
@bokistotel3 жыл бұрын
I still do not understand when should I use Strategy and when should I use Template?
@munkh-odjargalsaikhan2583 жыл бұрын
Good stuff! I wonder for a trading bot, which class shall be responsible for calculating position sizes and stop losses in this template? the bot or the exchange?
@christianwooldridge406 Жыл бұрын
bot
@RileyGein Жыл бұрын
I would love to see this series recreated for Golang
@thygrrr Жыл бұрын
At the time the video was released, indeed the best strategy would have been to sell bitcoin. :D I never heard of this pattern as "Template Method", I only know this as basic inheritance and the "Bridge" is what I know as the Strategy Pattern.
@dansmar_2414 Жыл бұрын
THE BEST CHANNEL!!
@ArjanCodes Жыл бұрын
Thank you!
@CarlosMorenoV2 жыл бұрын
My favourite design pattern: Template!
@ArjanCodes2 жыл бұрын
Thanks so much Carlos, glad the content is helpful!
@imadetheuniverse4fun2 жыл бұрын
I feel like I'm bugging you since I'm just going through all your content in order 🤣. I'm really getting a lot out of it! My question for this one: Do you think that the `typing.Protocol` class can be used here instead of / or in addition to the `abc.ABC` classes? For example with the `Exchange` class, it doesn't hold any data, it only contains methods (unlike the `TradeBot` class which contains a reference to an exchange). Would it be a good idea to instead define the exchange as `class Exchange(trading.Protocol)` ? (I only ask out of curiosity because I'm just learning about these things) Thanks again for the great content!
@ArjanCodes2 жыл бұрын
Glad you like the content, and yes, that’s certainly a possibility. In fact I think in some more recent videos I come back to the trading/exchange example and use protocols there.
@imadetheuniverse4fun2 жыл бұрын
@@ArjanCodes Good to know, looking forward to it.
@pablovirus2 жыл бұрын
Very interesting patterns and excellet video as usuas, thanks!! If only I had a job where I could use them now lol
@ArjanCodes2 жыл бұрын
Thanks so much, glad the content is helpful!
@ShanilPanara3 жыл бұрын
Absolutely loved this. So well explained. Thank you 💜
@ArjanCodes3 жыл бұрын
Glad it was helpful!
@tbtitans213 жыл бұрын
What about a class init from dictionary of buy/sell methods? HODL_strategy = { 'buy': lambda price: price < 10000000, 'sell': lambda price: False, } Saves some lines init_from_dict(HODL_strategy)
@ArjanCodes3 жыл бұрын
Sure, that would work, and this is perhaps a bit shorter. On the other hand, classes allow you to define more strictly what method names should be called, which parameters each method has, etc. That is helpful, especially if you're working in a team.
@talibuddeenabdulhakeem3 жыл бұрын
this is cleaver haha, Reading something like this would make me go crazy if it was in my code base
@jonathanheadley27293 жыл бұрын
Love your videos!
@ReRubis Жыл бұрын
Love this channel. :)
@proud22beme3 жыл бұрын
how does bridge pattern differ from composition? both seem to do the same thing, pass a instance of a class implementing the ABC to the object that needs to use it
@ArjanCodes3 жыл бұрын
Composition simply means that an object uses or contains another object. The Bridge pattern is a design pattern that uses composition, but in a very specific way: the composition occurs at the abstract base class level. As a result, the Bridge pattern allows you to have two hierarchies of classes that can vary independently, with a bridge (= a composition) to connect the two.
@proud22beme3 жыл бұрын
EDIT: nvm, i got it, just took some time to understand fully @@ArjanCodes so to try to summarize, bridge is a extension of composition where A needs to access B, but B is not in the same hierarchy, and A does not need to know directly about B. so C is created as a ABC class with generic methods (read, write, ect). and when C is created it is passed a refence to what to what it bridges to, so A calling C.read() is actually calling B.read() but A does not know that, it only knows that C.read() exists? hope that makes sense
@ArjanCodes3 жыл бұрын
Exactly- with the addition that A itself is also an abstract class. As a result subclasses of A use subclasses of C without any of the subclasses on both sides knowing about the other instance. For example, A could be the top of a hierarchy of player characters in a game, and C could be the top of a hierarchy of graphics engines. The bridge would allow you to render Mario on iOS and Luigi on Android or any other combination of a specific character + graphics engine.
@guanahmed98043 жыл бұрын
Help please; I have made a web crawler python projet and still not sure which design pattern shall I follow in web scraping case.
@ArjanCodes3 жыл бұрын
Hi! Feel free to ask your question in the Discord server: discord.arjancodes.com. Perhaps someone can help you there.
@Victorinoeng3 жыл бұрын
From my personal experience, I have leveraged the template pattern for web scrapers before. All my web scrapers had a very similar ETL process, but the actual Transform step could vary vastly based on the data/data source being scrapped. Hence I defined a base/template with the main generics methods and transform as abstractmethod In my experience, that was a great way to minimize amount of code, apply DRY, and yet have a very flexible approach
@DRanduletti2 жыл бұрын
it was a beautiful time year ago when stock moved faster then a Tesla Model S... Anyway thank you a lot! PS: i havent realised that i use Bridge pattern, i just called it compositin)
@maxitorres73 жыл бұрын
LOve it! Thanks a lot!
@ArjanCodes3 жыл бұрын
Glad you like it!
@babatumises.r.o.55683 жыл бұрын
Hi, will you have some premium content, i realy like your channel and content is very cool quality. Are you specialized only to python? What about PHP, Java, C#, C++, NVCC?
@some848842 жыл бұрын
Nowadays, it's clear that your predictor was right ad it was better to sell Bitcoin that time :D
@realKeiichiArt3 жыл бұрын
Great!! Thank you very much! :)
@ArjanCodes3 жыл бұрын
You’re welcome - glad you enjoyed the video!
@kopytko9983 жыл бұрын
I don't know how much money you earn, but it is not enough. Thank you!
@ArjanCodes3 жыл бұрын
Thank you Andrzej, glad you like the videos!
@sandorbakos29293 жыл бұрын
Amazing :)
@ArjanCodes3 жыл бұрын
Thanks! 😄
@DuyTran-ss4lu3 жыл бұрын
Cool!
@CrapE_DM3 жыл бұрын
I just find it weird that you kept saying "strategy" while talking about Template. I would prefer a Strategy pattern, personally. And then your use of the Bridge pattern is actually more of a Strategy pattern