Skip to content

SLG Task Types

wolfSarah edited this page Jun 15, 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.

Each Task class has a method isValid, which is called in verifyAnswer. This method takes the User-Input, that was passed from an instance of TaskView and returns true, if the User-Input is valid for this Task Type or false, if its not. If the Input is not valid and specific Error-Message is shown.

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
  • User-Input is valid, if at least one option was chosen

Creation

General:

task := SLGMultipleChoiceTask 
newMultipleChoiceWithQuestion: aString
withCode: 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?'
withCode: 'x := 2'
withOptions: #('2' '3' '5') 
withAnswers: #(true false 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
  • User-Input is valid, if an option was chosen

Creation

Example:

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

Appearance

image

Cloze

(In German: "Lückentext")

  • is not case-sensitive and ignores multiple spaces

Additional Parameter

  • cloze: a Text with gaps (String)
  • User-Input is valid, if the gap was filled

Creation

General:

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

Example:

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

Appearance

image

Drag-and-Drop

  • correctAnswer gets shuffled and then displayed as items in the shuffled order
  • uses the classes AnswerSlotMorph and DraggableItemMorph
  • each target (answer slot) has a label
  • each item has a label
  • labels are used for comparison
  • User-Input is valid, if each item is placed on a target (not fully implemented yet)

Creation

General:

task := SLGDragAndDropTask
newWithQuestion: aString
withCode: aString
withCorrectAnswer: Array of Strings.
ui := SLGDragAndDropView newWithTask: task

Example:

task := SLGDragAndDropTask
newWithQuestion: 'Assign 5 to x'
withCode: ''
withCorrectAnswer: #('x' ':' '=' '5').
ui := SLGDragAndDropView newWithTask: task

Appearance

image