开发者

How To Draw Component With POJO As Model In UML?

i've build an web application, i have servlet as controler and java classes as the request handdler

so if the servlet receive an request from a client, it will call method from the request handler to process the request, and then the request handler will have to call an ejb to do the business logic, and when the ejb has done it process, the request handler will give the clien开发者_如何学Pythont an response(JSP Page)

so the question is, how to draw the UML based the stucture i've describe above? how to describe relationship between an component(servlet and ejb) with the pojo(requesthandler)?thx for help


is it right to draw like this?

http://i56.tinypic.com/2lmx6c5.jpg

thx


[per question in comment on how to draw class diagram]

Class diagrams are probably most often used for showing relationships in a problem domain. The relationships capture rules from the domain (e.g. "Each order consists of one or more orderlines" / "each orderline forms part of exactly one order").

In your case the classes span the layers of the architecture. Therefore the relationships capture architectural rules rather than domain rules. I don't tend to use class diagrams for that purpose, but the principle is the same. For each pair of classes you need to ask:

  • How would you describe the relationship among the classes?
  • What's the cardinality?

For example, take servlet & client. How would you describe the relationship? Probably something like:

  • description: client calls servlet / servlet is called by client
  • cardinality: for each given client instance, how many servlets can it talk to? Probably one or more. Similarly, how many clients can a single servlet instance receive requests from? Again probably one or more (will depend on your design)

Assuming above are correct for your design you'd have something like the following (apologies for the formatting, yuml.me doesn't seem to place text cleanly):

How To Draw Component With POJO As Model In UML?

Same approach applies for remaining classes. First ask how you'd describe the relationship as a sentence, then figure out the cardinality. For example, take the servlet-request handler: how would you describe that? I'm not very familiar with java EE patterns, but would guess the servlet delegates to the request handler. So relationship phrase would be something like "servlet delegates request to request handler". And so on to ejb class, etc.

hth.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜