Compile and register a strategy
Compiles raw strategy source and registers it, returning its strategyId.
This answers one question: is the source valid Java. It compiles, registers, and hands
back the id — nothing more. Whether the class can actually run is
POST /strategy/{strategyId}/validate, and everything known about a strategy, validation
included, is read from GET /strategy/{strategyId}. One place to ask, so there is no second
answer to keep in step.
The strategyId is derived from what the code means, not from how it is written. Adding a
comment, inserting a blank line, re-indenting, reordering imports, or moving a method around
all return the same id — you have not created a second strategy. Renaming a variable,
changing an identifier's case, reordering fields, or reordering statements inside a method
return a different one.
Two rules follow, and they are worth designing around:
re-submitting a strategy you have only reformatted is free, and gives you back the id you
already had, along with any validation already recorded against it;
the id says nothing about behaviour. Two sources that compute the same thing by
different means are two strategies, because deciding otherwise would mean deciding program
equivalence.
Compile and register a strategy Compiles raw strategy source and registers it, returning its
strategyId.This answers one question: is the source valid Java. It compiles, registers, and hands back the id — nothing more. Whether the class can actually run is
POST /strategy/{strategyId}/validate, and everything known about a strategy, validation included, is read fromGET /strategy/{strategyId}. One place to ask, so there is no second answer to keep in step.The
strategyIdis derived from what the code means, not from how it is written. Adding a comment, inserting a blank line, re-indenting, reordering imports, or moving a method around all return the same id — you have not created a second strategy. Renaming a variable, changing an identifier's case, reordering fields, or reordering statements inside a method return a different one.Two rules follow, and they are worth designing around: