Digital technologies 10

In this module we will consider some other aspects of the digital technologies subject - systems, algorithms, and programming.

Systems

Input - Process - OutputSystems thinking is a key idea in the Australian Curriculum: Technologies. As indicated in the diagram at right, at the simplest level systems comprise elements that deal with input, process, and output. All three are necessary for any system to be useful to us.

If there is no means of input then we cannot affect the system and it 'does its own thing' rather than respond to our needs or wants. If there is no process then logically whatever goes in comes out unchanged and that is unlikely to achieve anything useful to us. If there is no output then whatever goes in and is processed simply disappears and we gain no benefit.

Of course, most systems are more complex than those three simple boxes might seem to imply. Each of the elements will usually have multiple components that work together to achieve more than any of them could do alone. In the most general sense the components could include people and various devices. In the case of computer systems there are physical components (hardware) and the sets of instructions that determine what the other components do (software). Sometimes the people who work with computer systems and are part of the broader system are jokingly referred to as liveware.

Modern computer systems support a wide variety of input and output devices. Input devices may include keyboard, mouse, trackpad, touch screen, microphone, camera, scanner, and various sensors. Output devices may include display screen, projectors, ink jet printer, laser printer, 3D printer, and speakers. Which devices are present in any particular system will depend upon who will be using it and the purposes it is expected to serve. Familiar devices, such as keyboard, mouse, display, and printer, evolve over time, some devices become obsolete and new ones are introduced. Examining the design and selection of input and output devices to meet specific needs and wants would be a legitimate part of learning about digital technologies.

Closer examination of the input and output elements will reveal that they are often systems in their own right with their own input, process, and output elements. For example, a keyboard must take input in the form of a tap from a finger and convert it to electrical impulses representing characters that are then conveyed by wire, or wirelessly, to the computer where they are processed by other sub-systems. Similarly, a printer receives as input a stream of electrical pulses and converts that to output as a pattern of dots on a printed page.

Essential as input and output elements of computer systems are, it is the process element that has most effect on the outcomes. The power of computer systems depends on their being able to execute simple instructions very quickly. My first personal computer, purchased in 1979, had a processor running at 1 MHz and 48 kB of memory. My current home computer has a quad-core processor running at 2.7 GHz and 8 GB of memory. It is several thousand times faster than my first computer and can perform simple instructions much more quickly than I could hope to. Those instructions are extremely simple. At their most basic they may involve moving a single bit of data. What's more, despite the increased speed, computers remain very literal. They do exactly as they are instructed without any common sense interpretation. Somebody has to develop the software with all those instructions and ensure that they are correct.

Software development

Software development is an engineering process and is typically accomplished using design processes that are essentially similar to those described in Module 6. That will involve understanding the problem to be solved (a need or want), imagining possible solutions, selecting and planning a solution, building and testing, evaluating and improving. One of the fundamental strategies is decomposition, that is, breaking a problem into sub-problems. Where the sub-problems are the same as or similar to problems that have been solved previously then solutions can be reused or adapted.

Planning for software development can use a variety of methods depending on the nature of the problem, skills and preferences of the software engineers, or resources that are available. Two approaches that may be applied in the technology education classroom are storyboarding and flowcharting.

Storyboarding is a visual approach to planning that is often associated with dramatic performances or film making. It allows a high level overview of the process that is being planned and will typically include representations of how things will look at various stages. In the case of software that could assist with planning user interfaces and display of information as well as the flow from screen to screen. A storyboard may resemble a comic strip. Although storyboarding can be accomplished with pencil on sheets of paper there may be advantages to using cards that can be arranged in different sequences or software like PowerPoint that can simulate some of the actions such as clicking buttons in the user interface.

Flowcharting is also visual but represents the process rather than the look and feel of the product. It uses a specific set of symbols that have conventional meanings and can be used to plan the step-by-step detail of a process at various levels. It can be done using pencil and paper but the availability of templates for drawing the specific symbols will help and there is software that can be used.

Flowcharts eventually specify an algorithm for a process or computer program. An algorithm is a set of unambiguous rules for solving a problem in a finite number of steps. If, when it is converted to a computer programming language, an algorithm is going to be relied upon to deliver the intended result it must be clear and unambiguous and it must come to an end.

Programming languages

At the most basic level all data and instructions in digital computers must be represented in binary as 0s and 1s. The original computers had to be programmed by setting rows of switches up or down to represent the bits. Eventually computer programs were written to take instructions expressed in simple codes and assemble them into binary code for the computer. This was assembly language.

Other languages have been developed to take instructions expressed in language more easily understood by humans and translate them into a form that can be processed by the computer. Scratch is an example of a visual programming language that can express algorithms in a form that is intelligible to humans and translate the instructions for action by the computer.

There are many different computer languages that may be used for different purposes but, with few exceptions, most of them express the same basic algorithmic ideas. Once those ideas are grasped moving between languages is a matter of learning how those ideas are expressed in the specific programming language.

Algorithmic elements

The key algorithmic ideas of sequence, selection and iteration or repetition are presented here in flowchart form with examples in Scratch or JavaScript (a language commonly used for programming in webpages) where the constructs are available.

Sequence

Instructions are performed one after another.

Flowchart Scratch JavaScript
sequence Scratch sequence pos = pos + 50;
dir = dir + 90;
pos = pos + 50;
dir = dir + 90;

Selection

A choice between alternative instructions is made depending on the outcome of some test.

Flowchart Scratch JavaScript
simple selection Scratch simple selection

if (pos > 100) {
   dir = 90;
}

Flowchart Scratch JavaScript
binary selection Scratch binary selection if (pos > 100) {
   dir = 90;
} else {
   dir = 270;
}
Flowchart Scratch JavaScript
multiple selection n/a switch(colour) {
  case 1:
    dir = 90;
    break;
  case 2:
    dir = 180;
    break;
  case 3:
    dir = 270;
    break;
  default:
    dir = 0;
}

Iteration or repetition

The algorithm repeats one or more steps a specific number of times or while some condition applies.

Flowchart Scratch JavaScript
Definite iteration/repetition Scratch definite repetition for (i = 0; i < 4; i++) {
   pos = pos + 50;
   dir = dir + 90;
}
Flowchart Scratch JavaScript
pre-test iteration Scratch pre-test iteration i = 0;
while (i < 4){
  pos = pos + 50;
  dir = dir + 50;
  i = i + 1;
}
Flowchart Scratch JavaScript
post=test iteration n/a i = 0;
do {
  pos = pos + 50;
  dir = dir + 50;
  i = i + 1;
} while (i < 4);

Managing software development

Planning algorithms and converting them to code in a suitable language is a large part of the work of software development but it is not the entire story. It is necessary to consider what data will be required and how it will be represented in the system. It is also necessary to plan for user interaction with the software and develop any graphic elements that may be required for display. All of these components may be addressed in the technology classroom and will contribute to learning in the curriculum key idea of project management.

Like other engineering processes, software development seldom has a single correct solution. There are likely to be multiple possible solutions from which one must be selected, developed and tested for suitability. If it is not suitable then another alternative might be tried.

An agile approach to software development differs from the traditional waterfall approach of first developing a tight specification and then developing and delivering a completed solution. In an agile approach components may be built and tested rapidly so that any failure occurs early and can be learned from before large amounts of time and effort have been committed to an unsuitable solution.

A systematic approach is necessary. Even before any code is written it is important to test algorithms using sample data to ensure that they perform as expected. This process is known as desk checking. Necessary tasks and their sequence should be documented together with details of data structures, and the names of variables, files and media assets.

Because any technology solution, including software, is developed in response to human needs and wants it is important that software development include consideration of the user. Understanding of human factors such as limits on working memory, colour vision, manual dexterity and more should inform design of user interfaces. Solutions that are found to work in one project should be considered for transfer to future projects as part of maintaining consistency in user experience.

Alternatives to coding

There may be occasions when limited access to resources or lack of prior knowledge and skills requires alternatives to coding in the the technology classroom. Alternatives that might be considered include: