1 00:00:07,850 --> 00:00:12,165 Welcome back. Before you write any code for classes, 2 00:00:12,165 --> 00:00:14,400 there are a few questions that you should ask yourself. 3 00:00:14,400 --> 00:00:18,795 First is, what kind of data do you actually want to represent with your class? 4 00:00:18,795 --> 00:00:20,280 Is it a list of songs? 5 00:00:20,280 --> 00:00:21,600 Is it a list of students? 6 00:00:21,600 --> 00:00:23,475 A list of cars et cetera. 7 00:00:23,475 --> 00:00:24,750 Then, once you know that, 8 00:00:24,750 --> 00:00:26,070 then you should ask yourself, 9 00:00:26,070 --> 00:00:30,135 what does one particular instance represent of this class? 10 00:00:30,135 --> 00:00:31,590 So if it's a list of songs, 11 00:00:31,590 --> 00:00:34,650 one particular instance might represent a song. 12 00:00:34,650 --> 00:00:39,265 One particular instance of a list of students might represent one particular student. 13 00:00:39,265 --> 00:00:41,495 Then from there you should ask yourself, 14 00:00:41,495 --> 00:00:43,320 what are the instance variables? 15 00:00:43,320 --> 00:00:46,580 What's unique to every instance that I might have? 16 00:00:46,580 --> 00:00:48,305 So if it's a list of students, 17 00:00:48,305 --> 00:00:50,950 it might be something like a name, a student ID. 18 00:00:50,950 --> 00:00:52,630 If it's a list of songs, 19 00:00:52,630 --> 00:00:53,875 it might be the artist, 20 00:00:53,875 --> 00:00:56,810 the track name, the length, et cetera. 21 00:00:56,810 --> 00:00:59,560 Then after you know that you should also ask, 22 00:00:59,560 --> 00:01:01,765 what methods might you actually want? 23 00:01:01,765 --> 00:01:04,870 So, if every instance is a particular song, 24 00:01:04,870 --> 00:01:06,295 then you might have a method, 25 00:01:06,295 --> 00:01:11,125 for example, to paying an external API to get the lyrics for that song. 26 00:01:11,125 --> 00:01:14,245 If it's a student, you might want to have a method to, 27 00:01:14,245 --> 00:01:16,510 for example, send a message to that student. 28 00:01:16,510 --> 00:01:19,840 It depends again on what your instances represent. 29 00:01:19,840 --> 00:01:21,480 Then finally, you should ask yourself, 30 00:01:21,480 --> 00:01:25,460 what does the printed representation of an instance look like? 31 00:01:25,460 --> 00:01:27,710 So if I print out a particular song, 32 00:01:27,710 --> 00:01:30,260 then I might want to print out the track name, 33 00:01:30,260 --> 00:01:32,875 and then the album name, and maybe the length. 34 00:01:32,875 --> 00:01:35,720 You should have answers to all of these questions 35 00:01:35,720 --> 00:01:38,720 before you start writing code for classes. 36 00:01:38,720 --> 00:01:41,165 Now, it's important to know that designing 37 00:01:41,165 --> 00:01:43,910 classes is really more of an art than a science. 38 00:01:43,910 --> 00:01:47,210 It's very common to also refactor or 39 00:01:47,210 --> 00:01:51,770 rewrite classes in instance variables and methods even for experts. 40 00:01:51,770 --> 00:01:54,380 But all of this comes more with practice. 41 00:01:54,380 --> 00:01:57,420 That's all for now. Until next time.