Axe game: Explain naming

Hi there,

I’m working on the C++ Intro (Axe game) and I’m totally confused by some of the naming decision.

  1. Why would you call a square “axe”? That makes no sense to me at all

  2. In the video, some variables are being named in Python style (e.g. “circle_radius”). A proper tutorial would refer to correct C++ Syntax which would result in variables like “circleRadius”. Why has this not been done this way?

  3. The moving square jumps out of the window at the bottom because the program doesn’t into account the squares’ height. This should have been corrected immediately after realising what happened. Why didn’t this happen?

  4. Why would you not introduce the char type and also assign a variable to the window name? During the course, it’s being stated that hardcoded values are not a good way to go but the window name is just being ignored for no reason.

Please clarify, thank you

Hi Taran,

  1. The square is the graphical representation of the “Axe” in our game. Hence its name.

  2. In actuality, any programming language can use any naming style it wants. You can use camel case (the example you used) in Python as well. Is one more common than the other? Sure, but we aren’t tied down to using a specific way just because of the language we use.

  3. Keep in mind that his is a course for those new to C++ and game programming as a whole. I’m not Stephen, but I imagine this might not have been something of concern for the overall goal of the section. If you spotted it, great! It makes for a good challenge to figure out how to fix at that stage.

  4. You’re right, hardcoded values are not ideal. Though like any “rule” in programming they can be ignored depending on the situation. In this case, if we’re using a hardcoded string or char in one place that’s unlikely to change then it saves just that teeny bit of time to leave it hardcoded.

I hope this helps clarify or answer the questions you had. And definitely keep up this sort of critical thinking in your learning journey!

1 Like

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

Privacy & Terms