Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
I've been watching (studying) this forum since I've started my assignment - about
an year ago. Now that I've passed the certification and I think the least I can do is to
share my story.
My assignment was the URLyBird 1.2.1 which I'm considering now and easy task as the
DB interface version allows doesn't complicate the network design - the corner stone
of the whole application.
Thinking back, the best way to start working on the application is to study very carefully
the core j2eepatterns: http://www.corej2eepatterns.com/catalog.htm. This will allow
to architect the application, starting with the DB
interface from the assignment the other classes and their relations are easy to find.
In my case, I started to see resemblance and use this architecture when I've completed
almost 50% - now I know better .
- Networking: choose RMI since I thought this is adequate to my solution: less classes to implement,
the application addresses to a relative small number of user so it doesn’t require high throughput and
it can be reused within a more complex solution like a web application. Create a simple business layer
(only two methods) in order to unify the access to the two data sources: remote and local file.
- Locking: implement my own locking manager which uses to synchronize threads the plane old object monitor.
Here, I thought that it doesn’t make sense to use the more complex java concurrent APIs and decide to implement
my own lock object.
- Data: choose to decouple the Data interface from the storage dependent code, to implement record caching,
reuse deleted records and use dynamic data base schema load and adapt it to the know predefined schema using
field name binding.
- UI: here I’ve separated the application context (connection settings, internal settings and connection object)
from the UI - create two different classes. Use MVC to show the records into the table viewer: create the table
model class and the controller to handle the RMI calls and process the results. I’ve invested a lot of time in the
UI in order to very look professional (simple and intuitive): main meniu, status bar, tool tips, shortcut keys for
every input control or action, input verifiers, error & info & warning messages, use a tool bar, record filters,
align&resize controls accordingly and others.
- Comments & JavaDoc & formatting: I’ve commented (and extra commented if it was necessary) every
important block of code especially the locking mechanism - actually there were more comment lines
than actual code lines ).
Add JavaDoc comments for every field/method/class of any kind. Some extra time I’ve spend trying
to format the code and apply strictly every coding style rule.
- Docs: The user guide is a plain text file and contains besides the normal application descriptions
some required items: search examples, shortcut key table and a long list of FAQs. The choices doc is
quite big, about ~35KB, and contains every medium to high important design choice. To help the reviewer
to read and comprehend the decisions I’ve made I’ve carefully formatted document: spaces, new lines,
bullets and added references within the code - within comments eg. //[section.2.2].
Since I’m not a native English speaker I’ve spend a lot of time wording the phrases
so they made sense - a great help was the translate.google web tool.
- Design patterns/methods: MVC, abstract factory, factory method, template method, lazy initialization,
adapter, decorator, facade and iterator.
- Testing: another considerable time I’ve spend developing tests for each class and verify the
functionality of locking mechanism, data access, business layer (locally only the client and the
remote both server and client) like: searching, record locking, . I recommend using unit testing in
order to find difficult to find problems and test the functionality after a big update. To be sure nothing
escapes I’ve run the tests in both Windows and Linux. In the end testing gives you the confidence that
every thing will go as expected on the evaluator's computer.
- ANT: build (application, testing, javadoc) & package the submission
- JUnit: testing
- Checkstyle: to format the java code
- CVS: well you know why...
I’ve submitted the assignment after I’ve “failed” the essay exam - yes I’ve also got an
0% answered questions. After four and half weeks I’ve received the great news.