March 2008
Intermediate to advanced
911 pages
20h 31m
English

Right now, the business logic in the model simply checks the parameter from the request and gives back a response (the advice). Nobody in the app remembers anything that went on with this client prior to the current request.
What he has NOW:

What he WANTS:
public class BeerExpert {
public NextResponse getAdvice(String answer) {
// Process client answer by looking at
// ALL of the client's previous answers, as well
// as the answer from the current request.
// if there's enough info, return final advice,
// else, return the next question to ask
}
}The model (the business logic) has to figure out whether it has enough information to make a recommendation (in other words, to give final advice), and if it doesn’t, it has to give back the next question to ask the user.
Assume the NextResponse class encapsulates the next thing to display for the user, and something that indicates whether it’s the final advice recommendation or another question.
Read now
Unlock full access