“Time” is an inadequate name as it’s not clear whether it’s days, hours, minutes, seconds, milliseconds, microseconds, etc. You should call it “YellowDurationms”, etc.
Hi Denver Braughler - caught me! You're absolutely right: is using these self-describing names, you have to be consistent. Hope you liked the rest of the video!!
Sorry but I am a fan of comments, I had to say something. Sharing code, to someone who speaks/reads another language, comments are written with spaces, a lot easier to for a translator to convent without messing up the code. I am a fan of open source :) Actually I think there will be a time when comments are necessary. With a memory like mine, one should get used to putting some reminders why you did some thing. Or what it may effect.
Hi Tim - yeah, sometimes (!) comments are nessesary. But to me, this is greatly reduced by self-speaking variable- and function-names. Doing something like serial.print("Hello"); // prints hello to serial - is not helpful. In fact, important comments gets lost in the garble of comments :) Still need to watch ur LED strip video - but I see where you are going with comments :)
@@DetBuildsStuff Can I just say: "I am a lazy coder and find putting in comments a pain". But if I am doing code to publish as a teaching aid, I try to force my self to put as many comments as I can. When I started, I had no clue as to what "serial.print()" did. 😉 Now I know how to implement it into my own library.
@@Tims_Projects let's agree to disagree here :) A comment shoudn't be a replacement for knowing what a command does - to me, that's not the way to learn a language. Yeah, I've been told to do at least 50% of the text should be comments - but i found myself skipping over a lot of your code, looking for "man, where does this continue?". I guess we're the classical both ends of a spectrum - love the discussion, btw :)
@DetBuildsStuff I am glad you like the discussion, so do I. It's probably me, I also tend to take assumptions. I assume that Arduino is an Architecture where a lot of code is done behind the scenes (in the IDE) to make it easy for people to learn how to control microcontrollers. So the more help given the better. After learning the basics with Arduino people should move on to using some other IDE and writing code the proper way. If I was to publish my none-Arduino Code, there is very little comments. (don't know if links are allowed here, so I don't, in the past when I put a link in a post it gets binned) But if you look (care to find) my fork of "OwonB41T" it is a good example, more or less how you suggest it should look. (Tim's OWON Meter UI is my contribution) My contribution is not C but the same concept as our discussion. Like you say code names should refer to what it does, but when I see it in the Arduino IDE I assume the above, we are teaching something, what it all does. If there was a note about what you said in the video at each point, those new to coding would not have to keep rewinding the video.
cool
“Time” is an inadequate name as it’s not clear whether it’s days, hours, minutes, seconds, milliseconds, microseconds, etc. You should call it “YellowDurationms”, etc.
Hi Denver Braughler - caught me! You're absolutely right: is using these self-describing names, you have to be consistent. Hope you liked the rest of the video!!
Sorry but I am a fan of comments, I had to say something.
Sharing code, to someone who speaks/reads another language, comments are written with spaces, a lot easier to for a translator to convent without messing up the code.
I am a fan of open source :)
Actually I think there will be a time when comments are necessary.
With a memory like mine, one should get used to putting some reminders why you did some thing. Or what it may effect.
Hi Tim - yeah, sometimes (!) comments are nessesary. But to me, this is greatly reduced by self-speaking variable- and function-names.
Doing something like
serial.print("Hello"); // prints hello to serial
- is not helpful. In fact, important comments gets lost in the garble of comments :)
Still need to watch ur LED strip video - but I see where you are going with comments :)
@@DetBuildsStuff Can I just say: "I am a lazy coder and find putting in comments a pain".
But if I am doing code to publish as a teaching aid, I try to force my self to put as many comments as I can.
When I started, I had no clue as to what "serial.print()" did. 😉 Now I know how to implement it into my own library.
@@Tims_Projects let's agree to disagree here :)
A comment shoudn't be a replacement for knowing what a command does - to me, that's not the way to learn a language.
Yeah, I've been told to do at least 50% of the text should be comments - but i found myself skipping over a lot of your code, looking for "man, where does this continue?".
I guess we're the classical both ends of a spectrum - love the discussion, btw :)
@DetBuildsStuff I am glad you like the discussion, so do I.
It's probably me, I also tend to take assumptions.
I assume that Arduino is an Architecture where a lot of code is done behind the scenes (in the IDE) to make it easy for people to learn how to control microcontrollers. So the more help given the better.
After learning the basics with Arduino people should move on to using some other IDE and writing code the proper way.
If I was to publish my none-Arduino Code, there is very little comments.
(don't know if links are allowed here, so I don't, in the past when I put a link in a post it gets binned)
But if you look (care to find) my fork of "OwonB41T" it is a good example, more or less how you suggest it should look. (Tim's OWON Meter UI is my contribution) My contribution is not C but the same concept as our discussion.
Like you say code names should refer to what it does, but when I see it in the Arduino IDE I assume the above, we are teaching something, what it all does.
If there was a note about what you said in the video at each point, those new to coding would not have to keep rewinding the video.