Hookless is a reactive programming library for Java. It automatically updates dependent reactive values whenever change is detected in any of their dependencies, which can be reactive variables or other reactive values. The point of reactive programming is to avoid the many problems with traditional callbacks (managing subscriptions, event rates, memory leaks, ...). Hookless is still in development.
What makes Hookless different?
There are quite a few reactive libraries for Java these days, so let's say right at the beginning what makes Hookless different.
- Hookless is all pure Java with no special bytecode modifications or JVM instrumentation (contrary to projects like Quasar).
- Invalidate-then-refresh pattern allows Hookless to have highly dynamic dependency lists, because dependencies are collected during every recomputation of the reactive value instead of being specified upfront.
- Invalidate-then-refresh pattern enables implicit dependency tracking (like in Meteor or Assisticant). Hookless-based code is mostly just plain Java code except that reactive dependencies are transparently captured in a thread-local context object. Hookless relies on thin libraries that wrap numerous existing high-level non-blocking APIs instead of trying to intercept low-level blocking operations (like Quasar).
- Hookless lets you define a number of local reactive values that refresh independently (like in Meteor or Assisticant) as opposed to single global state that would refresh all at once (like in React).
- Dependency graph in Hookless is garbage-collected. Hookless uses weak references (like Assisticant) to make whole sections of the dependency graph collectable once nothing needs them instead of relying on explicit teardown (like Meteor).
- In order to protect programs from hot reactive variables, invalidated reactive values are refreshed asynchronously and concurrently on a thread pool instead of being refreshed immediately after reactive variable change (like in Assisticant or Meteor).
- Hookless has efficient high-resolution reactive time implemented via semi-explicit time algebra (like in Assisticant. Other reactive libraries usually just provide either fully explicit timers or a low-resolution global tick.
Get Hookless from Maven Central:
<dependency> <groupId>com.machinezoo.hookless</groupId> <artifactId>hookless</artifactId> <version>0.7.0</version> </dependency>
Optionally, you can also reference additional artifacts depending on the functionality you need.
Don't forget to configure your build for Java 8+. All artifacts have sources available. Sources and binaries are distributed under Apache License 2.0.