User Tools

Site Tools


plato:tutor:databases

Manipulating Data Bases

In this chapter we will discuss the tools available in TUTOR for creating and using “data bases” (small or large blocks of data such as test scores, population statistics, map coordinates, etc.). In the process of discussing these tools we will also learn more about the internal workings of the PLATO system.

The -common- Command

The “student variables” vl through v150 are associated with the individual student. It is possible to use “common variables” which are common to all those students studying a particular lesson. These common variables can be used to send messages from one student to another, to hold a bank of data used by all the students, to accumulate statistics on student use of the lesson, to contain test items in a compact, standardized form, etc.

As a first example of the use of the -common- command, let's count the number of students who have entered our lesson. We will also count how many of these students are female:

common 2 $$ two common variables define total-vc1,females=vc2 unit ask calc total⇐total+1 at 1215 write Are you a female? arrow 1415 answer yes calc females⇐females+1 answer no no write Yes or no, please! endarrow at 1615 write There are ⊀s,total⊁ students, of whom ⊀s,females⊁ are female.

The -common- command tells TUTOR to set up two common variables, vcl and vc2, which we have defined as “total” and “females”. These common variables are automatically initialized to zero before the first student enters this lesson. The first student increments “total” to one (“calc total⇐total+1”) and may also increment “females”. The second student to enter the lesson causes “total” to increase to two and may also change “females”. Each student is shown the present values of “total” and “females”, which depend on what other students are doing. We must use common variables vcl and vc2 rather than the student variables vl and v2 because the student variables cannot be directly affected by actions of other students. Another way to see this is to point out that when there are five students in this lesson, they share a single vcl and a single vc2, whereas they each have their own vl and their own v2: there are five v1's and five v2's but only one vcl and vc2.

Integer common variables are ncl, nc2, etc., and indexed common variables are written as vc(index) or nc(index).

The statement “common 2” tells TUTOR to associate a two-word set of common variables with this lesson. For reference purposes, it is good style to place the -common- command near the beginning of the lesson. There can be only one -common- statement in a lesson. Like -define-, -vocab-, and -list-, the -common- command is not executed for each student. Rather, when TUTOR is preparing the lesson for the first student who has requested it, a set of common variables is associated with the lesson and all these common variables are initialized to zero. Additional students entering the lesson merely share the common variables previously set up.

Suppose a class of fourteen students uses our lesson from 10 a.m. to 11 a.m. The fourteenth student comes at 10:05 and gets a message on the screen saying “There are 14 students, of whom 8 are female”. As long as the lesson is in active use, each new student who enters the lesson increases “total” (vcl). However, when all the students leave at 11:00, the lesson is no longer in active use and will eventually be removed from active status to make room for other lessons. When another class comes at 3:00 p.m., the lesson is not in active use and TUTOR must respond to the first student's request for the lesson by preparing the lesson for active use. In the preparation process the statement “common 2” tells TUTOR to set up two common variables and initialize them to zero. The first student to enter the lesson at 3:00 is told “There are 1 students, of whom 1 are female”. She is not told “There are 15 students, of whom 9 are female”, despite the fact that the previous student (at 10:05 that morning) had been told there were 14 students, 8 female. The “common 2” statement will cause the common variables to be zeroed every time the lesson is prepared for active use.

The type of common which is set up by the statement “common 2” is called a “temporary common”. It lasts only as long as the lesson is in active use, and its contents are initialized to zero whenever the lesson is moved from inactive to active status. Temporary common can be used for such things as telling the students how many students are present, what their names are, and whether a student at another terminal who has finished a particular section of the lesson is willing to help a student who is having difficulties. Messages can be sent from one student to another through a temporary common by storing the message in the common area with an identifying number, so that the appropriate student can pick up the message and see it with a -showa-. The lesson simply checks occasionally for the presence of a message.

When,a student signs out you usually want to change the temporary common in some way. For example, if you are keeping a count of the number of students presently using the lesson, you increase the count by one when a student signs in and you decrease the count by one when the student leaves. The -finish- command lets you define a unit to be executed when the student presses shift-STOP to sign out:

finish decrease . . . unit decrease calc count=count-1

In this case unit “decrease” will be done each time a student signs out. Normally the -finish- command should be put in the “ieu”. As with -imain-, the pointer set by the -finish- command is not cleared at each new main unit. A later -finish- command overrides an earlier one, and “finish q” or a blank -finish- statement will clear the pointer. Like all unit pointer commands, -finish- can be conditional. Only a limited amount of processing is permitted in a -finish- unit to insure that the student can sign out promptly.

We can keep a permanent, on-going count of students who enter the lesson by using a “permanent common”. Instead of writing “common 2”, we write “common italian,counts,2”, where “italian” is the name of a permanent lesson storage space and “counts” is the name of a common block stored there. This is the same format used for character sets (the -charset- command) and micro tables (the -micro- command). When the common block is first set up in the lesson space, its variables are initialized to zero. Let's suppose that the fourteen students who come in at 10:00 a.m. are the very first students ever to use our lesson. The statement “common italian,counts,2” will cause TUTOR to fetch this (zeroed) common block from permanent storage. As before, the fourteenth student arrives at 10:05 and is told “There are 14 students, of whom 8 are female”. At 11:00 a.m. these students leave and our lesson is no longer in active use. At some point, room is needed for other active lessons (and commons), at which point our permanent common, with its numerical contents of 14 (students) and 8 (females) is sent back to permanent storage. At 3:00 p.m. the first student (a female) of the afternoon class causes TUTOR to prepare the lesson and retrieve the permanent common from permanent storage without initializing the common variables to zero. The result is that she gets the message “There are 15 students, of whom 9 are female”. (There is an -initial- command which can be used to define a unit to be executed when the first student references the common. This makes it possible to perform initializations on a permanent common.)

The key feature of permanent common is that it is retrieved from storage when needed and returned in its altered state to permanent storage when the associated lesson is no longer active. In our case, we could enter the lesson months after its initial use and see the total number of students who have entered the lesson during those months. Other uses of permanent common include the storage of data bases accessed by the students, such as census data ic a sociology course or cumulative statistical data on student performance in the course.

The Swapping Process

plato/tutor/databases.txt · Last modified: 2023/08/05 18:55 by Site Administrator