Three strategies for Managing Time in Computer Software
In this course, we will be concentrating on three modes of representing time within our software programs:
Free-Running
This is the default way the computer executes code. In this mode, the computer is given a program which includes a set of instructions to be done in a particular order. While the sequence is important, the timing is not (outside of those elements of timing which the computer's hardware and operating systems require for the correct functioning of the computer). In this mode then, the computer executes the instructions as rapidly as possible within the parameters of the operating system and hardware with no regard for timing.
Responsive (Real-Time Interaction)
In this mode of operation the computer program waits for a message indicating some action has taken place external to the program. This action might have been initiated by the user of the program or by some external piece of software of harware. Upon receipt of this message the software interprets the message (this capability is usually included within the computer language itself - in Javascript this is done by something called an event-handler) and the computer software then responds in whatever manner it is programmed to do. This response may well be in one of the other two modes of timing we are describing here (either free-running, or articulated time).
Articulated Time
In this mode a piece of software is generating actions that are timed in a precise manner. Because the computer itself is largely a fancy clock, the only way in which it can measure and control the timing of events is with respect to this internal clock. The manner in which this is usually done within a computer program is to break the period of time which an action takes place within (say, the time needed to move an element from one side of a computer screen to the other) into a series of articulated smaller units of time. The computer program then divides the action to take place into a series of smaller actions (in this case, the motion of the visual element across the screen is divided into small incremental movements) which are executing sequentially precisely at each time increment. While computer software languages generally have these timing capabilities built into them, it is the programmers responsibility to understand how to write computer algorithms which break a process into discrete steps and have them executed sequentially over time.