in
Forums
Blogs
Files
Devexpress.Com
ClientCenter
Support Center
DevExpress Channel

Gary's Blog

XAF RWA Just in Time Design #1

Now that we have our first use case, it’s time to do a little design work. The first task we have to complete is to identify object candidates, that is things that might be coded up as objects in our solution. The easiest way, I find, to do that is to list the nouns in the use case, so let’s do that now.

The nouns are:

  1. Administrator
  2. Diary
  3. Course
  4. Booking
  5. Outage

Examining the list above it is clear that the nouns 2 through 5 are good candidates for objects but Administrator is not so clear because, at this point, it is not obvious if Administrator should be an object or if it is an attribute of another, as yet undefined, object (Employee say). So, for now, we’ll not include it as an object, safe in the knowledge that if we change our minds, we can fix it during the refactoring phase.

Booking too, though an obvious candidate, is not really part of this use case. Certainly both Diary and Outage objects have a dependency on Booking, as we’ll see later, but this dependency can be mocked during testing of this use case solution and so, for now, we can afford to ignore it.

The next task we have to complete is to decide what behaviour our objects are going to have. A good way to get a “first pass” at object behaviour is to look at the verbs in the use case, so we’ll go ahead and do that.

The verbs are:

  1. Select
  2. Create
  3. Logs on
  4. Edit
  5. Delete

Now that we can see them clearly, we notice that we don’t have to pay them a lot of notice as the CRUD will be handled by XPO (the orm tool under XAF) and the “logs on” element we can assume we can handle via the security module (again safe in the knowledge that if we are wrong we can fix it in the refactoring phase).

Now we need to look at what constraints we have on our objects. From the use case we can see that we have a constraint around tee-time bookings with regard to the fact that we can’t create or edit an outage, nor can we edit a diary if it is going to invalidate a tee-time booking. So let’s decide that we are not going to allow those processes to occur and let’s document that decision.

Business Rule: 001

Use Case Reference
001 paragraphs 2.1.4, 2.3.3 and 2.4.4

Rule
Tee-time bookings cannot be invalidated by the creation or editing of an outage, nor by the editing of a diary.

Action to be Taken
On the aforementioned events a search will be made for affected bookings, if there are any then an error message will be presented to the user and the event cancelled.

There is also a constraint around the deletion of course diaries in as much as they cannot be deleted if they are assigned to a course, so let’s go ahead and document that decision too.

Business Rule: 002

Use Case Reference
001 paragraph 2.2.4

Rule
A course diary cannot be deleted if it is currently assigned to a course.

Action to be Taken
On the aforementioned event a search will be made for affected courses and if any are found then an error message will be presented to the user and the event cancelled.

Having identified the objects, their knowledge (the properties they have) and their behaviour (the functions that can be called on them) and having documented certain business rules, the above post, along with the Use Case, represents a minimal set of documentation that an agile team (in this case us) can use to go ahead and create some code. And that is just what we’ll do in the next post.

Digg This
Published Oct 08 2008, 03:28 PM by Gary Short (Developer Express)
Filed under:
Technorati tags: Real World App

Comments

 

drew.. said:

nice effort Gary. Sort of like hanging around reading over your shoulder.

Regarding BizRule 002.. is the constraint deep enough? Is just the act of assigning a diary to a course enough. Would it make more sense that if the diary also has some association with bookings be more the flag, as this would indicated true "used" states? I am not a huge fan of forced staggered ui experiences like this. Think more mac-like where, sure it can recognize a diary is "used" by a course, but unless there are bookings, who really cares that it will be nulled. Perhaps a warning suggesting that this nulling will occur, but to blanketly say no... ... anywhooo, just a thought, and i realize fully your approach is industry-standard. I am just evolving my ui ideals to minimize pop-ups, error messages etc and this seems more fluid.

October 8, 2008 11:26 AM
 

Gary Short (Developer Express) said:

Hi Drew,

Thanks for your interest. BizRule 002 is there 'cos a Course doesn't know when it is open, nor when the tee-times are, without it. And so, if you want to delete a Diary (cleaning up last years etc) then it must not be currently assigned to a Course. There's no "direct" dependency between the Diary and the tee-times other than for validation purposes on the create and edit events, however, that dependency is "indirect"

Totally with you on the idea of fluid UIs though, and, if you guys come up with other use cases as you see the code, then we can handle them during refactoring.

I'm actually enjoying this a lot; you know what we are doing here? Building a product without a budget or timescale, just building it for the sake of building the best software we can (okay we're actually doing it to educate XAF users and for training purposes, but you know what I mean don't you?).

October 8, 2008 12:15 PM
 

Robert Fuchs said:

Bravo, I like it, this is really useful stuff.

Does this series replace the Cookbook or will it run in parallel?

OTOH I'm a bit disappointed, because you still have not published the long awaited localization tool:

community.devexpress.com/.../you-say-potato-i-say-potahto-localization-in-the-express-application-framework.aspx

October 9, 2008 10:50 AM
 

Robert said:

For the diary, are there only 1 set of first and last tee time for a diary or is there a set for each day in the diary? (between course open & close dates)  Why be able to delete a diary at all?  History is important.  What about copy a diary? say for next year.  

Just my ramblings. (I'm sure more to follow later posts)

Thanks,  

Robert

October 9, 2008 4:04 PM
 

Your 2nd favourite developer said:

OK so you produce an error message... frustrating for the user that you can't get there from here.  Means backing out of the current option then searching for the bookings, getting a print out etc..  At the point the error message is produced, the system already knows that there is at least one booking.  Rather than an error, a user choice might be better.. eg. Diary X cannot be deleted because there are <events>, would you like to see the <events> now?  Yes presents the events and no produces a confirmation message that the diary was not deleted.  You need the no option in case you chose the wrong diary in the first place.

October 9, 2008 4:22 PM
 

Gary Short (Developer Express) said:

@Robert Fuchs no this post doesn't replace anything you guys will get everything (eventually <grin>). At this moment my focus in on this as it was the "squeekest wheel"

October 10, 2008 5:20 AM
 

Gary Short (Developer Express) said:

Robert, you feel free to ramble on, the more comments the more it will be like a real project LOL. As for the Diary it holds the opening and closing times (date and time) for that season (normally summer and winter). On a daily basis the time element of that will be examined to get the first and last tee time.

As for deleting a Diary well the functionality is there so you can tidy up if you want to, you are right, you could just leave them hanging around for ever if you wished. The thing is there wouldn't be that many as you have one for summer and one for winter and there are a number of outages (for competitions etc) but from year to year they are pretty much the same, so you would probably just edit the start and end dates for the next year and carry on using the same Diary. If there were to many changes to make to the Outages then you may just create a new Summer one (say) and delete the old one, but you would have to ensure that no Course was still attached to the old one before you deleted it, as a Course without a Diary can't take bookings as it doesn't know when it's open, closed or when the Outages are.

October 10, 2008 5:28 AM
 

Gary Short (Developer Express) said:

To my 2nd favourite developer, well it is frustrating when you can't get to there from here, but you know what, that happens sometimes, if the rails are broken then the train can't get from here to there, it's a show stopper. Same here; you cannot delete a Diary out from under a Course as this will leave it without the knowledge it requires to allow bookings.

Just to clarify though, there is no dependency between the Diary and the events as you call them (which are the Bookings) once they are set they are set. The dependency is between the Diary and the Course so, in this case, there will only ever be a max. of 3 Courses that could have a dependency on the Diary you are trying to delete, so I feel it's okay to say "hey this Diary is still in use so you can't delete it" and leave the user to go and sort out the max. of 3 courses that could still be dependent upon it.

October 10, 2008 5:36 AM
 

Your 2nd favourite developer said:

Gary, I didn't say you should be able to delete the diary, what I was offering was a more user friendly approach - that of a choice instead of an error... a compromise statement might be, hey you can't delete this diary, do you want a list of why?

October 10, 2008 3:41 PM

Leave a Comment

(required)  
(optional)
(required)  
Verification code: Required
   
Add
Copyright © 1998-2008 Developer Express Inc.
ALL RIGHTS RESERVED