Hey, welcome back.
In this video, we will start coding in an dot p file, so please create a python file in the project
root directory.
Name it.
Main dot p y, main dot P, and start writing the classes that we planned in the previous video.
So that is a user class, a hotel class and a reservation ticket class.
So class user.
Let's write pass for now.
Class hotel.
Pass and class.
Reservation ticket pass.
Then we think about what methods each of these classes should have.
So let's start with the user class.
The user can see a list of hotels, right?
So maybe we would have a method such as Vue hotels.
Right.
Which could be empty for now.
And then what else do we have about the user?
Let's split this to the right.
Like that, the user can book a hotel.
So now the question is, should this class have a book method or should the book method be part of the
hotel class?
The short answer is the book method is part of the hotel class.
Why?
Well, because the book method applies to the hotel class.
So when you think about methods, try to think in the sense of book.
What?
And the answer is book a hotel.
It doesn't make sense to say book.
What a user.
We don't book a user, right?
So this method is part of the hotel, not part of the user.
The same goes now for reservation ticket.
User can get a reservation ticket.
Well, we would say define generate a reservation ticket.
Right.
Pass here for now.
Pass there.
So we generate what?
A reservation ticket.
This makes more sense.
And that brings us to The View Hotel's methods.
Does this method make sense for this user class?
Anyway, So we said that book, a hotel generates a reservation ticket.
But does it make sense that say, view hotels user?
Hmm.
It doesn't make sense, actually.
So the question here is perhaps we should remove this method from this class.
And then the next question is, since this class doesn't have any methods, should there be a class
user or should we remove this also, the answer is we should remove that class since we don't have any
methods to associate to that class.
Of course, this is not the ultimate final decision because later on perhaps you get some more requirements
for a new feature, and for that feature you might have to add a user class.
But for now, given these requirements, we don't need a user class.
So these are the final classes we have in the planning phase.
So with that in mind, we can go to the next video and keep going with the next step.
I'll tell you what the next step is.
I'll see you in the next video.