Reflection
Reflection is a programming capability for inspecting or interacting with program types, members, values, or metadata dynamically at runtime.
Go in Practice, Second Edition
The Go reflect package provides runtime facilities for inspecting and manipulating the types and values of program data.
- How it is used
- Inspects unknown values at runtime to select behavior, test interfaces, walk structs, and process tags.
- How deep it goes
- Works through values, types, kinds, interface checks, recursive field inspection, and a limited custom encoder and decoder.
- Examples
- Uses a mixed-type sum, an interface-implementation check, a recursive struct walker, and tagged name–value encoding.
- What you can do after
- Build it from scratch: inspect Go values and implement a limited tag-driven Marshal and Unmarshal pair.
Read how Go in Practice, Second Edition explains reflection →
Kotlin in Action, 2E
- How it is used
- Enables JSON serializers and deserializers to process arbitrary runtime object types without statically naming their properties.
- How deep it goes
- Works through property inspection, annotation lookup, constructor invocation, type conversion, and cached metadata for deserialization.
- Examples
- Demonstrates Person property filtering and renaming, custom Date serialization, and nested Book and Author deserialization.
- What you can do after
- Build it from scratch by inspecting properties, mapping JSON fields to constructor parameters, converting values, and invoking constructors reflectively.
The Art of AI Product Development
Introspection is examination of a system's own outputs, reasoning, or internal assessments.
- How it is used
- Uses reflection to revise generated content and help agents learn from the results of past actions.
- How deep it goes
- Develops single- and two-prompt review cycles with criteria and structured feedback; does not show external verification as part of those prompts.
- Examples
- Uses an EU AI Act compliance report, a retrieval-assisted report, and product-roadmap research to illustrate revision and retained lessons.
- What you can do after
- Apply it via reflection prompts to critique and revise drafts, or retain agent conclusions for later tasks.
Read how The Art of AI Product Development explains reflection →
Build an AI Agent (From Scratch)
Reflection is an agent technique for examining intermediate reasoning or results and revising subsequent actions.
- How it is used
- Checks an agent’s progress after action and records guidance for its next decision.
- How deep it goes
- Implements a free-form Python tool and optional replanning signal, then traces failure recovery and research synthesis.
- Examples
- Uses a failed Wikipedia call, conflicting Moon-distance values, and research-result synthesis as checkpoints.
- What you can do after
- Build it from scratch as a tool that records progress checks, supports failure recovery, and signals when to revisit a plan.
Read how Build an AI Agent (From Scratch) explains reflection →
Clojure: The Essential Reference
Java reflection is an API mechanism for discovering class structure and invoking constructors or other members at runtime.
- How it is used
- Uses reflection to inspect Java types and to explain compiler warnings when Java calls cannot be resolved statically.
- How deep it goes
- Defines inspection inputs, result keys, and options, then works through type hints and typed array setters without detailing Java reflection internals.
- Examples
- Uses map inspection, request signing with a timed run, and integer-array updates that trigger or avoid warnings.
- What you can do after
- Diagnose/debug with reflection warnings, inspect Java types via `clojure.reflect/reflect`, and remove demonstrated reflective calls with type hints or `aset-int`.
Read how Clojure: The Essential Reference explains reflection →
Lead Developer Career Guide
Deliberate examination of one's own thoughts, feelings, behavior, challenges, and decisions.
- How it is used
- Uses reflection to improve self-awareness, team interactions, difficult conversations, and decisions about leadership readiness.
- How deep it goes
- Offers questions about emotional reactions and practical follow-up and journaling habits, without a formal assessment method.
- Examples
- Uses an uncomfortable team interaction and a rushed API integration that caused bugs and technical debt.
- What you can do after
- Practice/perform reflection to adjust future conversations, learn from mistakes, and evaluate readiness for leadership.
AI Agents in Action, Second Edition
Reflexion is an agent technique in which an agent uses feedback or self-reflection to improve subsequent decisions or attempts.
- How it is used
- Improves difficult or ambiguous agent tasks by feeding critique from failed attempts into iterative retries.
- How deep it goes
- Explains the solver–critic loop, prompt conditioning, validation, and retry limits, but stops short of weight updates or persistent memory.
- Examples
- Uses time-travel calculations, solver–critic agents, a correctness-checking tool, four-attempt retries, and forced success or failure paths.
- What you can do after
- Build it from scratch as a solver–critic retry loop with feedback injection, deterministic checks, and bounded attempts.
Read how AI Agents in Action, Second Edition explains reflection →
Building Web APIs with ASP.NET Core
Reflection is the programmatic inspection of a type's metadata, members, and structure at runtime.
- How it is used
- Uses metadata inspection to validate client-provided sort-column names against properties exposed by a DTO.
- How deep it goes
- Demonstrates property inspection through GetProperties and stops short of broader reflection APIs or internal runtime mechanics.
- Examples
- Uses SortColumnValidatorAttribute to compare a requested sort column with BoardGameDTO properties.
- What you can do after
- Apply it via a custom validation attribute that checks requested names against a selected .NET type's properties.
Read how Building Web APIs with ASP.NET Core explains reflection →
The Well-Grounded Rubyist, Fourth Edition
Introspection, also called reflection, is the examination of a program's objects, methods, or state while the program is running.
- How it is used
- Uses runtime inspection to query capabilities, state, program structure, and execution history while supporting dynamic behavior.
- How deep it goes
- Explains capability checks, method and variable listings, constants, stack traces, and dynamic message hooks without exhaustive API detail.
- Examples
- Demonstrates respond_to? before calling talk, method inspection, variable and constant listings, and stack-trace queries.
- What you can do after
- Apply it via Ruby reflection methods to check capabilities, inspect runtime state, handle dynamic messages, and diagnose execution paths.
Read how The Well-Grounded Rubyist, Fourth Edition explains reflection →
The Joy of JavaScript
A programming paradigm in which a program can inspect or modify its own structure and behavior.
- How it is used
- Uses runtime hooks to customize JavaScript behavior and separate cross-cutting concerns such as logging, tracing, caching, and performance.
- How deep it goes
- Distinguishes symbol-based hooks from Proxy and Reflect weaving, but does not detail individual trap implementations or complete API reference.
- Examples
- Uses symbols, well-known symbols, proxy delegation, logging, caching, masking, network communication, and filesystem access as examples.
- What you can do after
- Apply it via JavaScript symbols, Proxy, and Reflect to weave behavior, define runtime hooks, and modularize cross-cutting logic.
100 Go Mistakes and How to Avoid Them
Reflection is the ability of a program to inspect and manipulate type and value information at runtime.
- How it is used
- Diagnoses unsafe equality comparisons and applies runtime reflection to compare values containing slices, maps, or other noncomparable parts.
- How deep it goes
- Defines runtime introspection and demonstrates DeepEqual, while deferring broader reflection mechanics and documentation-specific behavior.
- Examples
- Uses customer structs, any values, slice fields, runtime panics, DeepEqual, and a hand-written equality method.
- What you can do after
- Apply it via Go's reflect package to compare nested values that ordinary equality cannot compare.
Read how 100 Go Mistakes and How to Avoid Them explains reflection →
Think Like a Software Engineering Manager
Reflection is the deliberate examination of one’s experiences, achievements, challenges, and learning to gain insight for future action.
- How it is used
- Uses deliberate self-examination to improve managerial performance, retention responses, and team decisions.
- How deep it goes
- Provides practical prompts and schedules reflection but stops short of a formal reflective method or detailed implementation.
- Examples
- Uses strengths-and-weaknesses reviews, resignation analysis, decision records, and monthly or quarterly assessments.
- What you can do after
- Practice/perform reflection to identify improvement areas, diagnose controllable causes, and adapt future managerial decisions.
Read how Think Like a Software Engineering Manager explains reflection →
Quarkus in Action
Reflection is the runtime inspection and manipulation of program elements such as classes and methods through metadata rather than only statically referenced code.
- How it is used
- Uses runtime metadata access while highlighting its consequences for Quarkus native compilation.
- How deep it goes
- Explains native-image registration and extension assistance, but stops short of detailing reflection APIs or metadata internals.
- Examples
- Uses @RegisterForReflection and automatic class registration by Quarkus extensions as concrete configuration examples.
- What you can do after
- Operate/configure native builds by registering reflectively accessed classes or selecting extensions that register them automatically.
Related concepts
- type hintsaddressed by · Type hints are source-code annotations that indicate the intended or expected types of program elements and can support documentation, tooling, or type checking.
- type assertionalternative to · A type assertion is a language construct that states or checks that a value has a specified type, with runtime behavior depending on the language.
- reflect.DeepEqualused by · reflect.DeepEqual is a Go function that recursively determines whether two values, including nested and referenced values, are deeply equal.
- attributeuses · An attribute is a named property, value, or piece of information associated with an entity, object, or program element.
- objectuses · A computational object is a runtime entity or structured value representing data, state, or a resource, with properties or operations defined by its programming model.
- type functionuses · Python’s type() function returns an object’s type when called with one argument and can create a class when called with class-construction arguments.
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.












