‫Let's talk about another developer fundamental and this one is commenting your code.
‫Up until now, you may have seen me comment, add comments to our scripts.
‫For example, right here I added a comment of Booleans and this tells the Python interpreter, Hey,
‫this is a comment, don't run this.
‫It's just for me.
‫You can just ignore it and skip over to line two.
‫And you saw that?
‫I simply did that in Python with the pound sign.
‫As soon as Python sees a pound sign, it adds a comment and you can do that after a line as well.
‫I can say this assigns to a variable.
‫And although this may look like two lines, it's actually just the ward rapping that's happening.
‫And you can see that the interpreter just completely ignores these comments.
‫Now, commenting sounds very, very simple, but it's an important concept.
‫And if you want to be a good programmer in all languages, we have commenting.
‫But there's good ways and bad ways of commenting.
‫And this is something that comes with practice.
‫But here are some key guidelines.
‫When you're commenting your code, the idea is that you're adding valuable comments.
‫That is, if I add a comment here that says, Hey, this is a sign name variable, a value of Andre
‫string, a comment like this.
‫Is not really good.
‫Why is that?
‫Well, because your code should be self explanatory, right?
‫The idea is for us to write code that is easy to read, easy to understand.
‫It's not trying to be clever.
‫Instead, it should read like English.
‫And any python programmer would know that here we're just simply adding Andre as a value of name.
‫We're assigning a variable and adding a comment like this that's self explanatory.
‫Just adds clutter to your code.
‫So there's a trade off here.
‫It's good to comment your code for let's say if you're working on teams and other developers come and
‫they want to understand your code.
‫But you have to remember this principle of code being easy to read.
‫The only time you want to add comments to your code is.
‫Well, when something really, really important is happening, where it might be a little complex,
‫you first decide, Hey, is this code written in a way that makes sense?
‫For example, if this was variable a.
‫And this was variable B.
‫Well, this might be really hard for somebody to understand.
‫So you might say that this is is flag.
‫But before you add that comment, you want to say to yourself, Hmm, maybe my code is hard to read.
‫Maybe I should just change the variable to is cool to make it more understandable.
‫Now this is something that you improve upon more and more, and you do want to use comments as an extra
‫tool to make your code understandable.
‫Maybe you write code that six months from now you want to go back to understand what you did.
‫But remember, more comments doesn't necessarily mean better code.
‫You want to be concise and keeping things simple while adding comments only when necessary to help others
‫understand your code, not trying to make your unreadable code more readable.
‫We'll explore this topic and give you advice on it throughout the course.
‫But remember this key developer fundamental because you're going to need it throughout your career.
‫By the way, this article over here has some really important points that I think you'll really benefit
‫from, especially in the commenting best practices.
‫You can read some of the do's and don'ts and what some of the top programmers do when commenting.
‫I know it sounds silly, but it is an important concept that most courses overlook, so I highly recommend
‫you read over this.
‫I'll link to it in the resources and I'll see you in the next video.