The Open UniversitySkip to content
 
Skip My preferences

My preferences

Skip Learning ToolsSkip Rate and Review

Rate and Review

Skip Alternative FormatsSkip TagsSkip Share this unit with a friend

Share this unit with a friend

Help with sending a link to this unit (new window)
Permalink to this unit:
 

Topic outline

 

  • Time: 14 hours
    Level: Intermediate

 
 

Introduction

  • Introduction Resource
  • This unit provides an introduction to data and processes in software, and provides a basis that enables these fundamental ideas to be developed in a clear and precise way. It has two main aims. The first...
 

Key ideas

  • Key ideas Resource
  • In this unit, we will take an introductory look at two key ideas: forms of data handled by a software system, and the processes that may be applied to that data. These ideas are illustrated by a particular...
 

1 At the supermarket

 

2 Forms of data

  • 2.1 Numbers Resource
  • The supermarket example discussed in Section 1 involves various forms of data that a computer may need to handle. Some of these, such as numbers and characters, are simple but fundamental. Other forms...
  • 2.2 Characters Resource
  • Characters are another fundamental form of data. Computers store characters as integers, and system hardware and software translate these integer codes so that monitors and printers can display them.
  • 2.3 Truth values Resource
  • We will want to distinguish between statements that are true and statements that are false. Another fundamental form of data allows us to do this. This form of data consists of just two values, which we...
  • 2.4 Sets Resource
  • A set is a collection of items, and is a collection of a particular form. The items appearing in a set are referred to as the elements (or members) of the set. Examples of sets mentioned earlier are: Int,...
  • 2.5 Sequences Resource
  • You have already met sequences briefly, and have seen that a sequence contains items given in a particular order, and that repetitions are of significance.
  • 2.6 Associations: tuples and Cartesian products Resource
  • Consider an item of shopping that is weighed at the supermarket checkout, such as 335 grams of walnuts. This item of shopping has two features: the type of item purchased (walnuts), and the weight of that...
  • Objectives for Section 2 Resource
  • After studying this section you should be able to do the following.
  • Exercises on Section 2 Resource
  • Let A be the set of integers between 100 and 999 inclusive.
 

3 Combining forms of data

  • Structuring data Resource
  • In Section 2, we considered integers, characters and truth values. We shall refer to these as primitive forms of data. We also looked at two forms of data collection, sets and sequences, and at the association...
  • 3.1 Sets of sets Resource
  • In Section 2, all the sets and sequences we considered had primitive forms of data as their elements. However, sets and sequences may contain non-primitive forms of data. Let us look first at a situation...
  • 3.2 Combining data structures Resource
  • In Section 2, we introduced the notation SeqOfX for the set of all sequences whose members come from the set X. In Section 2, we looked only at sequences whose members were of one of the primitive forms...
  • 3.3 Mixing different forms of data: disjoint union of sets Resource
  • At the supermarket checkout, some items need to be weighed (organic courgettes for example) and some do not. Let BarcodedItems be the set of items that do not need to be weighed, and WeighedItems be the...
  • 3.4 Representing data in applications Resource
  • Suppose that you are designing software for some application. You will be working with a programming language that enables you to communicate instructions to a computer. In this programming language, certain...
  • Objectives for Section 3 Resource
  • After studying this section you should be able to do the following.
  • Exercises on Section 3 Resource
  • Each of (a)–(c) is a member of one of the sets given in (i)–(iii). Say which item comes from which set.
 

4 Processes

 

5 Operations and comparisons

  • Seeing processes as functions Resource
  • Addition of numbers is a process that one would expect a computer to be able to perform. Now we write the result of adding the numbers 5 and 2 as 5 + 2, for example. The symbol +, which represents the...
  • 5.1 Arithmetic operations Resource
  • Processes such as addition of numbers are called binary operations. (The word “binary” here reflects the fact that a binary operation combines two data items.) A binary operation is a particular form of...
  • 5.2 Operations on Boolean values Resource
  • The idea of a binary operation, and the use of infix notation, is not confined to numbers. Infix notation may be used for any process with two inputs from the same set. We look now at two binary operations...
  • 5.3 Comparison functions Resource
  • Another situation where we use infix notation is in writing comparisons, such as x
  • 5.4 Expressions Resource
  • In computer code, one may want to formulate an expression to achieve some particular purpose, such as to express some condition about the states of variables involved in the code. For example, suppose...
  • Objectives for Section 5 Resource
  • After studying this section you should be able to do the following.
  • Exercises on Section 5 Resource
  • Give a full description of a function (using the infix notation ×) corresponding to multiplication of integers.
 

Summary

  • Summary Resource
  • We discussed forms of data and processes relevant to an electronic till in a supermarket. In particular, we introduced the idea of a sequence of data items.
 

References and Acknowledgements

Skip Log inSkip Related educational resources