Home > Archive > Extreme Programming > July 2006 > Unit Testing, CRC Cards and MVC
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Unit Testing, CRC Cards and MVC
|
|
| Psychie 2006-07-14, 6:57 pm |
| Hi there,
I am new to this group and XP (just a few months) so please forgive me
if my questions are amateur-ish. I am mainly a PHP developer and am
trying to incorporate XP practices into my work so I can have more
order in my life and become more productive. I also love the ideas of
XP. However, I seem to spend 97% of my time reading about XP and design
principals such as N-tier, MVC etc.. and so have become less
productive, but I suppose I need to take one step back to go two steps
forward.
At present I am using the MVC design pattern for my projects. I started
out with User Story cards and tried to write Unit Tests and program
code directly from there. I have no problem writing tests for Models
but can't seem to get my head around testing controllers. Could anyone
enlighten me in this area?
Also, I've decided to flesh out my design again using CRC cards. With
MVC I typically have a Model, View and Controller for every table in
the database. So in an on-line shopping system I have, for example, a
table for stock and a table for sales. The first CRC card I wrote was
for 'Stock' (mainly because this is the part of the project I am at
now). The responsibilities are along the lines of 'setPrice',
'getStockLevels', 'incrementStock', etc...
Then I went to think of a list of collaborators and the first one that
came to mind was a 'Checkout'. However, checkout is already an *action*
in my Sales controller. My 'Basket' has a controller of it's own and it
seems to make sense that a 'Stock' object would collaborate with a
'Basket' object. It isn't too intuitive that a 'Stock' object would
collaborate with 'Sale' over a 'Checkout' (or rather it seems more
intuitive that a 'Stock' object would collaborate with 'Checkout' over
a 'Sale'). Am I missing something here?
I guess my question is, if using MVC (and therefore basing your objects
on the database tables) does your list of tables represent the
collaborators in the system?
This may seem like a bit of a stupid question I know but I thought I
might as well put it forward since the group is here. In the meantime
I'll be going with this method until I hear more.
Thank you for your time.
Cheers,
Psychie
| |
|
| Psychie wrote:
> At present I am using the MVC design pattern for my projects.
This is not a particularily ringing endorsement for the sublime quality of
USENET and its patrons, but...
....the best place to ask non-entry-level questions about XP is probably
its mailing list ( extremeprogramming@yahoogroups.com ).
More people like to discuss XP there than like to deflect endless mindless
trolling here. Go figure.
--
Phlip
[url]http://c2.com/cgi/wiki?Z Land[/url] <-- NOT a blog!!!
|
|
|
|
|