‫Hello Master Coding family and welcome to Architecture Patterns Course.
‫I decided to start this course because we have started the dependency injection app course and we need
‫to learn some basic architecture patterns like MVC, MVP and Mvvm.
‫So welcome again.
‫And let's start with the course.
‫We will see this these concepts, the MVP, MVC, MVP and the dependency injection app that we are already
‫started the course and that we are working on it in the Food Recipes app that we are going to to start
‫it in the next couple of days.
‫That implements the Mvvm dagger hilt and retrofit and we will start a shop app with Firebase.
‫Also include these patterns and we will learn Kotlin course from zero to hero.
‫These are the next courses that we are going to learn.
‫Now let's go and learn the patterns that we are going to implement to our applications.
‫First of all, why we need to use a patterns and why we are making these patterns.
‫We think about.
‫You are a developer in a company and you are a very smart and you are making your own codes and you
‫teaches your friends how to make like a pattern and like a pattern of coding and you need to implement
‫it with your friends so you learn them correctly and you work on the same project and the same way of
‫thinking.
‫You called this patterns and this way of thinking and this way of writing the code, the happy cat pattern.
‫So you decided you with your friends to make a pattern called the happy cat pattern, and you work correctly
‫with your friends and they know how to use your codes and you know how to use their way of patterns
‫and writing of codes.
‫Now, now think that you are and you need to sell this code to another company so you and your friends
‫with the happy cat pattern and the codes and you need to deliver this code and sell this code to another
‫company or a company need to contribute with your project and enter this project.
‫But.
‫They are unavailable, They are unable to write or understand the happy cat pattern because you and
‫your team only know the pattern.
‫This pattern, this way of writing the codes.
‫So what?
‫What is the solution?
‫The solution is making them in a single and a unified way of writing the code.
‫Developers invented single patterns to write the codes.
‫They are called architecture patterns.
‫This way it's very simple to understand why you need to use architecture patterns.
‫Now.
‫Forget development, forget coding.
‫If you are if you have finished the the gym and you are very thirsty and you need to drink water, you
‫have many ways.
‫First of all, in order to get the the water bottle, you go to the supermarket.
‫You open the refrigerator, you get the water bottle and you pay.
‫So you open the refrigerator, you get the water bottle and you pay.
‫So you did everything.
‫Another way or another option.
‫You can do it with going to the restaurant or a coffee shop and you demand from a lovely waiter to get
‫the water.
‫So you request the water.
‫The waiter will go to the refrigerator and you will pay.
‫So the waiter in this case goes and gets you and give you the water bottle.
‫The third way is go into the vending machines at the gym or any place, and you request from the water
‫machine to make to give you a water bottle.
‫So you insert the coin, you request water and the machine will release a bottle.
‫These are three concepts.
‫These are the three different ways.
‫The first one.
‫You are the view and the model is the bottle because you are requesting what is the the thing.
‫You are requesting, you are requesting a bottle of water.
‫So model is bottle.
‫The view is you and the controller you because you go, you open the refrigerator, you get the water
‫bottle and you pay.
‫In the second way, you requested a bottle of water and this is the model view is the same because you
‫are you and the presenter here is the waiter.
‫So the the waiter acts as presenter who go to the refrigerator and get you a water.
‫Okay.
‫So.
‫The third one.
‫The third way is you are the view.
‫The model is the bottle of water and there is a view model which is binding.
‫So you are waiting.
‫You inserted the coin.
‫The water bottle goes down.
‫And in this way, in this case, the vending machine did not need to know who are you or for whom it
‫will serve.
‫Okay, so you are waiting.
‫The vending machine in order to release the bottle.
‫So you are binded to it.
‫This is the concept of binding.
‫You are binding to the vending machine.
‫You are waiting for the vending machine vending machine to in order to respond.
‫Releasing this bottle a bottle of water.
‫Okay, so the first one is a pattern called MVC model view controller.
‫The model is the bottle of water, The View.
‫You are the viewer and the controller.
‫Because you are you because you pay.
‫You get the water and you open the refrigerator by yourself.
‫You do.
‫You did everything.
‫Okay.
‫The second one is MVP.
‫You are the view.
‫You request to get a model which is a bottle.
‫And there is a linkage between this you and the bottle, which is the presenter.
‫And in this case it is the waiter.
‫And the third model is Mvvm model view.
‫ViewModel This case you inserted the image, the coin into the machine.
‫You request the water.
‫The machine vending machine takes about 10s in order to respond and to give you and to release the water
‫bottle.
‫The vending machine did not know and it is not requested to know you because it will give you only the
‫water according a bottle according to the to your request.
‫Okay.
‫Think about the second one, the MVP, because the the waiter needs to know you because a waiter needs
‫to know in which table on which customer requested water.
‫Okay, so the first one.
‫No need you because you are making everything by your own self.
‫So you know everything.
‫And the cashier and you don't they didn't need to know you because you are doing everything.
‫The refrigerator, the water bottle, you get them and you pay the second one.
‫They need to know you for whom they are serving.
‫So the water, because they need to get the water bottle to the correct table and the correct customer.
‫The third one, there is no need to know you because if you request the water bottle, you insert the
‫coin and no need to to see the vending machine to acknowledge you or recognize you because it is just
‫a executing what is requested.
‫Okay.
‫Back to the coding, back to Android and application development.
‫How this will work.
‫These patterns works.
‫The first one.
‫We have like a view.
‫We have a button or you have a text view or whatever you want.
‫The view and the controller are on the same class and we are requesting model.
‫We are requesting data from database, from network, from whatever you want.
‫The data request model.
‫Model.
‫So remember it, guys.
‫Model is the data that we need to reach.
‫The view is the thing.
‫The widgets that we have displayed into the app and the controller in this case is the main activity
‫or the activity that these views are represented.
‫So in the MVC model view controller, the view request from the controller.
‫And the controller goes to the model, get the data back.
‫And so the data now are the data is on the controller and the controller delivers it to the view.
‫This is the architecture of MVC.
‫Now in MVC Pattern, we will see that the view represents the widgets inside the Android application,
‫which is the widgets, the text of Use the Button.
‫Now the View will contact the presenter.
‫You remember the waiter and the presenter will contact the model, which is the refrigerator in the
‫in the example.
‫So the view you are the view telling the waiter, I need water.
‫The presenter Go to the refrigerator and get the data from the refrigerator.
‫And this data represent the bottle.
‫The third pattern is Mvvm.
‫The view requested from the ViewModel to get the data from the model and the database or network.
‫This request comes back as a response and the ViewModel is is able now and holding the data.
‫But you see that there is no linkage between the ViewModel and the View because view is binded to the
‫ViewModel.
‫So remember the vending machine, If you insert the coin and you request water bottle the vending machine
‫after releasing it, it didn't care about if you took the water bottle or your friend or your brother
‫or or any person on the on the earth took the water bottle.
‫And also it didn't care if any people or anyone or you took the water bottle, it just executing the
‫request it just executing the orders.
‫I you pressed the water bottle.
‫Water bottle is going down but it didn't care if you took it or your friend or any person took it.
‫So the ViewModel get the data and the view binding with the view model.
‫It took place here in order to view the The view will be displaying data instantaneously, instantaneously.
‫When the view model get data.
‫So view is displaying data after receiving the view model data.
‫Instantaneously.
‫Okay, So this is the introductory core lesson about the the patterns in next courses or next videos,
‫we are going to learn about every step, every pattern, step by step using a real Android app.
‫So we will work, as I promised you in all my videos and to make an app, an execution and practical
‫practice, practical example on every topic that we have made.
‫So thank you guys.
‫I hope you read us five stars on Udemy.
‫Subscribe to our YouTube channel.
‫Rate us five stars on Playstore Master Coding Application.