LevelGrid.cs method naming

Hello! Great course btw!~But I was thinking if it would be better to name the methods accordingly to what they do…
like AddUnitAtGridPosition to AddUnitAtGridObject and so on,

I actually recommend the following when it comes to method naming:
First, if you’re following a course, it’s a good idea to start with the name the instructor uses, at least until you know that the method is going to work for you. That makes it somewhat easier for your friendly neighborhood Teaching Assistant if something does go wrong (There’s a lot of code in the 10 courses I TA, so I do tend to refer to the instructors code a lot!).

Now once you’re very comfortable with the code, if you have a better name than the instructor came up with, I encourage you to use it, following this proviso:
The method should have a name that, without additional comment, clearly denotes what this method does in a way that if you came back to the code in a year, you would be able to understand exactly what you are doing in this script.

It looks like you’ve chosen some good names there, by my standard rules. Good job!

1 Like

I change names a lot, but usually only when I’m done with the course… It just helps me make sure I don’t accidentally screw myself over with bad names somewhere down the line :slight_smile:

1 Like

Thank you Brian for the clarification!!
I’ll be naming the methods as the instructor intended and will take notes(as comments lol)
if I do feel the method name needs changing accordingly to their nature.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms