aspose file tools*
The moose likes OO, Patterns, UML and Refactoring and the fly likes Which Design Pattern is this ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Which Design Pattern is this ?" Watch "Which Design Pattern is this ?" New topic
Author

Which Design Pattern is this ?

Yed Su
Greenhorn

Joined: Mar 02, 2011
Posts: 10

Hi

I would like to know into which pattern the following architecture falls:

View <-> VO <-> Controller <-> Service <-> DAO <-> DB

View is my JSP,
VO is my Value object or command,
controller is my spring mvc controller,
Service layer is where the business logic lies.
DAO is where the DB interaction is done.

Just wanted to understand which design pattern was this ? As we see here we have VO, Service and DAO which are acting as Model, so Im not sure whether this falls under MVC pattern.

Regards,
Yed.
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4392
    
    8

I'd just call that a layered architecture - applying separation of concerns so each layer is concentrating on a particular task. It's too generic to know if any specific patterns are being used (though if you're using Spring MVC it suggests that MVC is going on somewhere).

MVC, for instance, is really about how the dependencies between the model, view and controller are hooked up.
Yed Su
Greenhorn

Joined: Mar 02, 2011
Posts: 10

Thanks Matthew.

Though Im using Spring MVC, I have seperated layers in my model - VO, Service and DAO are all independent. Can a model have sub layers inside like I had ? Conceptually this works good, but I just wanted to understand if it falls under any pattern other than MVC .
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
If you were implementing the Model-View-Controller design pattern, your value object which is created in the View is not part of the Model, it is part of the View.

Aside, you can create as many layers as you want and call anything whatever. It will not matter if you are only working with yourself. One of the benefits of commonly understood object-oriented design patterns is that they are typically understood by many individuals and help with communicating a particular application's design. While there is a certain degree of freedom when implementing the patterns, if you stray to far from what is commonly understood you run the risk of designing a system that no one will easily understand.

What value is there to separating your Model layers with a Service layer and a DAO layer? What does "independent" mean? These objects all have to work with each other and are dependent upon each other. Your descriptions of the design so far are very confusing.
Yed Su
Greenhorn

Joined: Mar 02, 2011
Posts: 10

Thanks Jimmy.

your value object which is created in the View is not part of the Model


VO here is just like the FormBean in Struts which will have getters and setters to populate the data.

What value is there to separating your Model layers with a Service layer and a DAO layer? What does "independent" mean? These objects all have to work with each other and are dependent upon each other. Your descriptions of the design so far are very confusing.


I should have phrased 'independent' as 'separation of concerns', sorry if it was confusing.


Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
No problem. In regards to the Presentation-tier data object (aka value object), this View object is created in order to transport data to Model component on Business-tier. It should not be confused with a domain/business data object, even if on the surface it holds the same data. In regards to Struts, the FormBean instance is part of the View along with the HTML that is created from the JSP pages. And Action objects are part of the Controller.

Good luck!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Which Design Pattern is this ?