A Guide to Different Data Types
(5 votes)
A data type is a characteristic of a datum in programming languages. It instructs the computer about the type of datum that it is. This entails setting limitations on the datum like the values that it can take and the operations that may be executed upon it. Some common data types are integers, alphanumeric strings and floating-point numbers or decimals. For instance, in the language of Java programming, the ‘int’ type signifies the order of 32-bit integers that range from -2, 147, 483, 648 to 2,147,483,647 in value. It also represents the operations that are performed on integers like multiplication, addition and subtraction.
In a wide sense, a particular data type represents a particular set of values as well as acceptable operations on the values. All programming languages evidently include data type, though different terminology is used by different languages. A data type may also be taken as a constraint describing interpretation, representation and structure of objects and values stored in the computer memory. A constraint is placed upon the reading of a data type in a data type system. Data type information is used by the type system to ensure correctness of computing programs that manipulate or access the data.     

Machine Data Types

All digital electronics based data type is represented in form of bits on the lowest level. A byte is a unit of bits representing the smallest group of data. A byte with a unit of eight bits is usually known as octet. A word is the unit of 32 to 64 bits that machine code instructions process. The word is usually interpreted as a binary number by most instructions. A word of 32 bits represents signed integer values from – 231 to 231 – 1 or unsigned integer values from 0 to 232 – 1. The machine and its language do not distinguish the signed data types from the unsigned data types.

Primitive Data Types

Primitive data types are different from composite data types in computer science. Primitive types are the data types that a programming language provides as fundamental building blocks. Primitive data types are also called basic types or built-in types. Whether primitive types correspond to objects in the memory of a computer depends on the implementation of the programming language. Operations with primitive data types are expected to be the fastest language constructs. With this sort of data type, you can perform integer addition as a single machine instruction. Modification of the capabilities of primitive data types by programs is not allowed by most languages. Smalltalk is an exception. It redefines the built-in operations to permit the extension of primitive data types within a program.   

Abstract Data Type

Abstract data type in computing is an order of a set of data along with a set of operations. Data type of this sort is abstract as it is free of several concrete implementations. It can be mathematical to define abstract data type. The creation of several ADT instances is supported by abstract data type of the first class. As an interface, abstract data type presents a constructor and various operations. The operations function to accept the abstract handle returned to new data by the constructor as an argument.  

Pointer and Reference Data Types

An object that contains information is termed as a reference in computer science. The information refers to the storage of data elsewhere. The reference data type does not the data itself. Dereferencing the value is accessing it that a reference refers to. Reference data types are elemental to the construction of many data structures, for example, linked lists.

Algebraic Data Types

In computing, algebraic data type is the data type whose values are data from data types of another sort. The data types of another sort are wrapped in one of the data type constructors. Any wrapped data is referred to as an argument to the constructor. Unwrapping of the constructor by using pattern matching is the only way for operation on the data.

A list having two constructors is a common algebraic data type - Nil used for an empty list and Cons for the combined form of a new element and a shorter list. Records and enumerated types are particular cases of algebraic data type. Records have constructor only one in number and enumerated types are many constructors without any argument. Algebraic data type a sort of composite type is a data type that is formed by combination of data types.

Algebraic data type is a sort of abstract data type. Using functions in the same module as that of the type can manipulate the values of data type of this sort. A discriminated union is the equivalent of algebraic data types in set theory. A discriminated union is a set elements of which comprise of a tag and an object with correspondence to the tag.              

Object Data Types

An object data type is an allocated area of storage in its simplest structure. Since variables are used to access objects by programming languages, the terms variable and object are often interchanged. There is no existence of an object data type without allocation of memory. An object contains either data or instructions in procedural programming. An object data type is supposed to be associated with the data as well as the instructions in an object-oriented programming.

The language is the base of how an object data type is formed. The creation of an object data type depends on an existing object data type in a prototype-based language for example, Java Script. The creation of an object data type as an instance of a class is accomplished in a class-based language for example, Java.

Function Data Types

Function data type refers to data type signature. The term type signature is used in computer programming. A data type signature signifies the inputs as well as outputs for a method or function. A type signature entails the function name along with the number of its parameters. It also signifies return type of the function or its parameter types in some of the programming languages.

Add as favourites (50) | Quote this article on your site

Be first to comment this article

Write Comment
  • Please keep the topic of messages relevant to the subject of the article.
  • Personal verbal attacks will be deleted.
  • Please don't use comments to plug your web site. Such material will be removed.
  • Just ensure to *Refresh* your browser for a new security code to be displayed prior to clicking on the 'Send' button.
  • Keep in mind that the above process only applies if you simply entered the wrong security code.
Name:
Title:
BBCode:Web AddressEmail AddressBold TextItalic TextUnderlined TextQuoteCodeOpen ListList ItemClose List
Comment:

Code:* Code

 
< Prev   Next >