File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Why should I use design patterns ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Why should I use design patterns ?" Watch "Why should I use design patterns ?" New topic
Author

Why should I use design patterns ?

Leonildo Campos
Ranch Hand

Joined: Jun 02, 2003
Posts: 33
Why is J2EE so tied with design patterns ?
Thank you. Masters.


"Put yourself on view. This brings your talents to light."<br />Leonildo Campos<br />SCJP 1.4<br />SCWCD
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

http://java.sun.com/blueprints/patterns/


Groovy
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Why is J2EE so tied with design patterns?

J2EE is not "tied" with design patterns. Applying known design patterns just happens to be a best practice in the field of software engineering.
Sun has made noise about using design patterns with Java/J2EE for a long time while the Microsoft camp was relatively silent. Nevertheless, the Microsoft camp has been (hopefully) using design patterns as well.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

Sun has made noise about using design patterns with Java/J2EE for a long time while the Microsoft camp was relatively silent.

There was a joke at www.theserverside.com where Microsoft says "J2EE needs design patterns because J2EE is bad".
Leonildo Campos
Ranch Hand

Joined: Jun 02, 2003
Posts: 33
Hummm. I understood.
Design pattern is for world wide languages. Not for you-must-buy-my-license languages.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

Originally posted by Leonildo Campos:
Hummm. I understood.
Design pattern is for world wide languages. Not for you-must-buy-my-license languages.

The book GoF talks about general design patterns. Most of the J2EE design patterns are based on Gof like Session Facade.
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
Originally posted by Leonildo Campos:
Why is J2EE so tied with design patterns?

I don't aggree that J2EE is tied with Design Patterns... but I do concede that Design Patterns are considered very important by many in the J2EE community (and in other communties as well). I think part of the reason for this is the scope and complexity of J2EE. There are many ways to accomplish the same task and more than enough rope to hang yourself with. For this reason, people in the J2EE community have come together and defined a set of best practices in terms of Design Patterns.
It always scares me to meet a "J2EE Architect" that doesn't have any knowledge the Design Patterns (in particular GoF and Core J2EE Patterns), he is doomed to make the same mistakes as those before him. J2EE is a tricky river to navigate; Design Patterns serve as our guide.
Vedhas Pitkar
Ranch Hand

Joined: Jan 27, 2001
Posts: 445
Hi,
even if you dont use Design Patterns directly,you will find that you may be using them unknowingly.For eg keeping the database connection in a separate class file etc.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

Originally posted by Vedhas Pitkar:
Hi,
For eg keeping the database connection in a separate class file etc.


Can you tell me the name of the pattern?
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Are you referring to DAO?
Gayathri Prasad
Ranch Hand

Joined: Jun 25, 2003
Posts: 116
Hi,
Design patterns are the effective way of attacking problems. Design patterns evolved by the experience of the architects. Re-inventing the wheel is NOT the game redesigning is....Thus patterns provide an efficient way to solve a problem.
Cheers,
Gaya3
Leonildo Campos
Ranch Hand

Joined: Jun 02, 2003
Posts: 33
Hi all,
Is the MVC2 a good design pattern for non-internet applications ? Why ?
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

MVC can be applied to any application that has user interface. The MVC pattern has its root in Smalltalk application. MVC acheives loose coupling among various components of an application.
Read more about MVC here
http://java.sun.com/blueprints/patterns/MVC-detailed.html
Originally posted by Leonildo Campos:
Hi all,
Is the MVC2 a good design pattern for non-internet applications ? Why ?
Vedhas Pitkar
Ranch Hand

Joined: Jan 27, 2001
Posts: 445
Originally posted by Lasse Koskela:
Are you referring to DAO?

Well,somewhat.Am I wrong,Pradeep,Lasse ?Keeping the database related stuff in one class file or related package,at least we are using it.
[ August 27, 2003: Message edited by: Vedhas Pitkar ]
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
I think the MVC2 (or "Model 2") architecture was designed especially for J2EE applications so in that way it won't fit into non-internet applications. You could ofcourse use the architecture by "porting" the concepts into a Swing application, for example, but I don't know whether it would work in that environment.
Leonildo Campos
Ranch Hand

Joined: Jun 02, 2003
Posts: 33
Thank you
Lasse Koskela and Pradeep Bhat
Do you know the best design pattern for wireless applications in PDAs ?
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
Originally posted by Lasse Koskela:
I think the MVC2 (or "Model 2") architecture was designed especially for J2EE applications so in that way it won't fit into non-internet applications. You could ofcourse use the architecture by "porting" the concepts into a Swing application, for example, but I don't know whether it would work in that environment.

Actually, MVC has been around since the 70s and Smalltalk. It is very applicable to rich clients, actually it orignated in rich clients.
MVC2 (terrible name), as Lasse pointed out, was previously referred to as Model 2 by Sun. It is basically a MVC architecture which uses a Servlet as the Controller, Java classes or EJBs as the Model, and JSP or some other templating engine as the View. Struts and WebWork are two widely available examples of MVC2.
For more information on general MVC concerns (and other architectural patterns), I suggest: Patterns of Enterprise Application Architecture.
For more information on MVC in the context of J2EE, I suggest this week's promo book: Core J2EE Patterns: Best Practices and Design Strategies.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why should I use design patterns ?
 
Similar Threads
how many design patterns are there?
Head First Design Patterns
What technologies or tools or frameworks or APIs are must for SCEA?
JSP and Servlets: what's the least understood topic by exam candidates...
Scored 86% in SCWCD.Once Again My HeartFelt Thanks Kathy,Bert and Bryan