Skip to content

SLG Task Types

Xiaoshi Liu edited this page Jun 12, 2024 · 7 revisions

There are 4 different Task Types a lesson can consist of.

Each Task Type is split into Task and View. The Task-Class handles all of the Logic behind a Task Type, while the View-Class takes care of how to display a certain Task-Type.

Each Task-Type has

Instance Variable Location Purpose
taskDescription TaskView class side Telling User what to do
question Task instance side Optional Additional Information or instruction for the task
code Task instance side Optional Additional code for the task
status TaskView instance side Success or Failure
correctAnswer Task instance side object which will be compared with Userinput to verify the correctness of the Input, different type of Object for each Task-Type

The first four parts have fixed positions on the TaskView Morph. As well as the Submit-Button that is created in TaskView.

When the Submit-Button is pressed, it calls verifyAnswer on the TaskView Instance, which then prepares all necessary information and passes it to the Task Instance, which actually verifies the information.

Instance Variables in TaskView classes, that just store information that came from corresponding Task class have the prefix task.

To create a Task, create an Instance of Task-Class first and then create an Instance of corresponding View-Class with Task-Class Instance as a parameter.

Base Choice

  • Base Choice is the parent for MultipleChoice and SingleChoice
  • it contains everything to create a Multiple Choice like task
  • has an instance variable on the class side isSingleChoice
  • has a method resetToggleButtons that is called, when an isSingleChoice returns true

Additional Parameter

  • answerOptions: options from which the User can choose (Array)

Multiple Choice

  • inherits from BaseChoice
  • in addition to Base Choice this type also prints a percentage, when answers are submitted
  • isSingleChoice returns false

Creation

General:

task := SLGMultipleChoiceTask 
newMultipleChoiceWithQuestion: aString
withOptions: Array of Strings
withAnswers: Array of Boolean (true for correct option, false for wrong option).
ui := SLGMultipleChoiceUI newMultipleChoiceUIwithTask: task

Example:

task := SLGMultipleChoiceTask 
newMultipleChoiceWithQuestion: 'Do you really like Squeak?'
withOptions: #('Yes' 'No' 'Maybe') 
withAnswers: #(true true false).
ui := SLGMultipleChoiceUI newMultipleChoiceUIwithTask: task

Appearance

image

Single Choice

  • inherits from BaseChoice
  • lets the User only choose from one option
  • isSingleChoice returns true
  • can easily be used to create True-And-False-Questions

Creation

Example:

task := SLGSingleChoiceTask
newSingleChoiceWithQuestion: 'Do you like Squeak?'
withOptions: #('Yes' 'No' 'Maybe')
withAnswers: #(true false false).
ui := SLGSingleChoiceUI newSingleChoiceUIwithTask: task

Appearance

image

Cloze

(In German: "Lückentext")

Additional Parameter

  • cloze: a Text with gaps (String)

Creation

General:

task := SLGClozeTask
newClozeWithQuestion: aString
withCloze: aString containg 'xx'
withAnswer: aString that replaces 'xx' with the actual answer.
ui := SLGClozeUI newClozeUIwithTask: task

Example:

task := SLGClozeTask
newClozeWithQuestion: ''
withCloze: 'Everything in Squeak is a xx.'
withAnswer: 'Everything in Squeak is a Morph.'.
ui := SLGClozeUI newClozeUIwithTask: task

Appearance

image

Drag-and-Drop

In progress

Clone this wiki locally