After writing several recent Model View Controller (MVC) pattern articles (A Model View Controller diagram, Model View Controller definitions), I thought it might help to share a real-world implementation of an MVC design. To that end, I'd like to share some information from a Java/Swing GUI application I wrote several years ago to help me in my work with Function Point Analysis (FPA).
recent posts related to object oriented design and programming
Every time I read an article or book about UML “Use Cases” I cringe a little bit. Every author says something like “Jacobson left the definition of a Use Case too open,” and then they try to work through some elaborate scheme of what a Use Case means to them. IMHO, the best use case definition was created in the early 1980s, long before Jacobson mentioned the term.
The best UML “Use Case” definition
Here’s the best Use Case definition I know:
MVC Controller - our MainController class
As its name implies, the MainController is the main controller/coordinator of our MVC application. It creates the other controllers, and in many ways then turns control over to these other controllers. One of the controllers it creates is the ProcessController.
MVC - Handling data-changing events
Whenever the user adds, edits, or deletes data, such as our Process data, all the proper GUI components need to be notified of this event so they can properly update their displays. In this application, when a user adds a new Process, this means that we need to update our MainProcessTable. We implement this as follows:
I recently started to model an application that makes extensive use of web service calls, and my customer asked me to include a UML sequence diagram to show the flow of calls in the system. This prompted me to wonder, "What is the correct way to show distributed systems (like a web service) in a UML sequence diagram?"
If this link is correct, in a UML diagram you show remote systems as actors.
Question: Is there a UML diagram to visually show the processes in a system?
Yes, you can use use case diagrams to represent the use cases (processes) in a software system. Use case diagrams show the actors in a system, and the ways in which these actors use the system.
This is why I use the terms "use cases" and "processes" interchangeably. IMHO, "use case" is a fancy way of saying "process", or perhaps more accurately, user-initiated processes, or event-driven processes.
Question: I want to visualize the activity in a use case ... what UML diagram can I use to do this?
Use an activity diagram. These UML diagrams are good for visual workflow modeling. Swimlanes in UML activity diagrams can also show the behavior of different actors within a workflow process.
I ran into the perfect situation this week that defines why you should not put UI assumptions in Use Case (or task) documentation. A customer decided that they really wanted to change a UI from the proposed tabular approach (with potential popup windows) to a tree view. If the use case mentions things like "double-click", "press OK", and UI phrases of that nature, the use cases would need to be re-written. Without those UI assumptions they should be fine.
OO Koan: You are assigned to work on a project, but you cannot communicate with the end user -- how do you develop the software?
(Answer: Lots of luck. ;)