Java & Software Design

References, Objects and Aliasing

3:20

Plays from YouTube. Watch on YouTube

Why can changing one Java variable unexpectedly affect another?

Meet References, Objects and Aliasing: a visual, example-driven explanation of the concepts behind reliable Java programs.

We start with primitives behave differently and a reference identifies an object, using concrete examples to make the behavior visible.

From there, we work through mutation is observable, null needs an explicit check, and the design decisions they create.

Then we connect arrays are objects to shallow copy is not deep copy and examine the assumptions and common mistakes.

Finally, we finish with garbage collection manages reachability and design for explicit ownership.

The big idea: Shared mutable state requires discipline.

Programming and software design explained visually, one concept at a time.