are accessed by setYear and setMonth. In all cases month values outside of 1 - 12 can be rejected by the same code. Accessors conversely allow for synthesis of useful data representations from internal variables while keeping their structure encapsulated and hidden from outside modules. A monetary getAmount accessor may build a string from a numeric variable with the number of decimal places defined by a hidden currency parameter. Modern programming languages often offer the ability to generate the boilerplate for mutators and accessors in a single line—as for example C#'s public string Name { get; set; } and Ruby's attr_accessor :name. In these cases, no code blocks are created for validation, preprocessing or synthesis. These simplified accessors still retain the advantage of encapsulation over simple public instance variables, but it is common that, as system designs progress, the software is maintained and requirements change, the demands on the data become more sophisticated. Many automatic mutators and accessors eventually get replaced by separate blocks of code. The benefit of automatically creating them in the early days of the implementation is that the public interface of the class remains identical whether or not greater sophistication is added, requiring no extensive refactoring if it is. Manipulation of parameters that have mutators and accessors from inside the class where they are defined often requires some additional thought. In the early days of an implementation, when there is little or no additional code in these blocks, it makes no difference if the private instance variable is accessed directly or not. As validation, cross-validation, data integrity checks, preprocessing or other sophistication is added, subtle bugs may appear where some internal access makes use of the newer code while in other places it is bypassed. Accessor functions can be less efficient than directly fetching or storing data fields due to the extra steps involved, however such functions are often inlined which eliminates the overhead of a function call. Examples Assembly student struct age dd ? student ends .code student_get_age proc object:DWORD mov ebx, object mov eax, student.age[ebx] ret student_get_age endp student_set_age proc object:DWORD, age:DWORD mov ebx, object mov eax, age mov student.age[ebx], eax ret student_set_age endp C In file student.h: #ifndef _STUDENT_H #define _STUDENT_H struct student; /* opaque structure */ typedef struct student student; student *student_new(int age, char *name); void student_delete(student *s); void student_set_age(student *s, int age); int student_get_age(student *s); char *student_get_name(student *s); #endif In file