# Library development

* creating a jar/binary to use within other application, to provide some functionality
* The user/consumer, can use the functionality how they see fit
* This involves creating an API
  * A set of method signatures (method name, return type, inputs) as contracts that the use can use
    * This can include constructors, thus constructors need to be thought about too
  * This can lead to coupling, so changes to these api can break users

## Design considerations

### Backwards compatibility

### Versioning

* semantic

### Tests

* To check it works
* To see how it works
  * Documented tests
  * example tests

### Documentation

* Java docs
* wiki/readme

## Access to library

* Best to use a build (maven/gradle) and CI to create the binary, and push it to the repository
* local
  * create jar, and add to class path
* Allow users to create it locally
* Create it and push it to a private/public repository (artifactory, maven, jitpack etc)
  * If paid, create and give it to them so they can add it

## Links

* <https://www.oracle.com/corporate/features/library-in-java-best-practices.html>
* <https://www.youtube.com/watch?v=AX0e-Yi9f08> Writing a Java library with better experience -English version-
* <https://dzone.com/refcardz/java-api-best-practices>
* <https://www.baeldung.com/design-a-user-friendly-java-library>
* <https://jlbp.dev>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hanfak.gitbook.io/workspace/general-paradigms/projects/library-development.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
