A robust service is one that feels secure and reliable to its users. Something which behaves unpredictably, sometimes gives incorrect results and occasionally doesn’t respond at all is not what a consumer wants to integrate into their own applications. In this chapter we’ll look at what makes a robust service, and some techniques for making services as good as they can be, when things are going well, and when they are not.
“The best services exhibit consistent, predictable behaviours. This approach of having as much “sameness” as possible works well for consumers, who start to feel at home. As they use the service, they become familiar with how it will work, and will be able to find their way around and deal with any errors they encounter more easily. Most importantly, your consumers will be able to achieve their goals, which should give both consumer and provider a lovely, warm, fuzzy feeling.
As PHP developers, we know only too well how difficult it is to use an interface which is inconsistent. The number of manual entries which use the words “needle” and “haystack” with very little correlation between which one should come first in any given situation (and one function where they can be passed in either way round!) are our reminder of how painful this can be!
In our own applications, we can do better, but it needs us to pay attention to the bigger picture and the existing elements of an API as we work on building more features. ...