Up until this point in the book, we've intentionally favored generic object terminology over C#/.NET-specific nomenclature whenever the two diverged. Our purpose in doing so was to familiarize you with object concepts in a language-neutral fashion. For the remainder of the book, we're going to "shift gears" by adopting C#/.NET-specific terminology, to help you get equally accustomed to the unique .NET way of describing and doing things.
By way of review, we've prepared Table 13-1 to relate important generic OO terms to their C#/.NET preferred counterparts. In those cases where the matches aren't 100 percent exact, we've provided comments as to the subtle differences.
Generic OO Term |
C#/.NET Preferred Term(s) |
Comments |
---|---|---|
Feature |
Member |
When used in a general sense, these two terms are identical, in that they both relate to the building blocks comprising a class definition. In a detailed sense, however, the term "member" is a bit broader than "feature": "feature" includes attributes, methods, and constructors; "member" includes attributes, methods, constructors, and properties (among others). |
Method |
Method |
Used in identical ways. |
N/A |
Function member |
A "function member" is a programming element that contains executable code. Methods, properties, and constructors are all considered to be function members. |
Attribute |
Field, data member |
"Field" is preferred over "attribute" to refer to the data elements of a class when discussing C# code. The use of the generic OOPL term "attribute" to describe a C# field/data member is discouraged because of possible confusion with the .NET-specific programming construct known as an "attribute," which we'll explore later in this chapter. The term "data member" is also sometimes used to describe fields. |
"Get" method (aka accessor method) |
Get accessor |
Not exactly equivalent—a "get" method is a true method, whereas a get accessor is a component of a property; see Chapter 4 for a detailed explanation of properties in general and get accessors specifically. |
"Set" method (aka accessor method) |
Set accessor |
Not exactly equivalent—a "set" method is a true method, whereas a set accessor is a component of a property; see Chapter 4 for a detailed explanation of properties in general and set accessors specifically. |
N/A |
Property |
A function member that allows client code to access the value of a field using dot notation while maintaining control over the access to the field; see Chapter 4 for a detailed explanation. |
N/A |
(.NET-specific) Attribute |
A programming construct used to assign metadata tags to types, methods, and fields; we'll explore this construct later in this chapter. |
Throughout the remainder of the book, we'll use C#/.NET-specific terminology in lieu of generic OO terminology. The first few times that we use the C#/.NET-specific term for something, we'll remind you of the generic OO term in parentheses: e.g., "A field (attribute) is a data element of a class."