Skip to content

API Discussion: Package naming scheme #5

@jlink

Description

@jlink

Other than jqwik version 1, jqwik 2 will not split up the codebase in API modules and implementation modules. The reason is that doing that is a lot of effort since it requires the introduction of facades on the API side for every call into the implementation module. The benefit (limit visibility of implementation classes) however is IMO rather small.

To mitigate the problem that implementation classes are visible by users of the API, jqwik 2 plans to use two mechanisms:

  • The public API will be annotated using annotations from API guardian. Jqwik 1 also uses those.
  • Using a clear and consistent naming scheme for public and internal packages. This discussion issues wants to address this naming scheme.

Options

Looking at other Java libraries, a few main ideas seem to prevail:

  • Published API is in a subpackage api
  • Internal implementation is in a subpackage internal
  • Both api and internal

One special case is the fundamental model, often called "the core" of a library. Should it get its own subpackage core or just reside in the projects main namespace?

Suggestion

I suggest to use both api and internal subpackages as well as a subpackage core for the base module.
This makes all choices explicit, but it leads to somewhat longer package names.

Example

Let's assume a simple jqwik 2 structure with three modules: a "core" module, a "JUnit platform" module and a "JUnit Jupiter" module.

The package structure would look like:

Core module:

net.jqwik2.core.api
net.jqwik2.core.api.generation
net.jqwik2.core.api.arbitraries
...
net.jqwik2.core.internal.p1
net.jqwik2.core.internal.p2
...

JUnit platform module:

net.jqwik2.junit.api
net.jqwik2.junit.api.annotations
net.jqwik2.junit.internal

JUnit Jupiter module:

net.jqwik2.junit.jupiter.api
net.jqwik2.junit.jupiter.extensions.api
net.jqwik2.junit.jupiter.internal

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions