Welcome back. Before you write any code for classes,
there are a few questions that you should ask yourself.
First is, what kind of data do you actually want to represent with your class?
Is it a list of songs?
Is it a list of students?
A list of cars et cetera.
Then, once you know that,
then you should ask yourself,
what does one particular instance represent of this class?
So if it's a list of songs,
one particular instance might represent a song.
One particular instance of a list of students might represent one particular student.
Then from there you should ask yourself,
what are the instance variables?
What's unique to every instance that I might have?
So if it's a list of students,
it might be something like a name, a student ID.
If it's a list of songs,
it might be the artist,
the track name, the length, et cetera.
Then after you know that you should also ask,
what methods might you actually want?
So, if every instance is a particular song,
then you might have a method,
for example, to paying an external API to get the lyrics for that song.
If it's a student, you might want to have a method to,
for example, send a message to that student.
It depends again on what your instances represent.
Then finally, you should ask yourself,
what does the printed representation of an instance look like?
So if I print out a particular song,
then I might want to print out the track name,
and then the album name, and maybe the length.
You should have answers to all of these questions
before you start writing code for classes.
Now, it's important to know that designing
classes is really more of an art than a science.
It's very common to also refactor or
rewrite classes in instance variables and methods even for experts.
But all of this comes more with practice.
That's all for now. Until next time.