this is one of the best examples to introduce people to model-view-controller I have ever seen online. Love your videos.
@ArjanCodes3 жыл бұрын
Thank you! Glad you’re enjoying the videos!
@cryp0g00n42 жыл бұрын
It really is. I watched a few videos and it was like a cat scratching a blackboard. Either it took a long time for me refresh myself on it or this was explained well. I would like to say its the latter and not the former :).
@הודגמרסני-ת5ל2 жыл бұрын
quick fix: The Best**
@michaelmichelotti4603 жыл бұрын
Awesome video! I started Python around 6 months ago and have just recently started building larger projects. I realized immediately that software architecture was an entirely different skillset from the algorithm-centric coding problems most people think of when they think of learning to code. I think I actually find architecture the hardest part of SW dev. Love content like this that helps to understand it!
@ArjanCodes3 жыл бұрын
If you're wondering: the quote on the letterboard is from Goethe. I'm still trying to figure out how it applies to software architecture, which seems to be closer to frozen yoghurt than frozen music.
@stoneworld7556 Жыл бұрын
I read it in context of the Disney movie, "software architecture is Frozen music... Let it go, Let it Go Can't hold it back anymore"
@gregor9811 Жыл бұрын
When I saw that quote, I was thinking of the famous misattributed quip "Writing about music is like dancing about architecture". Both Frank Zappa and Elvis Costello have been credited with this line, concerning music criticism apparently, but both have indicated that they never said it...
@brianhacker73463 жыл бұрын
Model View Controller is the architecture pattern that I first learned years ago and I still use most in my work. Watching you explain it though, I did learn how to easily integrate the strategy pattern and the value in doing that. I just wanted to point out that you created the Model, but didn't have it do anything. I do recognize that this was a simple example. But, in this case, your controller class knows too much about the model's implementation and even dominates it. This was most apparent when you cleared the list of IDs, the controller did 'self.model.uuid = [] ', where you may have left it to the model to do this by issuing 'self.model.clearList' and let the model decide how best to clear the list. Still, this was a great walk through to demonstrate the value of good architecture.
@ArjanCodes3 жыл бұрын
Hi Brian - thank you and you’re absolutely right. The model in this example is nothing more than a global variable in fact. Normally, you’d have something more complicated like a database. And then, the model would get the same treatment as the view: add methods for the various operations, and use an abstract class to separate the model from the controller.
@brianhacker73463 жыл бұрын
@@ArjanCodes I noticed the additional functionality you added to the Model class in Github. Thanks! I bought you a cup of coffee.
@coldhardwick3 жыл бұрын
I know the youtube algorithm loves
@ArjanCodes3 жыл бұрын
Thank you very much! Yeah, the algorithm definitely favors shorter videos, which is not always best for explaining software design topics.
@coldhardwick3 жыл бұрын
@@ArjanCodes by the way, I've read and still have the text you often reference: Design Patterns. After reading it, I refactored a great deal of my code to align with the design principles outlined in the book. And then you came along and started talking about the book and showing some examples in python. So I am now refactoring once again to make things easier and easier to reuse. What's nice about all this is when I need to write something new, I already have an extensive framework because of Design Patterns coupled with your explanations and examples. Cheers mate! Keep up the good work.
@calebmcarthur78613 жыл бұрын
Fridays are even better now that I found this channel!
@ArjanCodes3 жыл бұрын
Thanks Caleb! :)
@anelm.51273 жыл бұрын
Please do more software architecture videos. Your design pattern videos are amazing but the architecture bread and butter is what I need in my life 😄
@joshuamcdonald58503 жыл бұрын
for real this channel is going to hit 100k in like 4 months
@ArjanCodes3 жыл бұрын
Let's see, not making any predictions for the moment! :)
@MrWadood0073 жыл бұрын
Great video! I admire detailed description boxes a lot, this looks like a sign of a channel which will blow up soon.
@ArjanCodes3 жыл бұрын
Happy you liked it! I’ll make sure to keep filling up the descriptions, hope it helps, haha 😊.
@FurquimRafa2 жыл бұрын
Best example I could find about a MVC using python for desktop application. Thanks!
@HasaniSaeed Жыл бұрын
Your playlist is one of the best videos about software design . Thanks
@ArjanCodes Жыл бұрын
Thank you!
@roddydykes70532 жыл бұрын
This is a great way to have the video, show all the code be written in real time (sped up but not too fast), with a small box with you talking in it.
@ArjanCodes2 жыл бұрын
Thanks so much Roddy, glad you liked it!
@naveenchandpandey79403 жыл бұрын
I stumbled upon your channel while randomly going through different content and since then i cannot stop watching your videos. Great quality videos with a really nice way of teaching which keeps the video engaging till the very end.
@ArjanCodes3 жыл бұрын
Thank you, happy you like the videos!
@judegomolina2 жыл бұрын
At my current job we use Hexagonal Architecture with Kotlin and Spring, which regardless of being MVC by default has the flexibility to allow clean architectures. I have found hexagonal to be a more convenient than MVC since it allows you to isolate your coro domain modeling and business rules isolated from external stuff such as the framework, the persistency library and so on. However it is worth noting that such a win in terms of maintainbility and low coupling is paid with some additional complexity in the project structure, therefore I would say that it should be assessed whether or not such a pattern is required for a specific project.
@djl30093 жыл бұрын
Thank you! I enjoyed both the video and playing around with the code. I recently came across your channel and have been enjoying it immensely! For a future video on this architectural pattern, how about adding another alternate version that uses the Observer pattern for Model->View updates. If I remember correctly that is what Martin Fowler refers to as "Observer Synchronisation" in an MVC architecture. In your example you've implemented what he calls "Flow Synchronisation" where the Controller directly updates both the View and the Model directly as part of the input processing flow. With Observer Synchronisation the Controller updates the Model, and the Model notifies one or more Views via an implementation of the Observer pattern.
@blkdima2 жыл бұрын
What is shown in the video looks more like an MVP pattern to me. I have seen many different explanations about the MVC and MVP patterns. Some explain the MVC pattern in the same way as in the video, while others explain the way you explained.
@kitgary2 жыл бұрын
It is useful. It is quite surprised that many software engineers don't care about software architecture in production code.
@michaelsmith77393 жыл бұрын
Discovered your channel a few weeks ago. Great stuff! Keep it up. Groetjes uit België beste Noorderbuur!
@ArjanCodes3 жыл бұрын
Hi Michael, dankjewel! Happy you’re enjoying the videos.
@sebastianrodriguezcolina6343 жыл бұрын
I would love to see a video on Hexagonal Architecture or Clean Architecture. I try to follow it while writing backend services, but your videos always make me realize something knew :)
@stephanieelisagonzalezried9509 ай бұрын
Love your videos Arjan! I am currently using a MVC architecture to build a desktop application using Python for the model and controller, and PyQT for the view. I am struggling to scale up the MVC architecture as the application becomes increasingly complicated. All of the separate layers are becoming very large. The model has been broken into many different subclasses, but the controller and view are still one class each. I am struggling to figure out how to break down the controller and view layer so that I can scale up my application better. Have you thought of doing a part 2 of this video where you show what happens once your application becomes more complicated?
@MrWrklez3 жыл бұрын
I've been looking for this kind of content for a while. Just subscribed!
@ArjanCodes3 жыл бұрын
Thank you Lester, glad you’re enjoying the content!
@ramirotell2 жыл бұрын
Enjoying each of this video series. Can you do more videos about this topic? thanks!
@הודגמרסני-ת5ל2 жыл бұрын
this video was amazing for me, like your videos in general. just thank you!
@1oglop13 жыл бұрын
This was a really great video! Finally showing the architecture in practice!
@senthilkumarpalanisamy3653 жыл бұрын
Excellent sir, thanks for posting. Content is simply precise and perfect. Please post more.
@ArjanCodes3 жыл бұрын
Thanks so much, will do!
@Vijay-Yarramsetty2 жыл бұрын
Found another great channel. Kudos.
@chriswunder54202 жыл бұрын
thanks for the great video! I'm suprised at how good tkinter buttons look on a mac, without any modifications.
@AnIceCrasher3 жыл бұрын
Another great video making me aware of more to take into consideration 😅 And it is very awesome, that you explain it with a code example and then also use a design pattern to show the diffrence.
@ArjanCodes3 жыл бұрын
Thanks IceCrasher! The examples require always a bit of preparation, but I agree they are crucial to clarify how everything fits together.
@AnIceCrasher3 жыл бұрын
@@ArjanCodes Now only a UML class diagramm is missing and then it would be perfekt :)
@microdevelopers2 жыл бұрын
Thank you so much sir. I learnt alot of advance stuffs from your videos.
@davidl33832 жыл бұрын
thank you so much. Learning python is a thing, doing it well is another :)
@ArjanCodes2 жыл бұрын
Thanks so much David, glad you liked it!
@andreas36823 жыл бұрын
Thanks for the great content! In case you're not familiar with Ctrl+D (selecting current and with each hit of "D" the next occurrence) and Ctrl+Shift+L (selecting all occurrences) in vscode yet, i recommend you try those out. It's super helpful when selecting and replacing code. Another nice alternative is F2 (rename variable). :)
@ArjanCodes3 жыл бұрын
Thanks Andreas! I should put in some time to get more familiar with the many shortcut keys in VSCode. The ones you mention are definitely very useful indeed.
@sudheendraraobilamkar69383 жыл бұрын
Simple and nice explanation, I like the way you explained the concepts.
@ArjanCodes3 жыл бұрын
Thank you so much 🙂
@EW-mb1ih2 жыл бұрын
Nice videos. I especially like the "Analysis of the new code" part where you link architecture, design pattern and synthax structure. One question to be more general: how would you link, architecture, principle, design pattern and maybe other low level part?
@pierrette643003 жыл бұрын
Thank you for this video! I have a question, At 5:37, why did you leave the passed controller as is instead of making it an attribute of the View class (self.controller) ?
@ArjanCodes3 жыл бұрын
Setting it as a class attribute is surely also an option. I didn’t do it here because it wasn’t needed for this example (everything is patched up in the setup method).
@pierrette643003 жыл бұрын
@@ArjanCodes I see! Could you have also used the model and view directly from the __init__ of the Controller instead of making them attributes of the class then?
@sagiziv9273 жыл бұрын
Great video, but I am not sure about the View class. As far as I know it shouldn't know about the controller at all. In your code, the view is dependent on the controller and vice-versa, and therefore you wouldn't be able to separate those classes to separate files because you would have cyclic references. You even encountered it in the video at 11:27, where you had to move the View class above the Controller class so the type-hint would compile, but you can't add a type hint in the View. I think that the View should receive the functions (or, as someone else suggested here, an abstract class with these functions). Anyway, great video I really love your content 😊🤓👨🏻💻
@ArjanCodes3 жыл бұрын
Good point! It would indeed be better if the view has no knowledge of the controller. I might revisit this in a future video.
@TheMouseair Жыл бұрын
thanks for this tutorial, very helpful to me :) one thing I would like to ask is at the end final thoughts, you mentioned you are not a big fun of MVC, because at the end, user always wanna something out of the box. I totally agree with this, but any suggestion to choose some framework that can manage this situation?
@terguunzoregtiin87913 жыл бұрын
Thanks for your great video. I think I'll keep watching your tutorial every time you updates. By the way, could you choose some well written code bases and explain some practical uses of design patterns or architectures in that code base like requests or flask ?
@ArjanCodes3 жыл бұрын
Thanks for the suggestion! I'll definitely think about doing a video about backend API building and/or http requests.
@hcubill3 ай бұрын
Awesome Arjan what books do you recommend to read more about mvc in python?
@fashionvella7302 жыл бұрын
i think its good if we place the uuid adding and removing function in model class i want to say according to information expert uuid related function have to be in the model class or the main thing it is very tight coupled
@Tekay372 жыл бұрын
I have an issue with the term "Architecture" in this context. When I think about architecture, I think about more of a big picture perspective, like uncle bobs "Clean Architecture" that's oriented around Boundaries and Dependencies across boundaries. So intuitively I'd see MVC closer to a design pattern or a meta design pattern if you will, because you could see the Controller as a Facade for more complicated logic where a model holds some data and the view determines how to display the model data on a screen. 🤔
@ArjanCodes2 жыл бұрын
I get that, though MVC is clearly noted as an architectural pattern in the industry. The idea is that MVC provides the overall structure of your GUI application and then you use design patterns within that structure. For example, in the model you might use composition to structure the data, in the view you might use the observer pattern to handle UI changes, and in the controller you might use patterns like the strategy to change the logic dynamically.
@qwertyuiopsdfgh2 жыл бұрын
Why make the abstract View class? Will there be another GUI framework for the future that would necessitate adding a class such as PyQTView, for example?
@pydocs-pro2 жыл бұрын
What is the best software architecture for data science applications, thinking that they must have the sequential steps: collect data, preprocess it, train model, make predictions and save the results?
@Antuan29112 жыл бұрын
Very good example! Thank you!
@StanislavGrebenyukov3 жыл бұрын
Thanks for your big job. I watched all of your videos. It's awsome.
@ArjanCodes3 жыл бұрын
Glad you like them!
@robertbrummayer49083 жыл бұрын
Hi Arjan, thank you for this great video. I have two comments: 1) In the Model, "uuids" would be a better name since multiple ids are stored. 2) From my point of view, what you showed as strategy pattern is a very basic form of it at best. I am not sure if I would call it "strategy pattern" here. As you know, in the strategy pattern, typically an (abstract) class is used with (abstract) methods where sub classes provide the respctive behavior. I would rather say what you do is constructor-based dependency injection to make the uuid function configurable. But that's just my two cents :)
@beezow71132 жыл бұрын
Often times creating an entire strategy object is unnecessary in languages with first class functions. Especially if you can type safe it with the correct parameters and everything. This is certainly strategy pattern python just simply makes it easier to implement. Also iirc strategy pattern shouldn't have multiple methods, usually the wrapper is just to pass it for constructor injection. If you add multiple strategies in a single class its gonna just start bleeding into other patterns like repository etc.
@ComputerScienceSimplified3 жыл бұрын
Awesome video, keep up the incredible work! :)
@ArjanCodes3 жыл бұрын
Thank you! Good luck also to you with your channel, very well done and interesting topics.
@zdzichuWentyl3 жыл бұрын
As always great job i love yours approaches to share your knowledge It would be great working with you
@david-pe5qi3 жыл бұрын
Great video as always, greetings from chile :D
@ArjanCodes3 жыл бұрын
Thank you very much, David!
@FineAndAndy3 жыл бұрын
What's the right way for the view to get information from the model? In this example, the model contained very little structure, and the view maintained a duplicate of the entire list of uuids, but I imagine that it's not generally the goal to have the view class duplicate the model like this. As an example, suppose I'm coding a checkers game (or something similar). Presumably the model class is the right place for a list of which board spots should have which color checker in them (or be empty). But the view needs this information when it comes time to draw. Would you have the view class maintain a duplicate list of this information? Would you pass the model to the View.setup() function so the view can access the model's information when needed? Would you create a method in the controller so that the view can access the model, but only by going through the controller? Something else?
@gianniskiriakou62192 жыл бұрын
Is it possible to have multiple controllers in an app using the model view controller pattern?
@joshuamcdonald58503 жыл бұрын
Wow, best video yet!
@ArjanCodes3 жыл бұрын
Glad you enjoyed it, Joshua!
@FlaviusAspra3 жыл бұрын
I'll leave here the feedback I gave you on reddit with the hope that it benefits other viewers not funneled through reddit: I think you did a great job at explaining in simple terms what things are and where they are positioned. However, here some additional input: - in the same bucket as design patterns you should also put anti-patterns; we as an industry talk too little about them - on top of patterns and antipatterns come design principles; we as an industry talk too much about SOLID, but in reality there are over 20 of them. In the same bucket also go anti-principles; we also don't talk enough about them - regarding frameworks: if you let your framework dictate how to do your architecture, you're doing something terribly wrong. I'm afraid elaborating on this would take me too much effort for this post, but you can read between the lines about this on my wiki; if you have concrete questions, please ask - MVC is not an architecture if you really want to do it right. At most, it's a design decision you can have in your Web plugin (think adapter and ports, where a delivery mechanism, here the web, is Plugin) - your example, while showing good design, is too simplistic to explain anything about architecture - examples of architectures: layered, n-tier, ports and adapters; please note that they can be combined in very harmonious ways - above architecture you have architectural principles and anti-principles like: single source of truth, microservices, etc; and no, specific vendors are not architectures, like: using aws is not an architectural decision, it's simply a tooling decision This last point highlights how design and architecture go hand in hand: you have single source of truth at the system level/architecture, but you need to follow through with this also at the design level, for example by making sure that only one object has setters and getters for particular pieces of information, and all other objects delegate to this single source of truth the write and read operations. So all in all, architecture and design go hand in hand.
@ArjanCodes3 жыл бұрын
Thank you Flavius, much appreciated. For completeness, this is the link to the original Reddit post: www.reddit.com/r/softwarearchitecture/comments/ms29z8/what_is_software_architecture_and_how_is_it/?
@victorh.torres27133 жыл бұрын
Hi Arjan. Again, thanks for your explanation. What do you think about this possible change in your example code? The TKView class has a usage relationship with the Controller class by the setup method. Maybe the Controller class implements a abstract class, for example the 'Click' class, with the two abstract methods that need TKView to enroll in the framework buttons. Now TKView receive a 'controller: Click' and the view don't have a relation with the controller implementation. The idea is similar when you separated the TKView with the Controller. Best regards!
@ArjanCodes3 жыл бұрын
Good suggestion, I think you certainly further improve separation by making Game less dependent on the view, so you can later on decide to switch out Tkinter with something else and don’t have to change anything in the rest of the game code.
@MrCucolea3 жыл бұрын
Good content to broaden your view on software design. It would be nice if you could compare the architecture of popular python web frameworks(Flask, Django, FastAPI) with pros, cons and potential use cases.
@ArjanCodes3 жыл бұрын
Glad you liked it Robert, and thank you for the suggestion!
@הודגמרסני-ת5ל2 жыл бұрын
your videos are diamonds
@bckzilla2 жыл бұрын
Very inspirational. Thanks!
@ArjanCodes2 жыл бұрын
Thanks so much, glad you liked it!
@vitim1443 жыл бұрын
Awesome video! Congratulations.
@ArjanCodes3 жыл бұрын
Thank you Victor!
@aadithyavarma3 жыл бұрын
Great video! Can you do a video on singleton pattern which can be used as a decorator?
@ArjanCodes3 жыл бұрын
Thanks! I actually did this video a while ago, perhaps you find it helpful: kzbin.info/www/bejne/iJ6Xe4Ntf8umgbs.
@aadithyavarma3 жыл бұрын
@@ArjanCodes Great! Love your python videos and I have decided to start from your first video. Will reach here soon :). Amazing content and great production quality videos!
@ArjanCodes3 жыл бұрын
Thank you, glad you like the videos! Let me know what you finally end up with!
@enricoroselino75572 жыл бұрын
so how do you get that darkmode tkinter ?
@ravenecho24104 ай бұрын
Can u go over how to integrate languages, theres like communication over local host, theres communication over port(?), and theres like foreign function interfaces I think i got (2) wrong, but say i write some part of my arch in rust, its a much better version than my bash library and much more efficient and safe engine feom python, but now i want to use intigrate it within python bc there are no SDKs for rust... what do i do? Do i just write a couple of modules to wrap the Curl interface? If the server sends me down classes (what i would presume is the like modus opperandi for sdks) and a non native json seriable type(s)... do i just implement those or extract data? Do i have to port every type they send me, and port every interface and string reprentable non-primitive object i have to send back???
@sasucarefree46943 жыл бұрын
Why is the controller less dependent on TkView after using the abstract class? You have been using the abstract class in several videos but I can't grasp the benefits yet. Could you elaborate on it a bit more?
@ArjanCodes3 жыл бұрын
The abstract class acts like a separation layer between the different parts of the architecture. If you make the controller dependent on an abstract class instead of TkView directly, you could replace the view by another type of view (for example, QtView) without having to change anything in the controller. So in essence, if you do this in different areas of your code, it will be less work later on to change it.
@cod-newbie91662 жыл бұрын
How do I start implementing these in my projects?
@stiffer_do3 жыл бұрын
AMAZING! thanks Arjan
@ArjanCodes3 жыл бұрын
Glad you like it!
@imadetheuniverse4fun2 жыл бұрын
Would it be fair to say that there is a very tight coupling between the Controller and Model and the Controller and View, but that's okay because it's intentional and well defined in a single place?
@jananiarunachalam57063 жыл бұрын
Really cool video!
@ArjanCodes3 жыл бұрын
Thank you!
@abdelrhmanahmed13783 жыл бұрын
thank you for your great content ,can you make video about django ARCHITECTURE
@ArjanCodes3 жыл бұрын
Thank you for the suggestion!
@yoyonel18083 жыл бұрын
Very nice video, thx for sharing ! :)
@ArjanCodes3 жыл бұрын
Thank you @yoyonel1808, happy you enjoyed it!
@pani36102 жыл бұрын
why isn't lisvariable and textvariable used? wouldn't it make managing values of widgets better?
@pani36102 жыл бұрын
*listvariable
@HandcartRule463 жыл бұрын
Great video 👍
@ArjanCodes3 жыл бұрын
Thanks !
@Evkayne3 жыл бұрын
I wish I came to know about your channel earlier sir!
@ArjanCodes3 жыл бұрын
Glad you found me anyway :).
@malgindesilva27583 жыл бұрын
Bro, do you have a paypal option. I can't put my card details. I really love your teaching this video. Thanks
@ArjanCodes3 жыл бұрын
Unfortunately, no. But thank you anyway for trying!
@joshuaolatunji45953 жыл бұрын
Wow, this is great.
@ArjanCodes3 жыл бұрын
Thank you Joshua, glad you liked it.
@syspo8 Жыл бұрын
thanks for this
@ArjanCodes Жыл бұрын
You're welcome
@michagolemo37653 жыл бұрын
great great great stuff
@ArjanCodes3 жыл бұрын
Thanks so much Michal!
@DrSpooglemon3 жыл бұрын
The model class is redundant. Why not just use the list directly as the model?
@ArjanCodes3 жыл бұрын
Because the idea is that ultimately, the Model class will provide an abstraction to the data. In this simple example it doesn’t make a difference, but generally you’ll have a way more complicated model and then it’s important to make this separation.
@chromosome243 жыл бұрын
I use the spaghetti architecture.
@ArjanCodes3 жыл бұрын
It's the best architecture ever. Especially combined with the "pesto" architectural layer.