views:

200

answers:

4

I am writing a Product requirements specification. In this document I must describe the ways that the user can interact with the system in a very high level. Several of these operations are "Create-Read-Update-Delete" on some objects.

The question is, when writing use cases for these operations, what is the right way to do so? Can I write only one Use Case called "Manage Object x" and then have these operations as included Use Cases? Or do I have to create one use case per operation, per object? The problem I see with the last approach is that I would be writing quite a few pages that I feel do not really contribute to the understanding of the problem.

What is the best practice?

A: 

It makes sense to distinguish between workflow cases and resource/object lifecycles. They interact but they are not the same; it makes sense to specify them both.

Use case scenarios or more extended workflow specifications typically describe how a case may proceed through the system's workflow. This will typically include interaction with various different resources. These interactions can often be characterized as C,R,U or D.

Resource lifecycles provide the process model of what may happen to a particular (type of) resource (object). They are often trivial "flower" models that say: any of C,R,U,D may happen to this resource in any order, so they are not very interesting by themselves.

The link between the two is that steps from the workflow and from the lifecycles coincide.

reinierpost
So, in your opinion, I should have a different use case for each C, R, U, D operation? It makes sense if the operations are complex of course, but I still feel it as overkill.
Mario Ortegón
No, on the contrary, I think use cases can have multiple CRUD interactions with multiple different entities.
reinierpost
+1  A: 

The answer really depends on how complex the interactions are and how many variations are possible from object to object. There are two real reasons why I suggest that you develop specific use cases for each CRUD

(a) If you really are only doing a high-level summary of the interaction then the overhead is very small

(b) I've found it useful to specify a set of generic Use Cases for modifying 'Resources' and then extending / overriding particular steps for particular objects. Obviously the common behaviour is captured in the generic 'Resource' use cases.

As your understanding of the domain develops (i.e. as business users dump more requirements on you), you are more likely to add to the CRUD rather than remove it.

Chris McCauley
+2  A: 

The original concept for use cases was that they, like actors, and class definitions, and -- frankly everything -- enjoy inheritance, as well as <<uses>> and <<extends>> relationships.

A Use Case superclass ("CRUD") makes sense. A lot of use cases are trivial extensions to "CRUD" with an entity type plugged into the use case.

A few use cases will be interesting extensions to "CRUD" with variant processing scenarios for -- maybe -- a fancy search as part of Retrieve, or a multi-step process for Create or Update, or a complex confirmation for Delete.

Feel free to use inheritance to simplify and normalize your use cases. If you use a UML tool, you'll notice that Use Cases have an "inheritance" arrow available to them.

S.Lott
I think the idea of a generic CRUD superclass is the one that most appeals to me. I will just remove everything in the template that makes no sense and leave a reference to the super use case as long as there are no changes.
Mario Ortegón
In that sense, I would have then 4 "SuperUserTestCases", and as trivial extensions,the Entity types that can be plugged, right?
Mario Ortegón
@Mario Ortegón: That's the point of inheritance: like the super-use-case, except with these overrides or extensions. Works for actors as well as use cases.
S.Lott
A: 

I feel representation - as long as it makes sense and is readable - does not matter. Conforming to the UML spec in all details is especially irrelevant.

What does matter, that you spec clearly states the operations and operation types the implementaton requires.

  • C: What form of insert operations exists. Can you insert rows not fully populated? Can you insert rows without an ID? Can you retrieve the ID last inserted? Can you cancel an insert selectively? What happens on duplicate keys or constraints failure? Is there a REPLACE INTO equivalent?

  • R: By what fields can you select? Can you do arbitrary grouping, orders? Can you create aggregate fields, aliases? How can you retrieve embedded (has many etc.) data? How do you specify depth of recursion, limits?

  • U, D: see R + C

sibidiba
Actually, at this point I am not that deep down on the technical requirements. The use cases are normally more like "User creates document", than "user updates table A, modifies column B and removes value in C"
Mario Ortegón
And what is "User creates document"? I mean, less is more in specs, but if you don't know what operations are involved, defined in "User creates document" what is the point on writing "User created document"? Sure you don't have to say how many bits does an ID/PK have, but if you define CRUD, I would like to know the operations that are to be implemented exactly.
sibidiba
Does that belong to the Use Case document, though? I though that belonged to the next level of design.
Mario Ortegón