• Post Reply Bookmark Topic Watch Topic
  • New Topic

Regular CRUD design for a Class Diagram

 
Eusebio Floriano
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm designing architecture for a regular CRUD operation. My questions would be regarding the proper stereotypes, mainly for my APIGateway and DAO classes, which i mapped as <JAX-RS>> and <<EntityManager>> respectively.

I'll attach my draft design.

Could you give your thoughts on that ?

Thanks

question.jpeg
[Thumbnail for question.jpeg]
 
L Foster
Ranch Hand
Posts: 213
11
Android Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks good to me.  The only thing that snagged my attention: you have named your EntityManager class XYZDAO.  While the literature around the OCMJEA exam seems to favor thinking of EntityManager as the 'way' of doing a Data Access Object, I don't think it needs a different name.  You are using someone's implementation of EntityManager, but you will get it from some factory or constructor, and you'll refer to the class by its interface methods, anyway.

Also, the stereotype is a little redundant there.  Perhaps "interface" is appropriate, but I see why you would want to strongly indicate the role that is played by this thing.  Perhaps you could use a stereotype to indicate the technology that is being leveraged?  After all, anyone could name a class EntityManager.  It's so obvious, I was surprised Hibernate did not use that.

I hope it helps.
 
K. Tsang
Bartender
Posts: 3610
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your ApiGateway is more of a front controller, your XYZService can be a EJB stateless bean and your XYZDAO is a DAO.

The stereotype will be <<front controller>>, <<stateless EJB>> and <<DAO>>

The EntityManager is something you use/instantiate inside the DAO to do CRUD.
 
Eusebio Floriano
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It makes sense what you both said, that XYZDAO has a EntityManager rather than is a.

But i'm still confused with Foster's comment:

The stereotype will be <<front controller>>, <<stateless EJB>> and <<DAO>> 


As 'Front Controller' and 'DAO' are patterns, shouldn't the service class be stereotyped as <<Business Service>>, for example ?

Thanks in advance, guys.
 
K. Tsang
Bartender
Posts: 3610
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You meant my comment.

Stereotypes can be patterns because a pattern can represent a set (multiple) of classes. For example DAO pattern normally has an interface and its implementation. You can surely have 2 classes: 1 interface and the other a class. When the stereotype <<DAO>> is used, that tells people both the interface and its implementation are together.

I will recommend naming your classes and their stereotypes with something meaningful. Java EE tech terms (like JSF, managed bean, EJB, servlet, JSP etc), pattern names, POJO, entity, utility are easily understood.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!