Skip to content

service

Separation of api and implementation

In every project you have to deal with apis and their implementations. While a lot of projects separate the api from it’s implementation through different java packages (mostly named internal or impl), I want to show you another approach and tell you why this approach makes more sense. I call this other approach “implementation separation by packaging artifact”. Let’s take a look at a widly used project structure that separates the api from the implementation by using a separate impl package. This kind of separation is widely used but it has a some impacts on design and api usage as I will show now. Api and implementation dependencies differ The… Read More »Separation of api and implementation

Simplify service layer design using bean validation – jsr-303

Some weeks ago I wrote a blog about Pros and cons of service layer designs. While that blog addresses the service layer design with pure java, this blog is about a service layer design using java bean validation as defined by jsr-303. Both strategies that I have discussed in the Pros and cons of service layer designs blog can be implemented easier by using the java bean validation framework. Let’s take a look at the shared request and response type strategy. The problem of this strategy is that the request and response types are used in a lot of different service methods and therefore they must define the properties of all… Read More »Simplify service layer design using bean validation – jsr-303

Pros and cons of service layer designs

A service layer is a common approach in enterprise applications to encapsulage application specific use cases. So when I talk about service layers I mean the service layer pattern as described in the “pattern of enterprise application architecture” book by Martin Fowler. While the pattern describes the responsibility of a service layer from a high level architectural perspective, this blog is about to take a closer look at the most used service layer designs. Definition of a service A service provides methods for it’s clients. These methods are typically on a coarse-grained level and normally encapsulate use cases. Therefore the service layer methods are often the transaction boundary of an… Read More »Pros and cons of service layer designs