Field (computer science)
Encyclopedia
In computer science
Computer science
Computer science or computing science is the study of the theoretical foundations of information and computation and of practical techniques for their implementation and application in computer systems...

, data that has several parts can be divided into fields. Relational database
Relational database
A relational database is a database that conforms to relational model theory. The software used in a relational database is called a relational database management system . Colloquial use of the term "relational database" may refer to the RDBMS software, or the relational database itself...

s arrange data as sets of database records, also called rows
Row (database)
In the context of a relational database, a row—also called a record or tuple—represents a single, implicitly structured data item in a table. In simple terms, a database table can be thought of as consisting of rows and columns or fields...

. Each record consists of several fields; the fields of all records form the columns
Column (database)
In the context of a relational database table, a column is a set of data values of a particular simple type, one for each row of the table. The columns provide the structure according to which the rows are composed....

.

In object-oriented programming
Object-oriented programming
Object-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...

, field (also called data member or member variable
Member variable
In object-oriented programming, a member variable is a variable that is associated with a specific class, and accessible for all its methods. If there is only one copy of the variable shared with all instances of the class, it is called a class variable or static member variable...

) is the data
Data
The term data refers to qualitative or quantitative attributes of a variable or set of variables. Data are typically the results of measurements and can be the basis of graphs, images, or observations of a set of variables. Data are often viewed as the lowest level of abstraction from which...

 encapsulated
Information hiding
In computer science, information hiding is the principle of segregation of the design decisions in a computer program that are most likely to change, thus protecting other parts of the program from extensive modification if the design decision is changed...

 within a class
Class (computer science)
In object-oriented programming, a class is a construct that is used as a blueprint to create instances of itself – referred to as class instances, class objects, instance objects or simply objects. A class defines constituent members which enable these class instances to have state and behavior...

 or object. In the case of a regular field (also called instance variable
Instance variable
In object-oriented programming with classes, an instance variable is a variable defined in a class , for which each object of the class has a separate copy. They live in memory for the life of the object....

), for each instance of the object there is an instance variable
Instance variable
In object-oriented programming with classes, an instance variable is a variable defined in a class , for which each object of the class has a separate copy. They live in memory for the life of the object....

: for example, an Employee class has a Name field and there is one distinct name per employee. A static field (also called class variable
Class variable
In object-oriented programming with classes, a class variable is a variable defined in a class of which a single copy exists, regardless of how many instances of the class exist.A class variable is the opposite of an instance variable...

) is one variable, which is shared by all instances.

Fixed length

Fields that contain a fixed number of bytes are known as fixed length fields. A four byte field for example may contain a 31 bit binary integer plus a sign bit (32 bits in all). A 30 byte name field may contain a persons name typically padded with blanks at the end.
The disadvantage of using fixed length fields is that some part of the field may be wasted but space is still required for the maximum length case. Also, where fields are ommitted, padding for the missing fields is still required to maintain fixed start positions within a record for instance.

Variable length

A variable length field may sometimes consist of two components:-
  • a length prefix (such as a two byte unsigned binary field) followed by
  • the actual variable length data itself (maximum length 32,765)

Processing variable fields of this type is generally much faster than other formats since it is not necessary to parse the input to determine the beginning of the next field.

Alternatively, fields of variable length may, for instance, be separated by commas (see Comma-separated values
Comma-separated values
A comma-separated values file stores tabular data in plain-text form. As a result, such a file is easily human-readable ....

) when the end of each individual field must be determined by scanning for the delimiter "one byte at a time". Missing fields can be identified by two or more consecutive commas. It is not possible to use comma separated fields for exclusively binary fields since particular binary strings may be misinterpreted as a comma delimiter although unique binary values could be used instead, provided they do not occur naturally within the string.

See also

  • Attribute (computing)
    Attribute (computing)
    In computing, an attribute is a specification that defines a property of an object, element, or file. It may also refer to or set the specific value for a given instance of such....

  • Class variable
    Class variable
    In object-oriented programming with classes, a class variable is a variable defined in a class of which a single copy exists, regardless of how many instances of the class exist.A class variable is the opposite of an instance variable...

  • Data hierarchy
    Data hierarchy
    Data Hierarchy refers to the systematic organization of data, often in a hierarchical form. Data organization involves fields, records, files and so on....

  • Instance variable
    Instance variable
    In object-oriented programming with classes, an instance variable is a variable defined in a class , for which each object of the class has a separate copy. They live in memory for the life of the object....

  • Key field
    Key field
    A key field is a field or set of fields of a database table which together form a unique identifier for a database record . The aggregate of these fields is usually referred to simply as "the key". Key fields also define searches...

  • n-tuple
  • record
    Row (database)
    In the context of a relational database, a row—also called a record or tuple—represents a single, implicitly structured data item in a table. In simple terms, a database table can be thought of as consisting of rows and columns or fields...

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK