liveBook · Manning

Circular reference

A circular reference is a cycle of direct or indirect references among objects, components, or resources, in which following the references eventually leads back to something already encountered.

How 3 Manning books explain it

Pro ASP.NET Core 7, Tenth Edition

A circular reference is a chain of object references in which an object is eventually referenced again, forming a cycle.

How it is used
Diagnoses JSON failures when ASP.NET Core web-service responses expose Entity Framework Core related data.
How deep it goes
Explains navigation-property tracking, demonstrates the failing request, and shows manually nulling back-references before serialization.
Examples
Uses Supplier and Product entities, an Include query, the /api/suppliers/1 endpoint, and a foreach back-reference removal.
What you can do after
Diagnose serialization failures and break response cycles by removing child-to-parent references before returning related data.

Read how Pro ASP.NET Core 7, Tenth Edition explains circular reference →

The Well-Grounded Python Developer: How the pros use Python and Flask

A circular reference problem is a dependency structure in which modules directly or indirectly require each other in a cycle that prevents valid importing or initialization.

How it is used
Prevents module-import cycles when Flask features need access to the central app instance.
How deep it goes
Explains the dependency structure and gives a package-and-factory remedy, without descending into Python import internals.
Examples
Uses a MyBlog app.py layout, a package directory tree, create_app(), and Flask command-line launch examples.
What you can do after
Diagnose/debug with it by recognizing import cycles and restructuring Flask code around a package and factory.

Read how The Well-Grounded Python Developer: How the pros use Python and Flask explains circular reference →

100 C++ Mistakes and How to Avoid Them

A circular reference is a cycle of object references in which objects eventually refer back to an earlier object in the cycle.

How it is used
Warns that shared ownership can create cycles that prevent resource deletion.
How deep it goes
Explains reference-count changes and weak-pointer conversion, but does not show a complete cycle-breaking rewrite.
Examples
Uses a deque whose nodes hold shared pointers to previous and next nodes.
What you can do after
Diagnose shared-pointer cycles that leak resources and consider a weak pointer to break ownership.

Read how 100 C++ Mistakes and How to Avoid Them explains circular reference →

Also covered in

Related concepts

Questions about circular reference

What is circular reference?

A circular reference is a cycle of direct or indirect references among objects, components, or resources, in which following the references eventually leads back to something already encountered.

Which Manning books explain circular reference?

Pro ASP.NET Core 7, Tenth Edition, The Well-Grounded Python Developer: How the pros use Python and Flask and 100 C++ Mistakes and How to Avoid Them.

What is the difference between circular reference and reference counting?

A circular reference is a cycle of direct or indirect references among objects, components, or resources, in which following the references eventually leads back to something already encountered. Reference counting is a memory-management technique that tracks references to an object or value and can reclaim it when its reference count reaches zero.

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.