Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

which design pattren is best :

 
samdeep aarzoo
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

can anybody tell me which object oriented design pattern
should we use.
which design pattren is best :
i know that much about design pattern
about MVC : model view controller
here controller is servlet: model is java bean : view is jsp
i recently read first two chapter of
famous book design pattern by grady booch:
FOR any design which core framework we have to keep in consideration
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A design pattern is a known-to-work solution for a rather specific design problem. There is no *best* design pattern, just differently appropriate design patterns for different situations.
 
samdeep aarzoo
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how can we widely categorized the different type of situation
to make a design pattern
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by sandeep mittal:
how can we widely categorized the different type of situation
to make a design pattern

Patterns are not made nor invented. Patterns are observed.
I'm afraid that you're trying to force a design pattern where a pattern doesn't exist. Could you perhaps tell us more about the motivation and rationale for what you want to accomplish?
 
sever oon
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You seem to be confusing a "component object model" with a "design pattern". MVC is a component object model. It takes one logical object and splits it up into three physical objects (model, view, and controller). The point is to separate out three different kinds of logic into three physically distinct places. EJB is another instance of a component object model...the point of this one is to split up remote API from location/creation logic from the remotely performed business logic. You can think of a component object model as being a way of "projecting" a single object onto a set of orthogonal axes...breaking it down into parts that can operate independently from one another.

A design pattern is NOT a component object model. A design pattern is a collaboration of different objects intended to solve a particular kind of problem. As such, the "best" design pattern depends on the problem you're trying to solve. The book by the Gang of Four called Design Patterns details these problems and their associated patterns at length--you might want to poke through it for ideas.

Your question is sort of like asking, which is better, a hammer or a screwdriver? It depends...are you trying to put in a nail or a screw?
 
Thomas Taeger
Ranch Hand
Posts: 311
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by sandeep mittal:
how can we widely categorize the different type of situation
to make a design pattern


If your question is in which situation to _use_ (not make) which design pattern, then I totally agree with you that a) this question can hardly be learned "in a Sun course 500" but instead b) first has to be self-studied, maybe following Sun's very good book "J2EE Design Patterns" and then b) for real-life problems comparing similar patterns again and again.

In the same book you find one page that might be most helpfull for your first categorazation: the diagram showing the J2EE patterns relationships, devided into three groups: first group for Presentation Tier, second for Business Tier and third group for Integration (Data Access) Tier. Each group / tier has its own design patterns. Exercise it for some hours, but based on a real (or imagined concrete) problem.

Sadly there is no decision table showing which patterns to use when, neigther in the book nor on the job.
Thomas.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, there *are* some guidelines that can help you to choose between patterns. I'd highly recommend reading Fowler's "Refactoring" book.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic