| By Duncan Jack | Article Rating: |
|
| August 10, 2005 10:00 AM EDT | Reads: |
16,244 |
Activity Diagram
Once the requirements of a system from the users' perspective have been defined, activity diagrams help to define how this user experience will be achieved.
Activity diagrams are also extremely powerful. They are well suited to fleshing out the details of a use case by modeling the detailed interaction between a user and a system or screen. Activity diagrams are used to model:
- Business processes.
- Flow of control in an executing program.
- Details of a method.
Class Diagram
Class diagrams are used to model the classes of objects in a system (people and software). In the context of this article, the software building blocks are likely to be Java classes.
Think of a class - it has properties (attributes and associations) and methods and can be represented as shown in Figure 3.
The Order class has an orders property, which is an array of order items, each one represented by an OrderItem object. Although this could simply have been shown as an attribute inside the class, it's often more meaningful to represent such a property using an association as above.
On this point, I found Martin Fowler's excellent book, UML Distilled, particularly helpful. I highly recommend it. He goes into class diagrams in some detail and wisely splits his coverage into two chapters, focusing the first chapter on the essentials.
Class diagrams seem to follow so naturally from activity diagrams; the activities identified often may neatly correspond to methods in a class diagram, which helps save time and increase productivity.
There is, of course, no requirement to identify every property or method on a class in a class diagram. You may choose to show only public methods for example. Equally, you don't have to show all classes and relationships between them. Again, use what works for you.
Class diagrams really help when architecting the system and seem to give the design "room to breathe." It seems that if the design is elegant, the implementation is elegant too. If the implementation is elegant, it can be more pleasurable and cost-effective to evolve and maintain on an ongoing basis once the system has been put into production.
In Ian Sommerville's definitive work, Software Engineering, he cites (and qualifies) research that suggests up to 90% of software costs are evolution costs. Looking at this another way, if all you build for a client is the initial implementation of a system, you may only be getting as little as 10% of the revenue stream that you would otherwise get from that client over the lifetime of the system. Of course, these figures will vary significantly, but it's an interesting thought.
If you build a system that can be evolved elegantly and cost effectively, you're more likely to keep the relationship with the client, give them a better service, and make more money. Class diagrams are great for organizing where functionality will go, and for helping to select consistent and meaningful property and method names.
Sequence Diagram
Have you ever developed an application and then had to come back and modify it six months later and tried to work out how on earth you did it? Well, the UML sequence diagram may be able to help you.
A sequence diagram models the sequence of interactions between objects. In some ways, it a close cousin of an activity diagram, yet focused more on the behavior of software objects on a timeline (see Figure 4).
Sequence diagrams are great for thinking through a design, illustrating an idea, and also getting back up to speed when changes need to be made six months or so after the system has gone into production. The design stands out so clearly.
Prior to finding out about the UML, I used my own non-standard diagrams. For me, the biggest single benefit of the UML has been the sequence diagram.
In the UML modeling tool I use, MagicDraw UML, I typically have a class diagram open at the same time as a sequence diagram. As I work on the design and identify additional methods, I add these to the appropriate class. These methods are then immediately available for me in the sequence diagram. As a result, it's much easier to create an elegant design and enhance productivity. Another powerful feature of MagicDraw UML is that it enables me to generate all the framework code in Java from the UML model at the click of a button (equally, I can reverse engineer a sequence diagram from Java code).
It also ensures that the design is the documentation, which ensures that the documentation is done as the design evolves, changing with it. The appropriate use of annotated UML diagrams can save time, which is a significant business benefit.
In addition, it becomes a pleasure to come back and add additional functionality at a later date.
Getting Started with the UML
Here's what worked for me and what I generally suggest to anyone interested in getting started:
- Get a tool such as MagicDraw UML (free community edition and trial available). Tools have a lot of intelligence built in, which helps you get up to speed quickly on a couple of diagram types. The tool knows the specification. Have a look at the various symbols available in one or two of the main diagram types described above. Start using some of the symbols; you don't have to use them all. Grow into the tool over time. Learn the structure of the documentation and start reading it.
- Get Martin Fowler's book, UML Distilled. Read it a couple of times. It's a great book, aptly titled. I found Martin's real-world experience and balanced view of using the UML very helpful.
Resources
- MagicDraw UML (includes comprehensive documentation and examples): www.magicdraw.com
- Fowler, M. (1999). UML Distilled. Addison-Wesley: www.pearsoned.co.uk/Bookshop/
- Sommerville, I. (2004). Software Engineering 7. Addison Wesley: www.pearsoned.co.uk/Bookshop/
- UML 2.0 Specification and useful links: www.uml.org
Published August 10, 2005 Reads 16,244
Copyright © 2005 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Duncan Jack
Duncan Jack started the Scottish CFUG (www.scottishcfug.com), which is now ably run by Andy Allan. Duncan recently founded Scottish Java (www.scottishjava.com), a brand new Java community. A Macromedia Certified Flash MX 2004 Developer, his main interests are in building innovative Rich Internet Applications using Flash, Flex, ColdFusion and JRun. An accomplished mountaineer, he holds a first-class honours degree in Civil Engineering and is currently studying for an M.Sc. in Advanced Computer Science.
- Kindle 2 vs Nook
- Why IBM’s Server Chief Got Busted
- Is Cloud Computing Like Teenage Sex?
- Industry Experts Discuss the State of Cloud Computing
- Performance Tuning Essentials for Java
- Confessions of a Ulitzer Addict
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- It's the Java vs. C++ Shootout Revisited!
- Cloud Computing Can Revitalize Your Career as Software Developer
- IBM Could "Reinvent" Java: Mills
- Oracle & Cloud Computing: Exclusive Q&A with SVP Richard Sarwal
- A Brief History of Cloud Computing
- Kindle 2 vs Nook
- Cloud CEOs, CTOs & SVPs to Speak at 4th International Cloud Computing Expo
- Why IBM’s Server Chief Got Busted
- Is Cloud Computing Like Teenage Sex?
- Industry Experts Discuss the State of Cloud Computing
- Performance Tuning Essentials for Java
- The Difference Between Web Hosting and Cloud Computing
- Cloud Computing Expo: Exclusive Q&A with Yahoo! SVP Cloud Computing
- Ajax in RichFaces 3.3, JSF 2 and RichFaces 4
- Confessions of a Ulitzer Addict
- My Thoughts on Ulitzer
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- A Cup of AJAX? Nay, Just Regular Java Please
- Java Developer's Journal Exclusive: 2006 "JDJ Editors' Choice" Awards
- The i-Technology Right Stuff
- JavaServer Faces (JSF) vs Struts
- Rich Internet Applications with Adobe Flex 2 and Java
- Java vs C++ "Shootout" Revisited
- Bean-Managed Persistence Using a Proxy List
- Reporting Made Easy with JasperReports and Hibernate
- Creating a Pet Store Application with JavaServer Faces, Spring, and Hibernate
- What's New in Eclipse?
- Why Do 'Cool Kids' Choose Ruby or PHP to Build Websites Instead of Java?
- i-Technology Predictions for 2007: Where's It All Headed?




































