What is Model View Controller aka MVC

What is Model View Controller aka MVC

Below text is written by AI and is little hard to read. Watch Video instead.

Hey there, Hitesh here and back again with another video in this video I want to talk about something specific to the technical part and specially the coding part that is MVC model view controller and I can understand I can understand your feeling that you might have watched thousands of video I might have read a lot of books about the design pattern and still you are confused about what is MVC or model view controller now I have also seen those videos and I just cannot digest the thing that why the people are just making a presentation and that whole circle thing and just goes like that and puts out some of the definition And Nobody understands that now what is the point of putting up a definition from the book just in front of the people and people don’t get the concert in itself so in this video I will try my best to make sure that you understand the concept of model view controller as easily as it is possible before we move ahead and talk about what actually is model view controller let me let me walk you through that what are basically the concept is this is not a new concept first of all and it is a thing that you see in your daily life as well I’ll prove that an example just in a moment and also this is not specific 21 programming language it is a way of how you organise your code it is not like a specific thing for Ruby or PHP or for Java or for Swift it just the way of how you organise your code and trust me you also seen this kind of pattern every single day in your life and I can do a little bit better job in explaining what model view controller so let’s try that you have seen view controller problem in your day today life now let me try to explain what the model view controller is and where you see in your daily life so let us see that this is you now you go to a restaurant and let just assume the Snow White and tyre animation kind of thing is a restaurant and you want to a restaurant now what you do at a restaurant you don’t just go to the kitchen and make a field by yourself you can do that at home so what you wait you just go there and you wait for a waiter to come on way to comes to you and you just ordered the food to the waiter now where is not aware who you are or what you want to have a just get that from you now whenever you tell the waiter that yes I want this the way to just get the order and now waiter moves to the kitchen now in the kitchen waiter is not going to prepare your food the food is prepared by the cook the let’s bring out the Kirk now where will tell that the Kirk hey this this is a guy out there and he wants this kind of food and now cook is the guy who is going to prepare the food for you but you cannot prepare the food magically he need some ingredients to cook the food will open up the fridge and will put out something to say you order an omelette Sohail get the egg sugar and whatever it need so let’s bring our fresh as well is there and cook will cook the food now cookeville finally hand over the code to the waiter and probably the cook might hand over a couple of other foods as well like maybe a glass of soda or maybe my favourite I stay or omelette that you have order now it’s the job of the waiter to move those food outside the kitchen now where is actually aware that what kind of food need to be served to you and how it should be served so waiter comes back to you and order and your order is NASA so what this is all about and you might have been guess that but this is all of your model view controller let me show you how that works on that day you get it actually have leave this way today is actually the controller and yes you get that right that today is model in it in case you haven’t guessed that yes this is actually the data so how about that this is a cool example and this is the thing is see everyday you have been going to restaurant everyday and they are following a model view controller objective throughout the year so this is basically your model view controller now I can understand you have gone through with that restaurant example be easily and nicely now I want to understand how this is applied in the curve the first of all a lot of people believe that model view controller is a thing for only Dot Net or maybe only for Ruby or maybe only for PHP but its not its a design pattern it’s the way how you arrange your code and it’s going to be possible and everywhere you might want to write an HP Swift java.net Ruby Python you can just arrange your could like that the whole advantage of this approaches you can write the code and the more the code is going to be done it’s going to be more beneficial what I mean by that all the I’m trying to say is we are trying to reduce the dependency of each code and others file in this file from each other we want that is some data has been passed on this file it just print it just process this data it shouldn’t be worried about from where the data is coming up from are there should be an independent his between these cover it just needs a data fetching the data and that’s an example we can see that is not actually worried about who is ordering the food is it a male or female is it a kid or maybe a grandpa just get the order and cook the food and that is actually a of accepting the people each other now this is a basic example and you will see this kind of thing quite a lot in my boot camps where it iOS or Android that I always recommend to use the model view controller approach but let me give you also an example that this kind of approach although is good in most places but in some places it can be opposite of that like for example if there is a store which just sells the popsicles aur ice cream it would be really bad eproc if I use modal view controller there because there is just one job to do just bring out the ice cream from the present service that’s it if you if you will use a model view controller approach there it would be over news and overkill of the resources at some point of the time model view controller is not a good approach but in most of the cases where application is pretty humongous pretty big then it’s a good idea to use a model view controller approach Although we are not going into the in depth of a what is model what is what is controller because if if I’ll be taking an example specifically for Android it would be really not a good thing for us if I’ll be taking an example directly from iOS it would not be a good approach for Android cell and doing here is trying to generalize the thing as much as possible now one thing I would like to mention that a lot of people mis understood the thing that you are model is not the data again I repeat your model is not the data the data is completely separated it need to become so that is what the f*** is doing in our example and in the real life example your data would be something touching up from an API request or maybe from the firebase or wherever you are touching your data and your mother should be the guy who should put up these data check process the data and finally controller should be responsible from taking the data filtering the request and ledger say you have asked for a result of maybe top 10 wonders of the world and their can be hundreds and hundreds of such wonders of the world you are looking only for the ancient wonder of the world so it’s the job of controller to filter out the data and just produce that on to the view and job of the view is simply to arrange rows data which has been passed on from the controller and dad said this is a General approach that I tried to show you in this example and I think this is going to be one of the best movie on modal view controller approach I think I think that this video has cleared up of the concert about model view controller just on to summarise again think this is not a specific approach for dotnet PHP or JavaScript it’s a generalized way of writing the card it’s a generalized way to separate the data dependencies and again model view controller is not always a good approach in most of the case is it is but for the small scale application it can be sometime over things a guy the weather’s are the shows the whole idea about the model view controller and in case you’re new to the channel make sure you to hit the subscribe always come up these kinds of awesome content here and talk all about programming web apps mobile apps and pretty much everything related to check so and hit the like button in case you like the video also make sure you comin down below what kind of more search topic you would like to see on this channel and I’ll surely catch you up

Next Post

Top 5 text editor for Web development

Related Posts