liveBook · Manning

Short-circuit evaluation

Short-circuit evaluation is an evaluation strategy that skips remaining operands or processing when the result is already determined.

How 3 Manning books explain it

ASP.NET Core in Action, 3e

A short circuit is the termination of request-processing pipeline execution by returning a result without invoking the remaining components.

How it is used
Stops endpoint, MVC, or Razor Pages processing when a filter can produce the response without invoking later pipeline stages.
How deep it goes
Explains continuation, filter order, stage-specific bypass, and earlier-filter callbacks, while deferring some result-filter details.
Examples
Demonstrates invalid identifier validation, a Problem Details response, ordered logging filters, and a minimal API returning fruit data.
What you can do after
Apply it via endpoint or MVC filters by returning a result before invoking the remaining pipeline.

Read how ASP.NET Core in Action, 3e explains short-circuit evaluation →

Clojure: The Essential Reference

Short-circuit evaluation is an evaluation strategy that skips operands whose results cannot affect the overall logical result.

How it is used
Uses left-to-right operand skipping to end logical chains once their result is determined.
How deep it goes
Details return values, zero-argument cases, practical guards, and macro expansion rather than a general evaluation model.
Examples
Demonstrates file-path guarding, a default server port, predicate filtering, and spam detection.
What you can do after
Apply it via Clojure `and` and `or` for guards and defaults, or via `every-pred` and `some-fn` for combined predicates.

Read how Clojure: The Essential Reference explains short-circuit evaluation →

100 Java Mistakes and How to Avoid Them

A short-circuit operator is a Java boolean operator that skips evaluation of its right operand when the result is already determined by the left operand.

How it is used
Prevents incorrect conditions, unnecessary computation, and runtime exceptions caused by eager boolean evaluation.
How deep it goes
Explains operand evaluation, compound-assignment behavior, and precedence hazards through focused Java examples.
Examples
Uses array bounds checks, chained validation calls, mixed logical conditions, and independently evaluated update methods.
What you can do after
Diagnose/debug with it by spotting eager operators and rewriting conditions or assignments that should skip later operands.

Read how 100 Java Mistakes and How to Avoid Them explains short-circuit evaluation →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.