CSC/ECE 517 Fall 2009/wiki3 19 ee

From Expertiza_Wiki
Jump to navigation Jump to search

Uniform Access Principle

The Uniform Access Principle states that any attribute of a module (usually a class) should be accessed with the same syntax, regardless of the nature of the data. Simply put, when a consumer reads or writes a value, they should not know (or care) weather they accessing a variable or invoking a method. Thus, no matter how the module internally handles the data, externally the information is always accessed uniformly.

Origin of the Uniform Access Principle

The Uniform Access Principle was created by the French engineer Bertrand Meyer. Meyer is known to be a strong proponent of object oriented programming, and in fact was one of the earliest and most outspoken champions of OO. His book Object-Oriented Software Construction, first published in 1988, is considered to be a foundational publication of the object oriented programming movement.[1] It was in this book that he put forth the uniform access principal by stating "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."[2]

Advantages of the Uniform Access Principle

There are many advantages associated with using the Uniform Access Principal when writing software.

Reading Properties

Ease of Understanding

Convenience of Interface

Maintainability of Interface

Disadvantages of the Uniform Access Principle

Writing Properties

Performance Issues

Class Maintenance

Language Restrictions

Code Examples

References