Instance variable
An instance variable is data associated with a particular object, rather than shared across all instances of its class or type.
The Well-Grounded Rubyist, Fourth Edition
An instance variable is a Ruby variable identified by a single-at-sign prefix and associated with an individual object.
- How it is used
- Stores per-object state so methods can retrieve or change values after initialization.
- How deep it goes
- Explains assignment, persistence across calls, ownership through `self`, and inspection with `instance_variables`.
- Examples
- Uses tickets with distinct venues and dates, a person's persistent name, and runtime inspection of accessor-backed variables.
- What you can do after
- Build it from scratch: initialize per-object state, expose or change it through methods, and identify its owner using `self`.
Read how The Well-Grounded Rubyist, Fourth Edition explains instance variable →
Software Design for Python Programmers
An instance variable is state associated with an individual object instance.
- How it is used
- Models per-object state, class-owned relationships, and runtime state transitions in object-oriented application design.
- How deep it goes
- Explains state, visibility, dependencies, multiplicity, and defensive copying, but stops short of general language-level attribute mechanics.
- Examples
- Uses catalogue objects, Employee birthdates, and an automatic ticket machine to demonstrate storage, protection, and state changes.
- What you can do after
- Evaluate/understand how object state, ownership, visibility, and mutation paths affect class design.
Read how Software Design for Python Programmers explains instance variable →
100 Java Mistakes and How to Avoid Them
- How it is used
- Prevents object-specific data from becoming accidentally shared through a static field.
- How deep it goes
- Explains per-object versus per-class storage, failure under concurrency, mutable static state, and applicable inspections.
- Examples
- Uses a Person name field and a concurrent TreeWalker queue to expose shared-state leakage.
- What you can do after
- Diagnose accidental static state by comparing field ownership with object usage and applying IDE or SonarLint inspections.
Read how 100 Java Mistakes and How to Avoid Them explains instance variable →
Secrets of the JavaScript Ninja, Second Edition
A property that belongs directly to a particular object instance rather than being inherited from its prototype.
- How it is used
- Contrasts properties stored on an object instance with properties supplied through its prototype.
- How deep it goes
- Explains constructor assignment, property precedence, and per-instance copies, then flags repeated methods as a concern for many objects.
- Examples
- Uses Ninja instances with `swung` and competing `swingSword` methods to demonstrate property ownership and precedence.
- What you can do after
- Understand which same-named property is found and why constructor-created methods are duplicated across instances.
Read how Secrets of the JavaScript Ninja, Second Edition explains instance variable →
Related concepts
- static fieldcontrasts with · A named variable whose storage is associated with a class or has static duration, rather than being allocated separately for each object instance or function call.
- scopecontrasts with · Scope is the region of a program in which names are visible and can be resolved according to the language’s lookup rules.
- stateused by · State is information or a configuration describing the condition of a system, entity, or computation at a particular time and potentially influencing subsequent behavior or decisions.
- const referenceconfigured by · A const reference is a C++ reference through which the referred-to object cannot be modified.
- accessor methodused by · An accessor method or function provides access to an object's property or state by retrieving its value, assigning a value, or defining behavior for such access.
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.



