Can event handler within function count as an abstraction?


#1

I have a student that is working on the Create task and created a function that includes an onEvent handler. It says in the Survival Guide to avoid using event handlers since they are not student-developed abstractions, but what if the event handler is part of a larger student developed function?


#2

An event handler should never be put inside a function. The eventhandler is triggered (called) each time the event occurs. Here is a link to some more discussion on event handlers.


#3

That makes sense - thank you!


#4

So is it accurate advice to say to students that their Create Task can have onEvent as long as they don’t claim it as their “student created” abstraction/algorithm or should OnEvent not appear in the code anywhere?


#5

The former. onEvent can’t be the abstraction. The litmus test is: is it a named function that the student wrote. What the reader is looking for is - did the student have an insight to develop an abstraction (i.e. function) because it was something that could be reused, or because it helped manage the complexity of the task.

If you look to the exemplars of the color sleuth project in Unit 5 Lesson 10 you’ll see some examples and commentary about this.

Also, if you haven’t, you should really check out the Create PT survival guide. In the Create PT prep mini-unit which has a lot of student-facing guidance and activities around this very subject.