This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Design Patterns in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Design Patterns in Java" Watch "Design Patterns in Java" New topic
Author

Design Patterns in Java

sachin patel
Ranch Hand

Joined: Nov 28, 2000
Posts: 75
hi,
well i dont have much experiance with java and when i was looking at instruction for assignment i came across "Design Paterns" ... i searched for it on web and found many patterns can anyone suggest me which pattern are to be used...
Thanks in advance....


------------------
Sachin,
****************************************************
Learn from others mistakes. Life is too short to make all yourself.
****************************************************


Sachin,<P>****************************************************<BR>Learn from others mistakes. Life is too short to make all yourself.<BR>****************************************************
Jerry Pulley
Ranch Hand

Joined: Sep 19, 2000
Posts: 221
Sachin,
Here's some ideas. You're not likely to want to hand the client a reference to your Data class, so you'll want some kind of Proxy class through which the client can access it. The Proxy can also do things like manage your locking - you can always use a chain of Proxies if you don't want to put too much responsibility in one class.
You're going to want a way to generate these Proxies so you can give each client one when it connects. Sounds like a good place for one of the creational patterns like Factory Method or even Prototype.
If your server gets elaborate (I don't recommend it, but...), you're going to want some classes (like maybe a client registry or a lock registry) to have only a single instance. You can enforce this decision with Singleton.
Later, when you're building the client, you can use an Adapter to let your GUI use the same interface whether it's accessing a local database or your remote Proxy.
The Gang of Four book (Gamma, Helm, Vlissides, and Johnson) on design patterns is a good place to start. Here's a great link for pattern info and lots of other stuff: http://www.cetus-links.de/.
Enjoy your investigations,
Jerry
P.S. Sometimes I think I made all those mistakes myself...
Adrian Yan
Ranch Hand

Joined: Oct 02, 2000
Posts: 688
I think it's difficult to learn Design Patterns without UML, for those who are interested in Design Patterns, the very first book I recommend is Apply UML and Patterns. It's one of the best book out there (IMHO).
sachin patel
Ranch Hand

Joined: Nov 28, 2000
Posts: 75
Thanks Jerry and Adrian,

now it look i got a focus...
------------------
Sachin,
****************************************************
Learn from others mistakes. Life is too short to make all yourself.
****************************************************
 
 
subject: Design Patterns in Java
 
Similar Threads
Books for Design Patterns
Pattern Books
How are questions about Design Patterns?
J2EE Design Patterns: Where i can find a tutorial
Java and patterns