582334 TDD-ohjelmointimenetelmä ja koodin suunnittelu (5 op), syksy 2009
582334 TDD programming technique and designing code (5 cr), autumn 2009

Kurssiesittely Luennot Harjoitukset

Exercise 5: AddressBook #2 (GUI+TDD). Extract Class.

AddressBook project work

See the instructions in the previous exercise.

Homework

max 7 points

  1. Refactor this project's class net.orfjackal.weenyconsole.CommandExecuter so that you extract its innerclass Possibility to be its own top-level class, and move into it all methods which fit there best. In other words, do the Extract Class refactoring. Print a couple of steps and the final result of your refactoring on paper so that the exercise would be easier to discuss at the exercise group.

    1 point: The innerclass has been extracted to be its own top-level class. All tests pass.
    2 points: Also into the extracted class has been moved the methods which fit there best. All tests pass.
    3 points: Also the code has been refactored as clean as possible. All tests pass.

  2. AddressBook #2: Implement a graphical user interface using TDD and the Passive View design pattern. The program must be fully working, so that it is possible to add, modify and search the addressbook's contacts through its user interface.

    Tips: Especially if you are not familiar with the GUI library (Swing), it may be the easiest to implement the GUI first, after which it will be easier to see what kind of interfaces should be made between the view and controller. The view's test double might be best written manually, without using a mock object library, because the view and controller communicate very tightly and the mock object configuration would become very large. In Java it's possible to listen for changes to a text field, one character at a time, by using the JTextField.getDocument().addDocumentListener() method. It may be useful in implementing the search. An editable table, which shows the addressbook's contacts, is the easiest to implement using the JTable component.

    1 point: Passive View's controller is partially done. All tests pass.
    2 points: Passive View's controller is completely done. All tests pass.
    3 points: The graphical user interface is partially done. All tests pass.
    4 points: The graphical user interface is completely done. All tests pass.

In the exercise group we will discuss extracting classes, and get acquainted with the legacy code that will be modified in the next exercise.


Viimeksi muokattu 01.12.2010 21:04 Copyright © 2009 Esko Luontola