All right, guys, welcome back.
So I hope that you restarted Visual Studio after our last exercise.
And if you did, then when you go back up to Windows Machine Current, then you should see all of the
different debugging options available.
Once again, if you're not having these issues, then you have nothing to worry about.
So from now I'm just going to switch this over to the Android emulator and whenever I hit play it will
launch my amulet and then we can go ahead and use that.
Now, in this exercise, we're going to be setting up our model.
So remember that our model is really just an outline or it's literally a model of what we intend to
store, or the key data points with which we intend to interact in our app.
That principle is basically universal in programming.
Almost any framework that you're using, we're going to refer to the data, the elements that you're
storing as data, as models, right?
So we can just go ahead and create a new class.
And I did say that I'm doing a simple car listing app, you know, just to say, Oh, these are the
cars, so we'll just go ahead and see car.
That is the model.
Now I'm going to simplify this because I really want us to focus more on getting in to MIUI development.
At this point.
I hope you're already like an intermediate developer and you already know best practices in terms of
having relational relational design for your database and so on.
But like I said, I'm going to simplify this.
So car, we're going to start off with our car model having an ID property, right?
Naming convention.
This could easily just be ID.
You could also name a car I.D..
Actually, I tend to prefer just naming it ID because I'm already in the car.
So obviously it is relative to the car.
And then I'm going to have MC and I'm going to make this one a string property.
Now here's where the best practice I'm kind of shunting best practice right now in terms of relational
database design, because typically you would want to have this as an external table.
The MC would be the brand of the car, right?
Nissan, Toyota, etc. You wouldn't necessarily want the user to be able to type that in, but at the
same time, there may be a mix that you don't know.
So once again, that's just a design decision based on the type of up that you're building.
The other two that I'm going to go with our model and Vin, both of which will be String.
And Vin is actually an acronym shard for vehicle identification number.
So VIN typically would refer to that unique idea that most cars have aftermarket string, even though
it says number after make it string because sometimes it's alphanumeric, right?
So let's just keep it kosher and just call it string.
Vin.
So this is my model for the car and that's it.
So once again, we have the namespace models and then we have our model car.
So as many data points as you would need to store our data, data related items that you need to might
load, you would put each one of them inside of this model's folder.
Right?
So let's see per adventure that our car listing also had Car Mart.
So what if our app was supposed to list the cars for multiple car marts?
So I could easily just create another class, call it car marts, and then what would it have?
It would have its own idea.
So it had the idea property and maybe it would have a list of cars.
So a list of car objects.
Forgive the typos and call this one cars.
All right.
So, of course, we wouldn't want the two classes in the same file, so we would want to move this one
to its own.
Type artists on file and Visual Studio will do that for us.
Nice and clean.
So those are things that you want to consider.
That's not really a requirement.
I'm just saying that when you're talking about data, you want to create a class per data point that
are not data point, but per entity that you intend to store.
And then the properties in the class or in the entity would be the data points for that entity.
So once again, I'm just going to keep it simple.
We're just dealing with cars.
So when we come back, we'll look at setting up the view model and we'll get to understand the model
view view model pattern a bit more.