 All right, well hello welcome. This is level up your scientific coding. This is level three object-oriented programming So this webinar is brought to you by CSDMS the community surface dynamics modeling system I'm Mark Piper. I'm coming to you from Piper space. I'm a research software engineer at CSDMS And I'm Benjamin Keimfortz and I work as a postdoc at CSDMS All right, so what we hope to do today is to show you through arguments and through example That you as a busy geoscientist should be interested in learning more about object-oriented programming And how it can help improve your workflow and make your life easier That's right Mark and let's be fair it will take some time to get familiar with object-oriented programming But once you get it you will save a lot of time Totally I agree it took me a while myself Yeah, that's it. So the schedule for today is we will give you a very short overview of what object-oriented programming is We will give you the perspectives of a grad student, a postdoc researcher and a professor We will point you to a couple of resources we think might be interesting for you to learn even more about object-oriented programming And as with all the previous webinars we will give you an example of an object-oriented program and that one will be a bit more extensive than the ones we've done in the past Mark, what can you tell us about object-oriented programming? So what is object-oriented programming? You know if you do a Google search you'll come up with dozens of links, you know explaining object-oriented programming So I want to try to give a take that is maybe very high level and I'm trying to avoid a lot of the details of different languages So basically object-oriented programming is a technique for modeling a programming problem So just as we as geoscientists model physical processes, we can also model a programming problem So instead of writing for example a series of commands in a script or maybe even using functions for example in a script In object-oriented programming we start instead with a class So the idea of a class is that it's a program and it provides structure It has data that it can use and it has behaviors Things that you can do to act upon the data So when you want to use a class you create an instance of it. This is called an object A program then is a single object or a group of objects communicating with each other So this is kind of a high level example or a high level description of what object-oriented programming is We'll go into a little more detail. Benjamin is going to give a little bit more as he goes through his example later in the webinar So I've introduced two concepts that of class and that of object I've also introduced two terms Data and behaviors Now I'm being really generic there each language seems to have its own term for these In Python, which we'll use today. We have attributes. Those are the data and methods. Those are the behaviors of a class So just for a simple analogy you can think of a bike as a class So bikes have wheels, they have brakes, they have handlebars that you can use to steer them So these are attributes of a bike Bikes also have behaviors. You can move on a bike. You can steer a bike. You can break a bike So those are behaviors of a bike So these things could be thought of as a class Now an object would be, for example, my 1996 specialized thumb jumper FS So this is an instance of the class. It has all the things that the class has. It has brakes, it has rim brakes, for example It has wheels, it has a flat bar And I can do the same things. I can move, I can steer, I can brake on my bike So that's the difference between a class and an object Just a couple of things before I leave and go on to Benjamin So there's a lot we could talk about. We're just trying to distill as much as we can about object learning programming at a high level into this webinar Also object learning programming isn't necessarily better than any other style of programming However, it does tend to lead to better outcomes. I think the thought that you put into writing classes helps in the long run But that said, writing good classes is also a learned skill. I know that over the years I've written many really bad classes. I've gotten better over time Okay, so that's a really high-level overview of what object learning programming is Benjamin, you're up So let's talk about the perspectives and You know, as a graduate student you might think like object-oriented programming is maybe a bit too complex for me But like soon you will discover you will have big piles of data, you will have several scripts And if you're working on a complex problem, we are convinced actually object-oriented programming is something you should invest in And the same is true for post-docs And what I find especially interesting here is that object-oriented programming allows you to collaborate with different people And while you're working on your own class and your own methods and doing the behavior you want to have in your class You can distribute tasks and ask other people you're collaborating with to develop their own classes and to bring everything together afterwards So that's very neat All right. Oh, so research scientists Benjamin you snuck up on me. Sorry. All right, so From the perspective of a research scientist, this is kind of where I am right now. So object-oriented programming can We found this in our work at CSDMS. We use a lot of object-oriented code As we develop our cyber infrastructure at CSDMS Secondly, it's also easier for others maybe to jump in and collaborate with you and contribute to things that you're creating I know that I've had experience with this. I've been working with other people who write object-oriented code And I find it a little bit easier to find out to little places where I can get in and help work with the code All right, so these are perspectives from a research scientist next from a professor and this is From the idea of a professor not necessarily teaching professor but more as a professor as the leader of a group of students and postdocs So object-oriented program we could help you as a professor For example, you can train your students and postdocs to write object-oriented code Which again may help them be more productive you can encourage this It's also easier to manage your group and direct software projects if you're using object-oriented code So there are many reasons. These are a couple of reasons that we came up with Okay Next then so these are the why so you've given Examples or at least arguments for why you as a grad student postdoc research scientist or professor Would like to use object-oriented programming next is the where so I want we you know in each of our webinars we wanted to try to you know scrape the internet and Try to find useful online resources for the topics that we're just covering so I wanted to do this for object-oriented programming And you know if you do a Google search on object-oriented programming again, there's dozens of links I wasn't super happy with a lot of them, but these are the ones I have found and I think I can argue for why they are useful So first of all the Java tutorials, you know, so Java is still the language is used most often I believe in computer science courses in order to teach programming and especially object-oriented programming and Tutorials are still good. I know that I went through them when I was learning object-oriented programming many years ago So I so I think they're still useful Say for me mark. Yeah, all right So next Wikipedia and again I feel a little embarrassed about listing Wikipedia the Wikipedia entry for object-oriented programming as a reference, but I did so because Wikipedia, you know kind of uses the wisdom of the crowds approach because it's made by many people and so it kind of smooths out many of the language specific pieces of information about object-oriented programming and gives kind of a good high level overview of what it is Plus, you know Wikipedia always has really good links at the bottom of the page and you can explore those links to get more information So I'm not too embarrassed. I think it's a good thing. It's a good resource It's fine Yeah, all right. Thanks Next is a Medium post actually this is by a guy who's kind of known in software development circles The tone is a little bit arrogant that was a little bit off-putting But if you can get past that I think that his little essay on a simple explanation of object-oriented programming is pretty cool I think I learned something from it. I like the way it was explained And finally a YouTube video so this last one I Enjoyed this it was a clever cute description of object-oriented programming and it's only seven minutes long So, you know, if you don't like it, it's only seven minutes that are gone from your life, but I enjoyed it I recommend it so they play that's right now mark It's seven minutes. I know I worry that we're pressed for time that can be a good add-on for people after the webinar Okay, so that's it for Some resources next Benjamin. Yeah, so let's try to look To an example here of object-oriented programming and I'm going to switch slides here So before we dive into it, let's look at this piece of Python code having five lines And let's try to break it down in some core components and as Mark said like any program any code You're writing you have data components and you have actions going on and in this case you have the value of four Being assigned to X you have 124 which are used for comparison and when you have a number of characters saying hello worlds Now you might wonder why I didn't call on the plus one in red as a data component And the reason why is because plus one is actually incrementing something. It's an action going on so you see the red Values and characters indicating data and in the same time you have actions going on on every line You have an assignment. You have a loop an increment a conditional test and in the end you print something out so try to keep that in mind while we run through the example and It's important to realize that this data and action structures are actually present in any programming technique You're familiar to so it all starts at the very low And at the low level of abstractions where you will just enter values in your command line And that's all fine But at one point you want to store those values in variables and you want to organize your codes in a script so that you can Do slightly more complex things Then at one point everything is getting messy if you're just scripting out every line of codes because you want to reuse Certain lines, so you want to use functions to go to a higher level of sophistication and For your data you want to organize or group your information in data structures like lists or dictionaries, etc, etc now with this increasing Sophistication methods that the increasing sophistication you can also tackle more complex problems But at one point you will see that actually the structures which are there are not sufficient to tackle really complex problems And that's where we want to talk about today So we're going to introduce object-oriented programming here as a way to structure your code even better and make it more robust in general so last weeks I was thinking of a good example to show you guys how we could do object-oriented programming and At one point I was realizing we were actually held by the situation where most of you are sitting at home like we are and That's of course because of this coronavirus going on and mark to obviously so and I came across this very nice article in the Washington Post which is Explaining why outbreaks like coronavirus spread exponentially and more importantly what governments can do to actually flatten the curve So and they came up with a couple of very neat graphics showing The society where the dots you see in the square or representing people red dots are representing Infected people and green dots are representing healthy people and throughout the simulation You see how through interactions between the dots your society is getting infected And more importantly they also evaluated what the impact of social isolation was or social distancing in general and implementing a lockdown and I did well this this is a great example to show you guys object-oriented programming and what I didn't do was writing a program from scratch So I just googled like Mark did and I came across this very neat program of PhD Paul van Gent is working in the Netherlands in the University of Delft and he actually translated the simulations of the Washington Post in in a sequence of Python functions and and and methods using even more realistic values to simulate the spread of the coronavirus and Using his skirt you can create simulations and I will I will share with you the code on our github folder leveler At the end of the webinar. So what you can do is for example simulate a Baseline simulation where you have two thousand people sitting in a square They will interact and in this simulation. You don't have any measure. So there's no lockdown. There's no social isolation And what you see is that infection rate is bumping up quite quick everyone is getting infected and The health care capacity which is a straight red line in the bottom is easily exceeded. So that's not good So let's try to come up with a solution here. So I took the code of Paul van Gent But I restructured it a bit so that it's more reflecting this object-oriented programming behavior and By the end of the webinar, I will I will give you the code and it's up to you to play with Lockdown and social isolation to see how things work out But before we do so, let's think of this problem So we have corona virus and we want to make a program out of it. That's the goal So you start by creating a domain. Okay, that's easy And then the first thing you want to do is you want to populate your domain So that means that you need a variable saying what your population size would be So you need a viable population size. The second thing is you want to know who is sick the red dots and it's healthy So you need to know that health status of your people in the domain. That's the second variable then as you know, people are contagious if you are infected and To know the range in which people are contagious. So how close you can get to someone who is infected You need to come up with a variable saying the range or the radius Of this infection bubble. So we need yet another variable which is infection range Then obviously it's not only a range, but once you're in the range You have a certain chance of being infected because not everyone who is coming closer to the infected person will actually be infected So that's Still something else you have to consider an infection chance People are also moving around so you want to give them a vector a velocity or at least a mean speed yet another variable A mean speed and then unfortunately If you're infected, then that's a problem if this corona virus You can also die from it. So you want to know what the mortality is of your virus yet another variable Luckily most people recover, but that takes a while. So you have to define a variable saying what the recovery period is So there you go another variable recovery duration and then Things are getting even more complex because if you simulate a society People who are elder the elderly Are more susceptible Of dying from coronavirus So you want to stratify your population and you can do that by at least giving a mean age of your population So there you go yet another variable. That's a lot of variables Benjamin. How are you going to organize all these? Exactly mark. That's that's the question Because you know, you have these fires going home. You have your population That's already a couple of variables, but then there's also like our society. You can do something as a society You can go in look down so I would say that that's another yet another variable you have to take into account and an action associated with it so We end up with several variables and we have to structure them in one way or another because For the entire program. These are all of them. So You see that it's it's it's getting like very very busy out there And with all these variables you have actions going on For example, for the population size You want to create a population obviously or let's pick another one You have the mean age of your population and you want to create a stratified population with that following a Gaussian distribution or anything else so That's a lot of variables and functions associated to those variables and the problem is actually that some of these functions or actions Are infecting variables at the same time. So you can have infection and you can have Speed of your population. So your population will move and be infected in the same time And how are you going to structure all of that? That's a lot of information going on Luckily we can try to group the Information we see here in different what I call now Groupings So if you take a closer look what you see is that you can actually divide these variables Into variables which are associated with our virus with our population with our society So for virus that's a range chance duration and range for example And it's even better because in these groups you can also connect the actions which are Acting on the variables which we classified in the group. So For example, in fact is something which is associated to the virus Or Activate look down is something which is associated to the society And what we did is not just structuring your code in groupings What I actually did here was what mark already referred to in the beginning. I was creating classes so what I did is actually coming up with three classes a piece of Data properties or attributes depending on the language you're working in and associated functions methods in object-oriented programming terminology I like how you're modeling a Programming problem that is actually a model Yeah, exactly So today we want to talk about object-oriented programming We have our class and in the class we have data and actions feeding in it again like in any programming technique But for classes we will refer to data as Properties or attributes and functions will be referred to as methods And in this case virus would be our class I'm going to illustrate in a second and you can make instances of this class For example, you have the SARS-CoV-2 virus, which is then an object or an instance of our class virus And then we have Ebola which is modern asius virus, which could also be an object of our class virus So, um I will try to To show how you can build a class from from scratch with you guys So and what we will do is we will define a class Virus we will give it three properties name infection range and an infection chance and we will Define two methods so And we will create two objects or instances of this virus class So let's go ahead Now i'm switching screens. That's always a bit tricky. Okay. There we go. So I already set up a notebook for you And I will make this available on the github after the webinar obviously so let's start by Creating a class and you can just do that by writing class and then the name of your class and Benjamin, could you bump up the font size a little bit on that? Oh, yeah, sure Better mark. Yeah, cool. Thanks. My eyes are getting old, you know No, no, good. That is seiza so we created our clause and The first thing we will do is implement this method document itself So we will say, okay, let's create a method and to define a method in a clause You just use the terminology you would use otherwise for creating a function. So you say Def document self parentheses Column And we will do something in this method. So what we will do is we will document. So we will just say print out the name. So let's say The name of the virus is Ups And then we will add Salaf and I will come back to that salaf dot name Now this keyword self is critical here So for every method you will define in a clause, you will actually operate your methods on an object So for every clause, you can create multiple objects like mike his bike mark his bike So he had I think it's a mountain bike mark your jumper So you could have also a race bike from the same clause So you have you have to feed you have to feed the information of the object to the clause So that's why in any function or method in a clause you have to define the object you're working on So by definition Every method and that's really important. Whatever you do every method or function in python In a clause we'll start with the object Appointed to the object if you want okay So we have printed the name of the virus is and now well, we will print one more thing. We will print the infection Chance is self dot infection Chats I will make it a bit smaller mark. Yeah, it's okay. You can put it on there Okay, you still read this. Yeah, I can so well. Oh, yeah, that's good. Yeah, okay so, um Okay, and I run the cell as is so I created the clause and now you might wonder where are the properties of this clause And that's a good question and we will worry about them later. So what we will do first is Let's try to make an object of the virus clause. So, um, I said we have virus one virus one And this is where we are going to create properties virus one dot name And we will say virus one dot name equals silly name virus one And in our slides, we also asked to give the infection raise an infection chance. So we will make other properties virus one dot infection range This we will give you the random number and virus one infection chance Equals Let's say one percent. So these are properties, but For now we have still not created an object of this virus clause So obviously before we start defining properties, we should actually create objects of the clause virus We should like let's try to know that we actually want to make an object of the virus clause So we should start with saying v one equals virus So that's how you create an instant of the clause virus And you should also add parentheses For now you can just like Enter nothing And let's see if this is going to work So we run the cell And the cell runs So we have a couple of properties. We created a virus object. Now, let's see if we can actually Call that matter to be defined can we document what's in the virus? So let's see. So we will say v one dot document self parentheses and we will run the code So, oh, yeah, that's something I should have adjusted. So I'm trying to print out a floating number here. So I should convert it to a string I will rerun the block All right And the output of our Function or method of the clause is as we expected. So we will print out the name and we will print out the infection chance So far so good. So Let's now make the second object of the same clause as we asked in our slides So let's make a second object The v two equals virus. This is where we're going to create the object v two name is source code To We will increase the infection range a bit And we will say that infection chance is also slightly higher So we now have two objects of the clause virus And we printed out the information of the first one. Now, let's print out the information of the second All right, so far so good now As you remember, we have the data Which is for example 0.2 And we have the actions and I said that we want to bring everything together And that's in object-oriented languages called encapsulation. So we want to have your properties or your attributes together with your methods And now you can say wait a minute. You just defined your properties right here, which is outside the clause Which is not really what we want and I will show you why this is potentially dangerous and why it's not recommended to do it that way So imagine so as a non-native speaker, sometimes I'm confused and I would not write infection chance, but I would write infection change Okay, and I would run this cell and everything is fine So there's not an error. We just added an attribute here called infection change but if we don't try to call the function We will get an attribute error saying virus object has no attribute infection chance And that is because we didn't define a chance. We defined the change so To take care of that what we're going to do is we're going to Initialize the properties within the clause itself so and to do sewer We will create a method which is typical for most of the classes you see out there and it's going to be called Initialize in it and what we do actually by writing def double underscore in it double underscore And is we're going to override the default constructor. So every clause as by default the constructor Which is assigning values to the properties of your clause and we're going to override it with our given values And as with any method in a clause always start with south That's not any different for your constructor So we'll write south and then we will Insert as arguments at the property value. So we will insert the name We will insert the infection range And we will insert the infection chance There you go Now to assign those values to the properties of the clause what you should do is write south dot name And we will assign the value of our input arguments, which is name And then we will do the same for the other three input arguments here. Okay, so we have infection range And infection chance now As you notice this this might look a bit weird if you're not familiar to it It's because we have the same names popping up if you would prefer it. You can also do input name Because this is just pointing to the arguments of the method But by convention what you typically see in constructors is that you give the input arguments the same names as The names of the of the properties of your clause It's python It's phytonic. It's not so in java No, I mean, yeah, but I mean it's very phytonic to do this way as well Yeah, so if you if you want to feel phytonic. Well, that's the way you should do it apparently so Okay, so we adjusted our clause. We run our cell Now you will see that if I try to run this code So if I tried it's going to break and the reason why is that we overwrote the default constructors So we don't have a virus with an empty constructor anymore. So we we should feed in the values here now. So Okay, let me let me comment out this part and Let's create a virus one as virus one, that's the name and then we have 0.2 As the range and 0.01 as infection chance. Okay And then for virus two we will do the same 0.02 Okay, so now we created two objects of our virus clause exactly the same as before but we don't risk of Using wrong names. So if you now call the functions What you see is that everything is working fine again So let's have a look at our slides now for a second. So I created the clause virus with the data and the methods associated to the data so far so good But as you might have noticed I also had mortality rates, which is making this coronavirus lethal and I didn't implement it and there's a good reason for that because You might know or you might not know but there's also viruses which are not so harmful for us which we actually need to survive and We also want to create a structure in our programming language Where we can define any kind of virus with some common properties and some properties which are specific to one kind of virus And the corona virus is obviously deadly So we want to make a separate clause of it which is having the same properties as the virus clause But with some additional pieces of information And to do that we will Inherit from our super clause virus and make a sub clause called lethal virus and The the beauty here is that you can just make a new clause and what you would do in sequential programming is You would have to redo everything retype all your methods and Your properties and then add the only little bit which is changing So the only thing which is changing here is that we will define a new function Document mortality and recover or die and that we will have this mortality rate property But all the rest is similar to the super clause properties and methods so What we can do in python is inherit from a super clause and make a sub clause So let's let's try to do that in our notebook So we will add cell And say Okay Source covid 2 is clearly deadly. So I will comment it out over here And we will make a new clause And to Define a clause which is inheriting from a super clause just use the same terminology And this one we will say it's called lethal virus And lethal virus is inheriting from our other virus clause And to indicate this we can just type virus with a capital Referring to this other clause Maybe as a side note in previous releases of python In python 2 Any clause would inherit from A python structure called objects. So you might see Main clauses also written like this So that's how you would write it in in python version 2 But for python version 3 you don't have to do it. You only write Oh I think you want to have you want to inherit from object and in virus Sorry, no you don't Yeah, you don't have yeah in virus. Yeah in virus you you inherit from object. Yeah Yeah, in python 2. Yeah, and and this is Python specific. So don't don't worry about too much. Don't worry. Don't worry about it too much So we will make the lethal virus And um, let's see. So we will create we will use the same constructor As we had with virus. So which is setting the values to our properties And you might wonder why i'm not copying this because there's ways to actually do it more elegant Um and more can tell you about it, but it's like it's already like high level So that's not what we're going to cover today. The only thing we are going to do is to add a property called mortality Rate And we will Add the mortality rate to the mortality rate property right And then something else we will do is we will define a function to document mortality It's similar to the document salaf. So I will just copy it from here And it's called document more And it will print out the mortality of the virus so the mortality Is And then we will print out the mortality rate Okay So we made our sub clause which is inheriting from virus now. Let's see how it looks like. So let's try to create an object from this um sub clause so we will make virus to SARS-CoV-2 and we need an additional input argument We need a mortality rate. Let's say One percent so one percent of the people who are infected will die from it Um So virus We will make an object of the lethal virus clause All right, there we go. So we made our v2 little virus And now let's see whether we can actually access this Method which I defined only in the sub clause. So let's say v2 and document mortality v2 document mortality Let's see what it does And it does print out mortality And now something very neat is we can also say v2 don't document not the mortality but document self And as you see we didn't repeat document self as a method in the lethal virus clause It's still in the in in the supper clause So let's see if it works And yes, it does work So The same goes like still for virus one where we didn't change anything. So we we can still document the information of virus one That is working Okay, but virus one is not an object of this sub clause Lethal virus so we will not be able to Document mortality because the virus one we didn't define that as a property So indeed it will give you an attribute error Okay So, um, I will share with you guys this notebook on how to make a clause and how to make properties and we we covered Constructors default constructors and how to overwrite it And we also covered how you can inherit from a supper clause and make a sub clause with specific properties so And that's the example I wanted to cover with you guys and now I will quickly show you how that apply Um to that program. I told you about before so we will make that available in our github folder And we're not going to implement anything right now But I just wanted to show you that indeed as we said we Have our run model dot python script where we actually executing the model We have a virus with the properties. We just defined There is some additional mark. Do you see my screen or yeah? Yeah, I can see it, but just it's really small right now. That's all. Oh, yeah, good to know I have a small laptop screen though, of course, but No, no, no good that you say so Well, thank you We see the virus clause with the properties as we defined it you will see that there's other things going on So there's documentation on what the properties are you can read all of that We will assign values to our properties This is our constructor. There's a method called infect to actually infect people Then there's virus lethal, which is inheriting from the virus clause doing exactly what we said before with some additional methods We have our society where we define whether or not we have load downs we have a population where we define a population number and the location of the population and then we have a simulation script, which is not a clause, but which just gathers the Functions we need to actually make the operations going on And I leave this up to you guys, but you can run the model You will see how for example implementing a look down will influence this speak. So you might remember from our previous video that Infection is growing exponentially and was then completely out of control So and in this simulation what I did was implementing a look down so that people don't move anymore So that you won't exceed this health care capacity actually and that people have time to recover in time before actually dying so and you can play with all the values listed in these scripts and you can try to change them and And you can use it as a tool maybe to to think about what's going on out there in the world So that's the example I wanted to show you see that people already start to recover Infection rate is going down at one point you will release the look down. That's how it's implemented in the code So people will start moving again Until you need another look down etc. etc until The virus is spreading out. So people are starting to move again. You will see an increase in infection now Look down will be in place and it will decrease again So that's basically the example I wanted to share with you. So let's go back to our slides Benjamin that was epic I like how you took a problem, you know and Just you know use variables to describe it and then organize those variables and you'll model the problem as a series of classes. That was very cool Thank you mark that All right, so can you go to the next slide? Yes All right, so that's it. So thanks everyone for watching our webinar As a reminder, you'll get a reminder email from lin when the webinar recording is up on our website Again, the repository where we have all the code and slides for all of our webinars is up on github github.com Slash csdms slash level up So this is the last in our series You know, I think Benjamin and I may come back and do some more because it's been kind of fun But if you have any feedback for us, you know, feel free to email us or if you'd like Contact us through the csdms help desk All right, so Right now if you have any questions for us You can unmute your mics. You can ask us directly Over the you know over the air or if you'd like you can use the chat window as well But other than that. Hey, thanks. That was fun. Yeah. Thanks for watching you all. Yeah I see that there's a question coming in The one little thing while we're waiting as well, Benjamin is kind of cool It was very csdms of you to you know, take someone else's open source code and remix it for your own purposes. That was very cool Yeah, yeah, all all kudos to paul mangan for coming up with this great show So that's actually like maybe a little piece of advice to to grad students as well If you if you want to tackle a problem always go on the internet first and see if other people already did it before you So don't waste your time in reinventing the water the hot water And again, we tried to keep things kind of high level, you know, Benjamin We use python and that's kind of the language we use at csdms You know, but benjamin tried to keep things even simple in python as well So there's more advanced things we could do in python and an arbitrary programming But we chose to try to keep things high level in this webinar That's right Oh, so there's a question about the dot salaf in the Constructor so the init file so the init file is a constructor And I don't know exactly what you mean, but if you mean that uh, why is salaf there as an input argument? Well, any function or definition in python takes salafs as the first input argument That's by definition. That's the convention There are other programming languages where in a constructor you would not need to feed in the salaf Statement but in python you always have to and I think that's actually pretty good So that's quite clear if you make a method in in python always feed the salaf statement to it as a first argument Right. So the salaf statement has to go as the first argument argument list You also have to use self inside the constructor in order to make sure that python knows That you're creating attributes for a class. So if you do self dot Uh like uh infection rate for example if you just had uh infection range Python wouldn't know that that's actually an attribute of the virus class even if it's inside the code That's why you need to self uh identifier before it That's right That's yeah, that's a little bit of python, but that's also as benjamin mentioned. That's also something that is used Pretty commonly in other object-oriented programming languages Yeah, don't forget that any method you define in the class is operating on an object of that class So and given that you can have many objects you want to let python know on which objects you're actually doing your operation So that's why you always have to introduce self in any method you're using in classes Okay, mark. I think that's it. I think that's it. Okay. Well, thanks everyone See you later. Bye. See you. Bye. Bye. Thanks for watching