How it works...

As you may have already noticed, we created two situations in this code: one clearly coupled (getUserCoupled) and another decoupled (getUserDecoupled):

    public Response getUserCoupled(            @PathParam("name") String name,             @PathParam("email") String email)

Why is this a coupled method and thus a coupled service? Because it is highly attached to the method signature. Imagine it is a search service and "name" and "email" are filters. Now imagine that sometime in the future you need to add another filter. One more parameter in the signature.

OK, you could keep the two methods alive at the same time, so that you wouldn't break the client and have to change the clients. How many are there? Mobile, services, web pages, and many more. ...

Get Java EE 8 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.