Closed snctfd closed 1 year ago
willing to provide PR if my suggested change seems good :)
I have also seen several students trying to use Pos.moved(...)
method to implement the KeyControl.direction
. I would agree that perhaps a small exercise encouraging the students to try and make a method call to Pos.moved()
without an instance of the class could help them question why this doesn't work and subsequently have a better understanding on how to approach the following question: KeyControl.direction
.
However, this might prompt the students to create a Pos instance in the KeyControl
class instead...
Great! I agree that there is need for exercises that highlight how to use immutable and mutable structures here and the difference between the companion object and a class instance. Good if you can come up with a small but efficient exercise sub-task that tries to maximize understanding, but does not deplete too much of the student's energy to take on yet another exercise... PR Welcome! @snctfd
PR created, feedback welcome! ^
merged! thnx!
I've noticed that students tend to make one common mistake in the exercises for w05; after implementing the
Pos
class, students tend to be "primed" to use thePos.moved
function when working on the implementation forKeyControl.direction
, despite the fact that this function returns(Int, Int)
. As a result, it's common for students to make the mistake of attempting to return e.g.Pos.moved(-1, 0)
for the "left" case, likely because they don't actually have an instance ofPos
to callmoved
on. This, of course, doesn't work. In previous years, I've also seen equivalent mistakes show up even later in the course.What I would recommend to fix this is to add a small part in 6a) that encourages the student to try writing
Pos.moved(1,2)
in the REPL, and to reflect over why it doesn't work.