Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java web-application to UML

 
Sergei Zhylinski
Ranch Hand
Posts: 84
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I've recently decided to gain some experience in programming design. I read "Refactoring: Improving the Design of Existing Code" by Martin Fauler, "Design Patterns: Elements of Reusable Object-Oriented Software" by the Gang of Four. Finally, I obtained some skilles in usage of the patterns from the aforementioned books.

Both of these books possess UML diagrams (primarily class and sequence diagrams). So my second step was to create UML diagrams by myself. And I decided to take a Java web-application. I have little experience in UML so could someone help to build a proper class diagram for the following source code:



This peace of code uses external ZK framework. To tell the truth I have no idea how I can depict the relations between container (Tomcat), external framework (ZK, Spring, etc.) and my own web-application and wether I am to do so.
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy, Sergey!

I think I'd go with the following diagram. A couple of remarks:

  • The GoF design patterns book uses OMT notation, not UML;
  • Don't worry too much about making your class diagram as detailed as possible. What I've learned over the years is that its real value is in communicating design decisions. Add to your diagram the things you judge necessary to communicate your choices.
  • If I make no mistake, your MainFrame class represents a window, right? I would avoid adding a getMenubar public method to such a class, because someone with a reference to an instance of a MainFrame class could call MainFrame.getMenubar and start doing things that MainFrame wouldn't know. In other words, the menu bar wouldn't be well encapsulated. Add methods to your MainFrame class that deal with your menu bar.
  • class_diagram.png
    [Thumbnail for class_diagram.png]
    The class diagram that describes the code above.
     
    Sergei Zhylinski
    Ranch Hand
    Posts: 84
    1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Roberto Perillo, can you tell me what program you used to create the diagram?
     
    Roberto Perillo
    Bartender
    Posts: 2271
    3
    Eclipse IDE Java Spring
    • Likes 1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Oh, sure! It was Astah. You can find it here. You can use the Community version, which is limited, or you can try the Professional version, which expires in 20 days (if I make no mistake).
     
    T. Sharma
    Author
    Ranch Hand
    Posts: 63
    6
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    You can create class diagrams (and other UML diagrams) in ArgoUML. It is a free software.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic