Reflection
Reflection is a programming-language or runtime capability that lets a program inspect or manipulate its own types, structure, values, or metadata during execution.
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 prompts to improve complex language-model outputs and inform agent actions from past results.
- How deep it goes
- Provides a two-prompt critique-and-revision procedure with criteria and structured feedback.
- Examples
- Uses an EU AI Act report and a product-roadmap agent’s research-source choices as examples.
- What you can do after
- Practice prompting a language model to critique and revise a draft against explicit criteria.
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
- Guides multistep agents to check progress and recover when reactive execution loses direction.
- How deep it goes
- Implements a free-form reflection tool and elaborates checkpoints, failure recovery, and coordination with replanning.
- Examples
- Demonstrates recovery from an unavailable Wikipedia service and synthesis of multiple research results.
- What you can do after
- Builds a reflection tool and integrates it into an agent for progress checks and failure recovery.
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.
Fast by Default
Reflection is a language or runtime capability that discovers or accesses program types and members dynamically rather than through direct references.
- How it is used
- Uses reflection as a signal for investigating unexpectedly large production dependencies and binaries.
- How deep it goes
- Explains runtime discovery and its compiler-size consequence, but stops short of implementation mechanics or reflection APIs.
- Examples
- Uses Go binary analysis and large-package inspection to expose reflection-related size retention.
- What you can do after
- Diagnose oversized dependencies by locating reflection-heavy packages and tracing their paths into the application.
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.
Also covered in
- Investing for Programmers
- Collaborative Software Design: How to facilitate domain modeling decisions
- Causal AI
- Retrieval Augmented Generation, The Foundational IdeasIn early access (MEAP)
- Writing for Developers: Blogs that get read
- 100 Java Mistakes and How to Avoid Them
- Go in Action, Second Edition
- Robotics for ProgrammersIn early access (MEAP)
- Python How-To
- F# in Action: A Revised Edition of Get Programming with F#
- .NET in Action, Second Edition
What to know first
- language modelA language model is a computational model that represents patterns in linguistic sequences to assign probabilities, predict, generate, or evaluate language.
- AI agentAn AI agent is a computational system that uses artificial intelligence to interpret information and select or perform actions toward goals while interacting with an environment.
- attributeAn attribute is a named property or piece of information associated with an entity, object, or structured data item.
Related concepts
- reflect.DeepEqualused by · reflect.DeepEqual is a Go function that recursively determines whether two values, including nested and referenced values, are deeply equal.
- 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.
- type hintsaddressed by · Type hints are source-code annotations that indicate the intended or expected types of program elements, with enforcement depending on the language and tools.
- attributeuses · An attribute is a named property or piece of information associated with an entity, object, or structured data item.
- objectuses · An object is a distinct entity represented or manipulated within a computational system, typically as a value, data structure, resource, or instance of a type.
- AI agentkind of · An AI agent is a computational system that uses artificial intelligence to interpret information and select or perform actions toward goals while interacting with an environment.
Questions about reflection
What is reflection?
Reflection is a programming-language or runtime capability that lets a program inspect or manipulate its own types, structure, values, or metadata during execution.
Which Manning books explain reflection?
Go in Practice, Second Edition, Kotlin in Action, 2E, The Art of AI Product Development, Build an AI Agent (From Scratch), Clojure: The Essential Reference, Lead Developer Career Guide, AI Agents in Action, Second Edition, Building Web APIs with ASP.NET Core and 6 more.
What should I know before learning reflection?
Manning books that teach reflection usually introduce language model, AI agent, attribute and Java first.
What is the difference between reflection and type assertion?
Reflection is a programming-language or runtime capability that lets a program inspect or manipulate its own types, structure, values, or metadata during execution. 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.
What is reflection a kind of?
Reflection is a kind of AI agent. An AI agent is a computational system that uses artificial intelligence to interpret information and select or perform actions toward goals while interacting with an environment.
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.













