Data Hierarchy and Types of Programming Languages
Tags: c, beginners, tutorial, programming
Published: 2021-07-29 05:50:36

### Data Hierarchy
Data items processed by computers form a data hierarchy that becomes larger and more complex in structure as we progress from the simplest data items (called “bits”) to richer ones, such as characters and fields.

**Bits**

The smallest data item in a computer can assume the value `0` or the value `1`. It’s called a bit (short for “binary digit”—a digit that can assume one of two values).
Remarkably, the impressive functions performed by computers involve only the
simplest manipulations of `0s` and `1s`—*examining a bit’s value, setting a bit’s value and reversing a bit’s value*.

**Characters**

It’s tedious for people to work with data in the low-level form of bits. Instead, they prefer to work with decimal digits (`0–9`), letters (`A–Z` and `a–z`), and special symbols (e.g., `$, @, %, &, *, (, ), –, +, ", :, ? and /`).<br/>
Digits, letters and special symbols are known as characters. The computer’s character set is the set of all the characters used to write programs and
represent data items. Computers process only 1s and 0s, so a computer’s character set represents every character as a pattern of `1s` and `0s`.

**Fields**

Just as characters are composed of bits, fields are composed of characters or bytes. A field is a group of characters or bytes that conveys meaning.<br/>
For example, a field consisting of uppercase and lowercase letters can be used to represent a person’s name, and a field consisting of decimal digits could represent a person’s age.

**Records**

Several related fields can be used to compose a record. In a payroll system, for example, the record for an employee might consist of the following fields. 
- Employee identification number (a whole number)
- Name (a string of characters)
- Address (a string of characters)
- Hourly pay rate (a number with a decimal point)

Thus, a record is a group of related fields.

**Files**

A file is a group of related records.

**Database**

A database is a collection of data organized for easy access and manipulation.<br/>
The most popular model is the relational database, in which data is stored in simple tables. A table includes records and fields.

---

### Types of Programming Languages
Programmers write instructions in various programming languages, some directly understandable by computers and others requiring intermediate translation steps. Hundreds of such languages are in use today. These may be divided into
three general types:

1. Machine languages
2. Assembly languages
3. High-level languages

**Machine Languages**

Any computer can directly understand only its own machine language, defined by its hardware design. *Machine languages* generally consist of strings of numbers (ultimately reduced to `1s` and `0s`) that instruct computers to perform their most elementary operations one at a time.<br/>
Machine languages are machine dependent (a particular machine language
can be used on only one type of computer). Such languages are cumbersome for humans.

**Assembly Languages and Assemblers**

Programming in machine language was simply too slow and tedious for most programmers. Instead of using the strings of numbers that computers could directly understand, programmers began using *English-like* abbreviations to represent elementary operations. These abbreviations formed the basis of *assembly languages*.<br/>
Translator programs called *assemblers* were developed to convert early *assembly language* programs to *machine language* at computer speeds.

**High-Level Languages and Compilers**

With the advent of assembly languages, computer usage increased rapidly, but programmers still had to use numerous instructions to accomplish even the simplest tasks. To speed the programming process, *high-level languages* were
developed in which single statements could be written to accomplish substantial tasks.<br/>
Translator programs called *compilers* convert *high-level language* programs into machine language.

**Interpreters**

Compiling a large *high-level language* program into machine language can take considerable computer time.<br/>
*Interpreter programs,* developed to execute *high-level language* programs directly, avoid the delay of compilation, although they run slower than compiled programs.