BuildingApplicationWithSpec2 icon indicating copy to clipboard operation
BuildingApplicationWithSpec2 copied to clipboard

Comment to chapter 18 - Todo extracted Chapter

Open LNUitTutor opened this issue 2 years ago • 0 comments

p. 178 “TodoTask class >> tasks ^ tasks ifNil: [ tasks := OrderedCollection new ]” – why an OrderedCollection? Why not a Set? The method TodoTask class >> addTask: aTask checks (tasks includes: aTask) to ensure uniqueness of a task.

p. 179

  • “TodoTask new title: 'Task One'; save. TodoTask new title: 'Task Two'; save.” does not work because tasks is nil. We need to perform “TodoTask tasks” first.
  • “Compiled programs have like C have main()” – too much have
  • “TodoListPresenter >> initializePresenters todoListPresenter := self newTable …” – todoListPresenter is undeclared. We have to add slots: { #todoListPresenter } to the code snippet above.

p. 181

  • “TodoApplication >> start TodoListPresenter open” – new missing. It should be “start TodoListPresenter new open”. But is it a right way to connect the presenter with the application? May be “(self newPresenter: TodoListPresenter) open” would be better?
  • “initializeWindow: aWindowPresenter” should be “TodoListPresenter >> initializeWindow: aWindowPresenter”

p. 184

  • “TodoTaskPresenter >>accept self task title: titlePresenter text; save” – self is needless, should be removed.
  • Question about responsibility. TodoTaskPresenter is a helper dialog. Its duty is to get data from a user and to create (may be) an instance of TodoTask. Why does it save the task? Why does it change the data model? Is it a right responsibility for a helper dialog?

p. 186 Question. TodoListPresenter >> addTask method opens new TodoTaskPresenter dialog with the prompt 'Please give me a title'. Is it possible to open the dialog with the prompt selected? It is quite noising to select the text every time.

p. 187 “TodoListPresenter >> defaultLayout ^ SpBoxLayout newTopToBottom spacing: 5; … add: (SpBoxLayout newLeftToRight addLast: addButton expand: false; yourself)” – addButton is undeclared. p. 188 “addButton := self newButton” – addButton is undeclared.

p. 189

  • TodoListPresenter >> todoListContextMenu ^ self newMenu …” commands of the menu work on an empty row of the table.
  • Logical error: TodoListPresenter >> editSelectedTask opens TodoTaskPresenter with 'New task' at the caption. How can I change it by 'Edit task'?
  • Error: “TodoListPresenter >> removeSelectedTask todoListPresenter selection selectedItem remove.” – should be delete. How about some confirmation?

Figures 18-4, 18-5 do not contain the row with “Title” at the top of the table.

LNUitTutor avatar Aug 20 '23 13:08 LNUitTutor