I am an experienced programmer so I should probably skip this section of the class, but I figured what the heck I might pick up something new in Unity or something.
Anyway maybe it is because I am experienced that this jumped out at me, but I wanted to talk about it a moment.
In the video, you start with one form of the Input.GetKeyDown
method that takes a string as the key name argument. You then do your little mini challenge and suddenly switch to a second form of the method (an overloaded version) that takes a KeyCode
enum as the key argument.
I am not sure what bothers me more; the fact that such a switch could potentially be very confusing to someone without experience, or the fact that the lack of posts here shows that it wasn’t confusing to anyone I think it is the latter though because it makes me think many people don’t understand enough to actually be confused. Programming is a very exacting science, and it is so very important to understand why things work the way they work. I think starting with the string argument form of the method and then suddenly switching to the KeyCode argument version of the method is both bad form and potentially confusing at this point, and more so potentially steers inexperienced programmers down a bad path.
The reason I say that is because at this time you have not explained how the same method can potentially take different parameters. While I agree it is too early for that, the problem is this lesson sort of leaves the impression with people that maybe the type of a parameter isn’t important when it very much is. This potentially sets people up with a bad understanding of fundamentals which can grow like a rot. One of the single most common mistakes made by new programmers is because of a lack of understanding of types.
This lesson would be much better of sticking with one form of the method or the other and not switching between them. Stick with Input.GetKeyCode('up')
instead so that people see the same type (string) being used. Or start with the Keycode version and stick with that. I don’t know Unity itself well enough to know if one form is preferred over another or what those reason might be, but just pick one and stick with it.
Anyway this isn’t a hate post or a rant. I hope I came across as I intended which was to simply give feedback on how this can be better, especially for teaching new programmers.
EDIT: This gets even more evil in the IF lesson where you stumble around trying to get Return working (I know you weren’t really stumbling, it was an example) and you swap back and forth like the parameter isn’t important. Please, this is really bad