OxL Reference

Rules of good code (part IV)

In this chapter

IV.1 No "magic" valuesTimeouts, retries, sizes, limits, TTLs and thresholds are set once by a named constant or a config field and reused.
IV.2 Namesoxl fmt does not rename; the analyzer issues the warning naming.
IV.3 ErrorsReturn concrete @error types, not strings.
IV.4 AsynchronyA chain is for a sequence of steps with a common error handler and deadline; write simple sequential code with ordinary statements.
IV.5 Data and schemasDo not change a field's type — add a new field and mark the old one @removed.
IV.6 DistributionAny rpc that can be repeated (sagas, durable steps, @retry) is @idempotent.
IV.7 TestsFor each rpc — a unit test of the handler with mocks of dependencies.