I've learned programming in Java at university. The book I read, explained the concept of pointers being used for object variables. Later I checked the actual concepts of pointers & references in C++.
I know these aren't 100% applicable to other high level / scripting languages, but there are recurring patterns that are similar.
When I started learning new languages, I noticed that most of them rely on the concept of storing some sort of object identifier inside a variable. When using an accessing-operator on the object-variable, it will read it, identify the object based on the identifier and access its content. I'd say this comes pretty close to the basic idea of a pointer.
I've confirmed that behavior for PHP and JS. Example for PHP: https://www.php.net/manual/en/language.oop5.references.php
When an object is sent by argument, returned or assigned to another variable, the different variables are not aliases: they hold a copy of the identifier, which points to the same object.
However, I often see people mixing up the terms reference and pointer. This started confusing me a little.
Personally, I think pointers are a more elegant way to store objects.
I'd like to know if pointers are actually a common case as object-variable or if references are just as common. Do pointers have notable advantages over references?
It's hard to tell which general concept is being used, because from a programmers perspective, the internals are often abstracted away. But I'd like to have a rough understanding of what's happening under the hood. Not in all detail, but conceptually.