SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    Foozle Reducer ServerStorm's Avatar
    Join Date
    Feb 2005
    Location
    Burlington, Canada
    Posts
    2,699
    Mentioned
    89 Post(s)
    Tagged
    2 Thread(s)

    Are my stories on the right track?

    Hi,

    I am finally investing dedicated time to get better with OO PHP. I have been poking around for a few years and have learned enough about OO that I believe that I am ready. It has taken a pain-fully slow journey of periodically reading posts, articles on sitepoint and googling as well as reading books like Jason Sweat's Guide to PHP Design Patterns, Martin Fowlers Refactoring and PoEAA, and Harry F's PHP Anthology I & II.

    Jason's guide to PHP Design Patterns got me really interesting in TDD and simpleTest. I have making little but positive steps in rerouting my thinking towards the TDD methodology and more specifically Agile techniques.

    As I have very much come from a Plan everything up first methodology, I have to really state how big of a shift in my thinking this is; therefore I would ask to try not to be too critical even if my questions don't seem savy or obvious.

    I essentially have a membership system that I am attempting to build. I had originally created (non-UML) user flow diagrams; however I am trying to move to a more Agile way of doing things. As part of the first (new TDD) steps I have been attempting to write Stories. As I am the one that is designing this software (more as hosted service), there are less customer stories (although some) and more stories drawn on how I see users interacting with the system (I know not ideal for Agile but I am trying to fit in as much Agile as possible). Before I go too far with creating thousands of one sentence stories I hoped to get feedback on the stories that I am making.

    After I get the stories done then I will try to write bare bones tests that cover a slice of the entire project including database abstraction, basic membership, basic ecommerce, basic plug-ins ... I will get the tests to fail first and then try to write the minimum to make them pass, then I will refactor the tests to be less rigid and then add features or refactor existing code. Little by little I will broaden the functionality to widen each class in the slice.

    Here are the stories that once I am finished I will try to group together and then attempt to build the tests for the desired functionality.

    Stories

    User selects a buy link on non-required register product, they then click on their cart and and select checkout where they are taken to a page that displays the item in their cart and asked if everything looks ok.

    The user selects a register required product, their logged cookie is valid, so the product is added to their cart.

    The users selects a register required product, and their cookie is not set or valid so they are navigated to the log-in page.

    The user is at the log-in page, they supply a username and password, hit submit and supplied a message of successful login.

    The user selects a register required product. They are not registered yet registered so they are navigated to the option to create new registration and provides information regarding registration.

    The user selects 'change profile', logs-in and make changes to their profile. They submit changes and a message appears to either say changes were successful or validation shows required corrections.

    The user starts new registration by creating a username, password and email. After submitting they are showed either a message that validation requires correction or that they should check their email account to confirm the registration. The user receives an email where it says to select the link to confirm the registration. The user clicks on the confirmation registration link which returns a web-page that confirms they succefully created a profile.

    User wants benefits extended to members so they register a new profile but do not buy anything.
    I get the general feeling that my stories are not specific enough (maybe lame ). For those that have experience writing stories to move towards refining PHP class functionality, I would very much appreciate your feedback on if I am on the right track?

    ServerStorm
    Last edited by ServerStorm; Feb 9, 2007 at 17:03.

  2. #2
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Location
    South Dakota
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Some of the best advice that I have gotten on getting started with the user stories was from Marcus Baker (lastcraft in the forums here). That advice was to have each story follow a specific path through the application. Many of the stories that you have written seem to mostly follow that.

    So maybe to be a little more specific on your first story:
    Quote Originally Posted by ServerStorm
    User selects a buy link on non-required register product, they then click on their cart and and select checkout where they are taken to a page that displays the item in their cart and asked if everything looks ok.
    You might try
    On a product that doesn't require registration, the buyer clicks a link (or button) to add the item to their cart. When the item is added, they are taken to their cart where they see all items that have been added.

    or

    On a product that doesn't require registration, the buyer clicks a link to add the item to their cart. If there is an error (EX. The product sold out just before they clicked), they are taken to an error page that has an apology that they item has just sold out.
    They are similar actions with multiple paths. Also remember when testing, to test for the unexpected, as well as what you expect. So if you expect a value to be one thing, test that the value is what you want, also test that the value is not what you want.

    I also am new to this way of thinking. It is difficult trying to go from creating DFD's, ERD's, etc, etc to writing user stories. But I can say that I like the change so far. I am slowly starting to get used to testing everyting first and then writing the code. It also works wonders when you refactor and a test that you wrote three tests ago all of a sudden gets red, you know it and can fix it right then and there. No suprises two months down the road.
    TDDJournal: An Experiment in Test Driven Development.

  3. #3
    Foozle Reducer ServerStorm's Avatar
    Join Date
    Feb 2005
    Location
    Burlington, Canada
    Posts
    2,699
    Mentioned
    89 Post(s)
    Tagged
    2 Thread(s)
    Ted,

    Thanks for citing and example of how to better the example story that you chose. I see from your example how you actually added a little more detail and I can see how it would help in building the test.

    I like too the example of multiple eventualities.

    I am glad that I was not too far off base

    I also like the fact that the tests show right at the source of the error the red bar... I can fix it then and there and know that it is fixed for the future...really cool!

    Edit:

    BTW nice blog on TDD experience so far... it is all helpful


    I will refine my stories more akin to your recommendation and let us both hope that Test infection continues to be such a positive thing and we become better coders, with loosely coupled code in the future

    Thanks again for your thoughts and help!

    SeverStorm

  4. #4
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    I am not sure if CRC cards is exactly what you meant, but here goes anyway:

    Have a look at how Marcus describes "the CRC cards" - note at the foot of his home page.

    This SP discussion where marcus explains CRC card us is very helpful and for me was the most memorable, but a search for CRC on this forum

    This tutorial from zend dealing with Actor classes and roles is one I always find thought provoking.

    You sound as though you have gone through roughly the same spin cycle as me.... I think there are a lot of us out there, soaking all this stuff up, reading and re-reading posts...

    Its just so fascinating, I wish I had got into it when I was younger.

  5. #5
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Location
    South Dakota
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's a great thread and thank you for posting that Cups. Much of it sounds like what Marcus had mentioned to me as in this thread.

    Another great piece of advice in that thread is to unsure that you have acceptance tests done as well. Many of these threads I have found only talk about unit tests, but what good are the unit tests if you have not created the functionality that the user wants.

    Simple test has the WebTestCase class that you can extend to do your acceptance tests.

    On a product that doesn't require registration, the buyer clicks a link (or button) to add the item to their cart. When the item is added, they are taken to their cart where they see all items that have been added.
    So using this example, you can do an acceptance test using the following.
    PHP Code:
    class ProductTest extends WebTestCase {
        function 
    TestAddProductToCart()
        {
            
    // However you do your links.
            
    $this->get('http://yoursite.com/product.php?id=3');
            
    $this->assertLink('Add to cart');
            
    $this->clickLink('Add to cart');
            
    $this->assertText(new patternExpectation('/your product/i'));
        }

    I know it doesn't test the actual look of the site, but if you product with id 3 has 'your product' as a title for example, you can test that it is present, thus it's been added to you cart.

    Of course this is a small test as an example, but if you take your stories and write acceptance tests, then you are delivering the visible functionality that your client (you in this case) expects.
    TDDJournal: An Experiment in Test Driven Development.

  6. #6
    Foozle Reducer ServerStorm's Avatar
    Join Date
    Feb 2005
    Location
    Burlington, Canada
    Posts
    2,699
    Mentioned
    89 Post(s)
    Tagged
    2 Thread(s)
    Thanks Cups,

    I liked the links that you provided they indeed were thought provoking.

    For me I am wrestling with if I should use a card approach or just the stories. I am pretty good with visualization from the written word and it is easier for me to translate it than the card methodology. However I understand that the card approach is a new technique that I will be slower at in the early stages, so I have not thrown it away just yet

    It is really interesting the group of us that are all sort of emerging at the same time and have roughly come from similar backgrounds AKA entrenched in older ways of doing things and finally coming around. I hope that I paraphrased that correctly, however the as teddarling points out our current stage of development may help others that have been lurking and not really known how to get started or too intimidated by the sitepoint wizards.

    Cheers and I hope we learn well and in the process help others!

    ServerStorm

  7. #7
    Foozle Reducer ServerStorm's Avatar
    Join Date
    Feb 2005
    Location
    Burlington, Canada
    Posts
    2,699
    Mentioned
    89 Post(s)
    Tagged
    2 Thread(s)
    Hey teddarling,

    Thanks for the link to Marcuses any your discussion, luckily I had read this earlier this week which actually influenced the stories that I were creating... Marcus did a great job of breaking it down to something that a new person into TDD could understand.

    Like you mentioned about 'Acceptance Testing', IMHO is may be hard for the very advanced people to break it down to a level that new TDD'ers understand. I am not saying that they don't try hard and indeed sometimes hit the mark; although there examples and general organic development of threads is not truly conducive to learning this stuff as fast as possible. It is a little like walking, it is hard to break it down to the simplicity that is required for a small child to learn to walk; therefore the child tends to slowly learn by example as their level of understanding increases. Again I hope that I did not offend anyone, I am merely saying that I think this is a possible challenge for learning.

    Maybe we can help others by posting simple examples and really describing our thought processes even for the simple examples we provide?

    Regards,
    SeverStorm

  8. #8
    SitePoint Addict rvdavid's Avatar
    Join Date
    Nov 2006
    Location
    Australia
    Posts
    233
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ServerStorm View Post
    Thanks Cups,

    I liked the links that you provided they indeed were thought provoking.

    For me I am wrestling with if I should use a card approach or just the stories. I am pretty good with visualization from the written word and it is easier for me to translate it than the card methodology. However I understand that the card approach is a new technique that I will be slower at in the early stages, so I have not thrown it away just yet

    It is really interesting the group of us that are all sort of emerging at the same time and have roughly come from similar backgrounds AKA entrenched in older ways of doing things and finally coming around. I hope that I paraphrased that correctly, however the as teddarling points out our current stage of development may help others that have been lurking and not really known how to get started or too intimidated by the sitepoint wizards.

    Cheers and I hope we learn well and in the process help others!

    ServerStorm
    Hi... you can use them both. What you are talking about would be the beginnings of an "index card" (user stories) oppsed to using a CRC(classes responsibilities + collaborators) card.

    The user stories come index cards are used for management of the project and aim to create a fast track for development. These are actual assets that you throw back and forth from the client to developer and would later be filled in with effort ratings/score of "ideal/perfect programming days" (this is somewhat irrelivant in your case).

    These index cards represent the application specs and are then translated into value for business which are different from CRC cards which deal directly with class responsibilities + relationships.

    They deal with two complete different scopes.

    User story:
    Code:
    "An authentication system would need to be implemented to variably restrict access to anywhere in the website"
    CRC:
    Code:
    // this is pretty simple and perhaps imcomplete example.
    Class: Authentication
    
    Responsibilities
    - Checks if a user is authenticated
    - logs user in
    - logs user out
    
    Collaborators
    - UsersDataGateway
    HTH. Good luck with your progression

    Regards,

  9. #9
    Foozle Reducer ServerStorm's Avatar
    Join Date
    Feb 2005
    Location
    Burlington, Canada
    Posts
    2,699
    Mentioned
    89 Post(s)
    Tagged
    2 Thread(s)
    RvDavid,

    Thanks, for your clean cut information regarding stories and CRC. I have decide to use the CRC's to outline (as you suggest) the software system. I believe that I will still use the stories as it will help me still think of the ways that other will use the features of my system, which can only stand to improve how the system will work for users.

    You post also helped me fill in a gap I had about why the stories seemed so far away from the actual classes makeup the CRC fill this gap and don't seem difficult to create.

    Thanks and with you and other that a help pulling this thread together It is really helping getting things solidified.

    Regards,
    ServerStorm

  10. #10
    SitePoint Addict rvdavid's Avatar
    Join Date
    Nov 2006
    Location
    Australia
    Posts
    233
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    No problems, CRC cards are very useful especially when you have trouble analysing "gray", obscure stories.

    However I should mention that while user stories are evidently a project asset/artifact (part of the development life cycle), CRC cards are an optional thing - well for me anyway.

    I use it mostly when I'm stuck and throw it at other developers in my team when they're stuck. We use it more as a tool rather than a project artifact or rather, a disposable asset - draw it up on the board, take a picture, print it out, float it in on the board room table with other team members so you all feel important and "scientific".

    To my experience however, once we take the CRC cards and translate them into code, it almost always changes. Probably because we don't spend more time on exploration, however, the way we code is that we find a nice place to start and move forward from that point.

    There's some good pointers on CRC cards here if you're interested to fnid out more about it.
    http://www.agilemodeling.com/artifacts/crcModel.htm

    regards,

  11. #11
    Foozle Reducer ServerStorm's Avatar
    Join Date
    Feb 2005
    Location
    Burlington, Canada
    Posts
    2,699
    Mentioned
    89 Post(s)
    Tagged
    2 Thread(s)
    Lol "...so you all feel important and "scientific" - so much of planning feels exactly like this, although I do really think that most of it helps.

    I can see the way that you discuss working with CRCs. See in my current project I can see the 'stories' having less benefit that CRCs, but that will not always be the case. Agile tools maybe?

    Thanks for sharing some of your development practices and for the 'further reading' link!

    Cheers,
    ServerStorm


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •