PUT: Guessing a Letter
Learn about using the PUT method to guess the letters in the game.
Designing the PUT
method
Next, we will define the most complex method, the PUT
method, where a letter guess is handled. This must account for special cases, such as:
- A non-existent game
- A game that has already ended
- A request with no letter in the payload
- A guessed letter that is more than one character
- A repeat guess
- No letter specified.
Handling special cases
What checks is this code missing? This method is typical because most of it is devoted to handling special cases, and only a small portion addresses the “typical” case. ...
Access this course and 1400+ top-rated courses and projects.