• Post Reply Bookmark Topic Watch Topic
  • New Topic

Patterns, can they be combined  RSS feed

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers,
have just got my first J2ee job, and realised I gotta apply all this stuff I learned. Problem is I am the only J2EE developer and I ain't got no experience at except certification for WEB components. Anyway have been looking at patterns which have been a great help for consolidating language and application of needs but have got a doubt. If I want to use MVC pattern, can I also add in a DAO layer pattern and an VO pattern or does this go against something I did read. I think it should be possible but the material I have found just shows how to apply them individually and says nothing about applying them to the same application.
Any thoughts would be great
Williery
 
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yup, mix and match to your heart's content. Patterns are records of good designs that have been used many times, and if you see one that meets your needs just grab it. Design is often heirarchical - you drill down from large abstract ideas to smaller concrete ones. The "model" part of MVC may reveal dozens of interesting patterns when you open it up and look inside. And components in those patterns may use even more.
Sun's J2EE patterns are neat beause they give reasonable names to common designs, help you make sure your thinking on something is complete and help you talk to others about it. Some experts advise against browsing the pattern catalog and picking one to implement, however. They prefer a path of starting with the simplest thing that can possibly work, refactoring code until you realize it is starting to resemble a pattern, then renaming the classes to make it obvious to everyone else. I'm not sure about that idea yet. What do you think?
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

They prefer a path of starting with the simplest thing that can possibly work, refactoring code until you realize it is starting to resemble a pattern, then renaming the classes to make it obvious to everyone else. I'm not sure about that idea yet. What do you think?

I would agree with that statement. Too often we try to apply a design pattern because it's sexy or we just want to use patterns. you should first make sure that your solution requires a particular pattern. Don't go into analysis looking for patterns, instead locate patterns when designing the solution and use them as required. Some patterns will occur in almost all J2EE designs. For example, if you are working with EJBs you will no doubt require the Session Facade pattern for performance reasons. If you are using an EJB in a JSP page then you will probably use the Proxy pattern.
 
Will Reilly
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cheers for that guys, will have to do some more reading on this to familiarise myself with the patterns so as to identify them as the project requirements become clearer.
Cheers again
Williery
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!