The uniform access principle of computer programming was put forth by Bertrand Meyer (originally in his book Object-Oriented Software Construction).
It states "All services offered by a module should be available through a uniform notation, which does not betray whether they are implemented through storage or through computation.
In simpler form, it states that there should be no syntactical difference between working with an attribute, pre-computed property, or method/query of an object.
Sometimes when developing or maintaining software it is necessary, after much code is in place, to change a class or object in a way that transforms what was simply an attribute access into a method call.
Likewise whether Foo.bar() simply retrieves the value of the attribute, or invokes a function to compute the value returned, is an implementation detail hidden from the caller.
However, UAP itself can lead to problems, if used in places where the differences between access methods are not negligible, such as when the returned value is expensive to compute or will trigger cache operations.
Properties allow the attribute notation to be used, but to hide the fact that a method is being invoked instead of simply retrieving or setting a value.
The person maintaining the Egg class can switch from one form to the other without fear of breaking any caller's code.
The C# language supports class properties, which provide a means to define get and set operations (getters and setters) for a member variable.
Similarly, the Name property is a string that can also be read and modified, but its value is stored in a separate (private) class variable _name.
C++ has neither the UAP nor properties, when an object is changed such that an attribute (color) becomes a pair of functions (getA, setA).