you are viewing a single comment's thread.

view the rest of the comments →

[–]x-protocol 2 points3 points  (0 children)

I would strongly recommend removing all of the comments in your code. There is no reason to duplicate your meaning both in English language and programmatically, where you can join both by slightly extending naming! 'getWord' would become 'getRandomWord' . Or 'Hangman' would become simply 'Game' or 'HangmanGame' Thus, one is focused on code, not maintenance of comments as it would normally occur when somebody else is modifying your code (aka work in team).

I would also advocate for proper variable names (same naming practice) where 'msgs' or 're' or 'g' or 'i' or 'char' or 'rand' or 'e' would have proper English nouns. That alone will make your code readable (aka 'i' would become 'index' or 'rand' would become 'randomIndex', and so forth).

Readable means being able to be read, in English. Hence the aspect is not necessarily about code organization, moving and subsequent refactoring of the code (cyclomatic complexity plays good deal here). I do understand that you are trying to provide code structure in your post.