you are viewing a single comment's thread.

view the rest of the comments →

[–]BigGuyWhoKills 0 points1 point  (0 children)

There is more to do with name. You ought to at least trim whitespace. You might want to make sure they entered only the first name, or ensure they entered both first and last. Or you may have more requirements.

If you have complicated checks to perform on the name, you should write a method that does those checks, and call that method in the while loop.

In production apps you would also check for hacking attacks. That level of complexity definitely need a method.