1 00:00:00,440 --> 00:00:00,750 All right. 2 00:00:00,770 --> 00:00:06,260 Welcome to the movie and chapter in a jetpack compose, because we're going to use movie M in this chapter, 3 00:00:06,260 --> 00:00:11,180 we're going to rebuild our news app so that it uses this architecture. 4 00:00:11,420 --> 00:00:16,040 So if you've been developing with Android, some L and have used to movie architecture. 5 00:00:16,040 --> 00:00:22,160 So the model view view model architecture, which is the full meaning of medium, you might have been 6 00:00:22,160 --> 00:00:26,360 wondering why the title is MBAM in jetpack compose. 7 00:00:26,630 --> 00:00:28,880 Is it different when using XML? 8 00:00:28,910 --> 00:00:30,140 Well, let's find out. 9 00:00:30,830 --> 00:00:35,900 So let's understand the three parts of M VM, even though it's four letters. 10 00:00:36,170 --> 00:00:43,730 So the M stands with the first M stands for Model, which is the business and data logic of our application. 11 00:00:44,030 --> 00:00:46,220 This includes two classes representing the data. 12 00:00:46,220 --> 00:00:50,180 Source can be either remote, local or it can either. 13 00:00:50,540 --> 00:00:51,440 It can also be both. 14 00:00:51,920 --> 00:00:59,990 Then we have the view, which is the composable UI, which observes the data from the View model and 15 00:00:59,990 --> 00:01:02,450 will always be notified of changes. 16 00:01:03,440 --> 00:01:08,390 And then we have the view model itself, which is the data holder. 17 00:01:08,750 --> 00:01:14,630 This is a class that holds the data for the user interface and should omit them for every changes that 18 00:01:14,630 --> 00:01:15,140 occur. 19 00:01:17,190 --> 00:01:23,820 So the view model class is a very important part of this architecture and prepares data for the user 20 00:01:23,820 --> 00:01:31,590 interface to observe this data needs to be exposed and in compose we can use state flow as the data 21 00:01:31,590 --> 00:01:32,010 holder. 22 00:01:33,000 --> 00:01:36,450 So let's see how data flows from one part to another. 23 00:01:37,080 --> 00:01:43,080 The data source, which is an end point in our case, will send the response to the repository. 24 00:01:43,650 --> 00:01:48,570 The repository will send the data to the view model in the view model. 25 00:01:48,570 --> 00:01:56,640 State Flow will hold the data and amid changes to the UI, which is the view right and took while the 26 00:01:56,640 --> 00:02:01,020 UI subscribes to it and updates its element when changes occur. 27 00:02:01,470 --> 00:02:09,979 This way, classes have dedicated responsibilities easier to modify without breaking connected classes, 28 00:02:09,990 --> 00:02:11,820 and also it's easier to test. 29 00:02:12,480 --> 00:02:19,650 So we will introduce this architecture to our new app to improve the structure of our application and 30 00:02:19,650 --> 00:02:24,180 make sure that our app just uses this very clean architecture. 31 00:02:24,990 --> 00:02:26,970 OK, so let's get started.