include or extends (UML java)
Can anyone tell me if I have to use the include dependency or the exten开发者_开发百科ds one?
Use_case A : Select and load a file
Use_case B : Show waveform
Whenever the user selects and loads an audio file, immediately a waveform is displayed.
I think that Use_case A and Use_case B should be connected by extends .... am I right? Thank you
I'd say include
not extend
.
Reason: Purpose from User's point of view is Display Waveform
. Selecting and loading a file is a means towards that end, not an end in itself. It's difficult to see Select and Load file
as ever having use on it's own: it doesn't represent valuable end-user functionality. It would only ever exist as a UC if a common step in more than one 'real' UCs.
hth.
In my opinion these two are not necessarily separate use cases. When identifying use cases, try to consider the viewpoint of the user. Showing the file to the user could be one step of the whole process of opening the file.
If you only have one file type and this is what always happens, one use case is good enough. If you have different file types that the user can select and load and every time something different happens, it could be a good idea to extract the first part to avoid repetition but it depends. In this case, use extend. (even this could be handled with alternative flows though)
A few points:
1- Please note that include and extend are not dependencies, dependency is another relationship in UML.
2- Good use cases are those that are UI independent. Focus on what the user wants to achieve. Do not make UI related decisions when writing use cases.
3- When "A" includes "B", "B" happens every time "A" happens. It is like an unconditional function call from "A" to "B". So "B" could always be part of "A". We separate "B" for re-usability and modularity.
4- Some pros recommend to avoid extend when possible. Having extends and includes does not necessarily imply professional UC diagrams. They could reduce readability and clarity.
精彩评论