Browse Source

Axon docs.

Herbert Vojčík 6 years ago
parent
commit
c86fa13649
1 changed files with 33 additions and 0 deletions
  1. 33 0
      README.md

+ 33 - 0
README.md

@@ -3,6 +3,39 @@ Axxord
 
 Small blackboard system for Amber Smalltalk.
 
+Axon
+----
+
+Axon is a pub-sub system used in Axxord. It is fully generic, so it can be used
+for other purposes as well, without using the rest of the library.
+
+It consists of two components: `Axon` abstract base class
+(and its implemenetation `SimpleAxon`), which are subscription managers;
+and `AxonInterest` abstract base class (and its pluggable implementation
+`PluggableInterest`) that represent the actual subscription.
+
+You can create an axon, like in `axon := SimpleAxon new`. Then, you will add
+some interests in an aspect, as in `axon addInterest: (PluggableInterest new
+accept: [:aspect | aspect = #amount] enact: [Transcript show: 'Amount is ';
+show: aThing amount; cr])`. It is not prescribed what an aspect can be,
+or an aspect of what it is. It is used _only_ to distinguish whether the change
+is related to the interest or not (as in previous example, one is interested
+in changes of `#amount`).
+
+Whenever the change in some aspect happens for the object axon is watching,
+axon should be let known, using `axon changed: #amount`. You can also
+tell an axon that everything has changed, using `axon changedAll`.
+Axon then makes related interests enact, eventually (it may or may not happen
+immediately in the same thread, so enact should actually check if it is still
+interesting when it takes its turn).
+
+There is no `removeInterest:`. The interest removes itself by signalling,
+as in `PluggableInterest accept: [:aspect | aspect = #enabled]
+enact: [aThing isEnabled ifTrue: [Transcript show: 'still alive'; cr]
+ifFalse: [AxonOff signal]]`.
+
+Axon and friends are all in their dedicated `Axxord-Axon` category / package.
+
 Axes
 ----