Data structures

The key role of a computer program is to store and process data. Any computer software has a data model that defines what data will be collected and worked on. The data structure defines how the flow of data is controlled in relation to inputs, processes and outputs.

Ivo Jansch explains that data models are at the heart of all software

Data structures can have two main characteristics. Firstly they can be static or dynamic, and secondly they can be mutable or immutable.

  • A static structure is fixed in size but a dynamic structure can grow or shrink. An array is a static structure as its size is fixed. A list is a dynamic structure as its size can increase or decrease.
  • A mutable structure allows data to be edited, deleted or moved, but in an immutable structure data cannot be changed, it can only have more data added. An array is a mutable structure as its contents can be edited, deleted or moved. A string is an immutable structure as its contents cannot be changed without creating a new string.

Steve Furber explains why planning how a program is going to store data is an important part of making software

There are many different types of data structure. Arrays and records are important examples of data structures used in programming.

We will look at how arrays are used in programming.