Home » API

Tag Archives: API

RAML: Four ways to define examples

java-interview-questions-answers

Defining an example body payload and response for a RESTful API endpoint is an essential aspect of designing a modern API. These examples ensure that it is clear what the API contract expects to receive from the client and to respond with to the client. In this post, I will highlight four ways to specify the expected incoming and outgoing ...

Read More »

RESTful API Design

java-interview-questions-answers

There are five principal aspects to a RESTful API specification that must be considered prior to coding an API specification. In this post I will discuss those five features with examples using a product use case. Before I get started let’s ensure that we understand what is meant by API and REST. If you are already familiar with API design ...

Read More »

How to deal with {conservative, intractable, annoying} APIs

Have you ever been fighting with an, at least for your current purpose, inflexible API? I picked up one of the trickier scenarios – calling super( … ) with parameters. Sometimes there will be APIs defining constructors that force to be called with instances of Objects. So far so good, but what if the handled parameter is stored private inside ...

Read More »

The depths of Java: API leak exposed through covariance

Java can be very tricky some times, especially in API design. Let’s have a look at a very interesting showcase. jOOQ strongly separates API from implementation. All API is in the org.jooq package, and public. Most implementation is in the org.jooq.impl package and package-private. Only factories and some dedicated base implementations are public. This allows for very powerful package-level encapsulation, ...

Read More »