Closed koendehondt closed 5 months ago
In section "Using transmissions" there is a question from Stéphane. I think this section is too short for such an important feature.
The section is short because we have a dedicated chapter on transmissions.
The question from @Ducasse was:
""Esteban"" I do not understand why this is not working. I get an error with the ports. ""Enzo"" I think the error comes from the fact
setModel:
is called when the presenter is initialized and so there is no selection, thus a nil parameter. I managed to deal with it by adding a nil guard clause insetModel:
but I wonder if we could make a "default selection" that would be the first film so that the presenter starts with a film to display details.
Making a default selection would maybe solve the problem in the example code, but it is not a general-purpose solution for the problem. When setting a model of a presenter, the presenter has to cover a possible nil
value. I think that is important to state in the book.
So in my opnion, based on building a lot of UIs, the method setModel
was implemented incorrectly because it did not take into account that the argument aFilm
could be nil
. I changed that method and now the code with the transmission works as expected. I added a few sentences to the text to explain why checking for nil
is important.
Your analysis is correct!
Open issues from https://github.com/SquareBracketAssociates/BuildingApplicationWithSpec2/pull/52:
Shouldn't the section "An application manages icons" have an example?(No)Figure "Better window" has a button "Save", but it has to be "Save Film".(Not applicable anymore due to the next item).In section "Adding more tests" probably there is a mistake in the last assert, which asserts on "name", while name has not been bound to another object since the previous assert.(There was no mistake)