We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Let's make a contract: the art of designing a Java API by Mario Fusco
Designing a successful Java API requires a contract that's intuitive, understandable, and easily discoverable.
- The art of designing a Java API is crucial to its success.
- The main goal of an API is to provide a contract that defines how a service works and how users interact with it.
- The API should be intuitive, understandable, learnable, and discoverable.
- Avoidance of boolean arguments and null values is crucial for a good API.
- Fluent APIs are nice but should be used judiciously, as they can lead to verbose code and should be combined with other design principles.
- The trade-off is between providing more power to users versus providing a simple API.
- The return type of a method should be as weak as possible to provide users with the most possible freedom.
- It is essential to document the API clearly, including the domain model.
- Duplication of effort and underestimating the value of documentation are common mistakes.
- It is essential to consider the future-proof goal and avoid adding features without considering the impact on the API.
- Consistency and discoverability are crucial in an API.
- Making good use of static factory methods, fluent APIs, and navigator APIs is important.
- It is crucial to have a clear understanding of the API and how it will evolve to prevent runtime errors.
- The use of checked exceptions and unchecked exceptions is a complex issue in Java.