Explanation
The problem being addressed by Meyer involves the maintenance of large software projects or software libraries. 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. Programming languages often use different syntax for attribute access and invoking a method, (e.g. obj.something versus obj.something). The syntax change would require, in popular programming languages of the day, changing the source code in all the places where the attribute was used. This might require changing source code in many different locations throughout a very large volume of source code. Or worse, if the change is in an object library used by hundreds of customers, each of those customers would have to find and change all the places the attribute was used in their own code and recompile their programs.
Going the reverse way (from method to simple attribute) really wasn't a problem, as one can always just keep the function and have it simply return the attribute value.
Meyer recognized the need for software developers to write code in such a way as to minimize or eliminate cascading changes in code that result from changes which convert an object attribute to a method call(or vice versa). For this he developed the Uniform Access Principle.
Many programming languages do not strictly support the UAP but do support forms of it. Properties, which are provided in a number of programming languages, provide a way to invoke a method of an object while using the same notation as is used for attribute access. The separate method invocation syntax is still available.
Read more about this topic: Uniform Access Principle
Famous quotes containing the word explanation:
“My companion assumes to know my mood and habit of thought, and we go on from explanation to explanation, until all is said that words can, and we leave matters just as they were at first, because of that vicious assumption.”
—Ralph Waldo Emerson (18031882)
“We live between two worlds; we soar in the atmosphere; we creep upon the soil; we have the aspirations of creators and the propensities of quadrupeds. There can be but one explanation of this fact. We are passing from the animal into a higher form, and the drama of this planet is in its second act.”
—W. Winwood Reade (18381875)
“Young children constantly invent new explanations to account for complex processes. And since their inventions change from week to week, furnishing the correct explanation is not quite so important as conveying a willingness to discuss the subject. Become an askable parent.”
—Ruth Formanek (20th century)