Field (computer science)

Last updated

In data hierarchy, a field (data field) is a variable in a record. [1] A record, also known as a data structure, allows logically related data to be identified by a single name. Identifying related data as a single group is central to the construction of understandable computer programs. [2] The individual fields in a record may be accessed by name, just like any variable in a computer program. [3]

Contents

Each field in a record has two components. One component is the field's datatype declaration. The other component is the field's identifier. [4]

Memory fields

Fields may be stored in random access memory (RAM). The following Pascal record definition has three field identifiers: firstName, lastName, and age. The two name fields have a datatype of an array of character. The age field has a datatype of integer.

typePersonRecord=recordlastName:array[1..20]ofChar;firstName:array[1..20]ofChar;age:Integerend;

In Pascal, the identifier component precedes a colon, and the datatype component follows the colon. Once a record is defined, variables of the record can be allocated. Once the memory of the record is allocated, a field can be accessed like a variable by using the dot notation.

varalice:PersonRecord;alice.firstName:='Alice';

The term field has been replaced with the terms data member [5] and attribute. [6] The following Java class has three attributes: firstName, lastName, and age.

publicclassPersonRecord{privateStringfirstName;privateStringlastName;privateintage;}

File fields

File Data Hierarchy diagram Data Hierarchy diagram showing Employee database example by JeffTan.gif
File Data Hierarchy diagram

Fields may be stored in a random access file. [7] A file may be written to or read from in an arbitrary order. To accomplish the arbitrary access, the operating system provides a method to quickly seek around the file. [8] Once the disk head is positioned at the beginning of a record, each file field can be read into its corresponding memory field.

File fields are the main storage structure in the Indexed Sequential Access Method (ISAM). In relational database theory, the term field has been replaced with the terms column and attribute. [9]

See also

Related Research Articles

<span class="mw-page-title-main">AWK</span> Programming language

AWK is a domain-specific language designed for text processing and typically used as a data extraction and reporting tool. Like sed and grep, it is a filter, and is a standard feature of most Unix-like operating systems.

<span class="mw-page-title-main">Computer program</span> Instructions to be executed by a computer

A computer program is a sequence or set of instructions in a programming language for a computer to execute. It is one component of software, which also includes documentation and other intangible components.

In object-oriented programming, a class defines the shared aspects of objects created from the class. The capabilities of a class differ between programming languages, but generally the shared aspects consist of state (variables) and behavior (methods) that are each either associated with an particular object or with all objects of that class.

<span class="mw-page-title-main">String (computer science)</span> Sequence of characters, data type

In computer programming, a string is traditionally a sequence of characters, either as a literal constant or as some kind of variable. The latter may allow its elements to be mutated and the length changed, or it may be fixed. A string is generally considered as a data type and is often implemented as an array data structure of bytes that stores a sequence of elements, typically characters, using some character encoding. String may also denote more general arrays or other sequence data types and structures.

Generic programming is a style of computer programming in which algorithms are written in terms of data types to-be-specified-later that are then instantiated when needed for specific types provided as parameters. This approach, pioneered by the ML programming language in 1973, permits writing common functions or types that differ only in the set of types on which they operate when used, thus reducing duplicate code.

<span class="mw-page-title-main">Library (computing)</span> Collection of resources used to develop a computer program

In computer science, a library is a collection of read-only resources that is leveraged during software development to implement a computer program.

XSD, a recommendation of the World Wide Web Consortium (W3C), specifies how to formally describe the elements in an Extensible Markup Language (XML) document. It can be used by programmers to verify each piece of item content in a document, to assure it adheres to the description of the element it is placed in.

In computer science, imperative programming is a programming paradigm of software that uses statements that change a program's state. In much the same way that the imperative mood in natural languages expresses commands, an imperative program consists of commands for the computer to perform. Imperative programming focuses on describing how a program operates step by step, rather than on high-level descriptions of its expected results.

In software systems, encapsulation refers to the bundling of data with the mechanisms or methods that operate on the data. It may also refer to the limiting of direct access to some of that data, such as an object's components. Essentially, encapsulation prevents external code from being concerned with the internal workings of an object.

In computer programming, a reference is a value that enables a program to indirectly access a particular datum, such as a variable's value or a record, in the computer's memory or in some other storage device. The reference is said to refer to the datum, and accessing the datum is called dereferencing the reference. A reference is distinct from the datum itself.

Component Pascal is a programming language in the tradition of Niklaus Wirth's Pascal, Modula-2, Oberon and Oberon-2. It bears the name of the language Pascal and preserves its heritage, but is incompatible with Pascal. Instead, it is a minor variant and refinement of Oberon-2 with a more expressive type system and built-in string support. Component Pascal was originally named Oberon/L, and was designed and supported by a small ETH Zürich spin-off company named Oberon microsystems. They developed an integrated development environment (IDE) named BlackBox Component Builder. Since 2014, development and support has been taken over by a small group of volunteers. The first version of the IDE was released in 1994, as Oberon/F. At the time, it presented a novel approach to graphical user interface (GUI) construction based on editable forms, where fields and command buttons are linked to exported variables and executable procedures. This approach bears some similarity to the code-behind way used in Microsoft's .NET 3.0 to access code in Extensible Application Markup Language (XAML), which was released in 2008.

In computer science, a union is a value that may have any of multiple representations or formats within the same area of memory; that consists of a variable that may hold such a data structure. Some programming languages support a union type for such a data type. In other words, a union type specifies the permitted types that may be stored in its instances, e.g., float and integer. In contrast with a record, which could be defined to contain both a float and an integer; a union would hold only one at a time.

In computer science, a record is a composite data structure – a collection of fields, possibly of different data types, typically fixed in number and sequence.

The computer programming languages C and Pascal have similar times of origin, influences, and purposes. Both were used to design their own compilers early in their lifetimes. The original Pascal definition appeared in 1969 and a first compiler in 1970. The first version of C appeared in 1972.

A class in C++ is a user-defined type or data structure declared with any of the keywords class, struct or union that has data and functions as its members whose access is governed by the three access specifiers private, protected or public. By default access to members of a C++ class declared with the keyword class is private. The private members are not accessible outside the class; they can be accessed only through member functions of the class. The public members form an interface to the class and are accessible outside the class.

In computer programming, a variable is an abstract storage location paired with an associated symbolic name, which contains some known or unknown quantity of data or object referred to as a value; or in simpler terms, a variable is a named container for a particular set of bits or type of data. A variable can eventually be associated with or identified by a memory address. The variable name is the usual way to reference the stored value, in addition to referring to the variable itself, depending on the context. This separation of name and content allows the name to be used independently of the exact information it represents. The identifier in computer source code can be bound to a value during run time, and the value of the variable may thus change during the course of program execution.

In computer science, an opaque data type is a data type whose concrete data structure is not defined in an interface. This enforces information hiding, since its values can only be manipulated by calling subroutines that have access to the missing information. The concrete representation of the type is hidden from its users, and the visible implementation is incomplete. A data type whose representation is visible is called transparent. Opaque data types are frequently used to implement abstract data types.

<span class="mw-page-title-main">Object-oriented programming</span> Programming paradigm based on the concept of objects

Object-oriented programming (OOP) is a programming paradigm based on the concept of objects, which can contain data and code: data in the form of fields, and code in the form of procedures. In OOP, computer programs are designed by making them out of objects that interact with one another.

Leslie Blackett Wilson was chair of Computing Science at the University of Stirling, appointed on August, 1979. Previously, he was a Senior Lecturer in Computer Science at the Computing Laboratory of the University of Newcastle upon Tyne. He joined the Computing Laboratory in 1964. Before that, since 1951, he was a Senior Scientific Officer at the Naval Construction Research Establishment at Dunfermline.

This glossary of computer science is a list of definitions of terms and concepts used in computer science, its sub-disciplines, and related fields, including terms relevant to software, data science, and computer programming.

References

  1. Jensen, Kathleen; Wirth, Niklaus (1974). PASCAL User Manual and Report. Springer-Verlag. p. 42. ISBN   0-387-90144-2. [A] record is a structure consisting of a fixed number of components, called fields.
  2. Wilson, Leslie B.; Clark, Robert G. (2001). Comparative Programming Languages, Third Edition. Addison-Wesley. p. 169. ISBN   0-201-71012-9. Being able to structure data in this way is central to the construction of understandable programs.
  3. Wilson, Leslie B.; Clark, Robert G. (2001). Comparative Programming Languages, Third Edition. Addison-Wesley. p. 169. ISBN   0-201-71012-9.
  4. Jensen, Kathleen; Wirth, Niklaus (1974). PASCAL User Manual and Report. Springer-Verlag. p. 42. ISBN   0-387-90144-2.
  5. Stroustrup, Bjarne (2013). The C++ Programming Language, Fourth Edition. Addison-Wesley. p. 450. ISBN   978-0-321-56384-2.
  6. Wilson, Leslie B.; Clark, Robert G. (2001). Comparative Programming Languages, Third Edition. Addison-Wesley. p. 104. ISBN   0-201-71012-9.
  7. Wilson, Leslie B.; Clark, Robert G. (2001). Comparative Programming Languages, Third Edition. Addison-Wesley. p. 169. ISBN   0-201-71012-9. The original use of records was in languages like COBOL, where they were used to define the structure of records held in a file.
  8. Kernighan, Brian W.; Pike, Rob (1984). The UNIX Programming Environment. Prentice Hall. p. 207. ISBN   0-13-937699-2. The system call lseek provides a way to move around in a file without actually reading or writing.
  9. Date, C.J. (2005). Database in Depth. O'Reilly Media, Inc. p. 5. ISBN   0-596-10012-4. An n-ary relation can be pictured as a table with n columns; the columns in the picture correspond to attributes of the relation and the rows correspond to tuples.