Comment to chapter 16
p. 151
- Typo in the text “Using such helper methods we defined the method hasSelectContract as follows” – should be hasSelectContact.
- Bugs in the code “CmAddContactCommand >> initialize, CmAddContactCommand >> execute” – should be EgAddContactCommand.
- Bugs in the code “self basicName: 'New contact'; basicDescription: …” – should be “self name: 'New contact'; description:”
pp. 151, 146. A problem with the CmAddContactCommand >> execute tanks to the EgContactBookPresenter >> newContact. The last method uses self request:initialAnswer:title: to get a user answer. Any user can cancel an addition dialog, on this the request:initialAnswer:title: method throws a SpCancelledInteractionError exception. This is quite strange because every user has the right to cancel dialog! Despite this, have we to catch the exception in the EgContactBookPresenter >> newContact? By the way, EgContactBookPresenter >> newPhone has the same problem.
p. 152
- Uncertainty “EgContactBookPresenter >> updateView table items: contactBook contacts” – either contents or contacts.
- Proposition “EgRemoveContactCommand >> execute self contactBook removeContact: self selectedContact. self contactBookPresenter updateView” – just removes a contact quickly, but as usual a remove action needs some confirmation. Would you like to define the method as follows:
EgRemoveContactCommand >> execute
(self contactBookPresenter
confirm: 'Do you want to remove ' , self selectedContact name , '?'
label: 'Confirm please') ifFalse: [ ^ self ].
self contactBook removeContact: self selectedContact.
self contactBookPresenter updateView
p. 153 Typo “This is what what we do with the new line in the initializePresenters method.” – should remove the second what.
p. 156 Needless variable “EgContactBookCommand << #EgChangePhoneCommand slots: { #newPhone}; package: 'EgContactBook-Extensions'” – the variable newPhone and the accessors are needless and never used.
p. 158 Typos
- “and we should specialize the method aSpecCommand as follows:” – $s missing, should be asSpecCommand.
- Second code snippet “EgRemoveContactCommand >> asSpecCommand” should be “EgAddContactCommand >> asSpecCommand”.
p. 160 EgPrintContactCommand >> execute
- “self contactBook contacts do:” – either contents or contacts.
- “self traceCr: contact name , ' - ' , contact name” – should be contact phone (second time).
p. 161 EgContactBookPresenter class >> defaultSpec
- the method should be EgContactBookPresenter >> defaultLayout
- “constraints height: self toolbarHeight” – a SpBoxLayout does not understand toolbarHeight! May be “constraints height: SpAbstractPresenter toolbarHeight”
pp. 161, 163 There are two Conclusion subsections.