Open DaniD3v opened 2 weeks ago
It's also a good idea to write tests in the reference instead of providing an example output.
running
wl-paste > /tmp/reference
dotnet run > /tmp/own
diff /tmp/own /tmp/reference
every single compile-run-debug cycle can get bothersome
in
01 Types/04_Collections.md
Übung 1 you provide a reference output:with the following main method:
this means that
SchoolClass.Add
needs to callStudent.ChangeClass
.Student.ChangeClass
expects the student to be added to the class as well. This means we need to callSchooClass.Add
from this method.This results in infinite recursion. Without a
RawAdd
method or a public setter this is impossible to prevent. This behavior is also nonsensical becauseStudent.ChangeClass
does not except classes of valuenull
soSchoolClass.Remove
can't reset the students class.I suggest to either
SchoolClass.Add
to change the class on the student orStudent.ChangeClass
to accept null values and make it not necessary to add the student to the class.This behavior should also be documented!
This excercise is pretty bad anyways because in multi threading having circular references like this can result in funky behavior and wouldn't even be possible in e.g. rust.