This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes OO, Patterns, UML and Refactoring and the fly likes Which Design pattern to use ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Reply Bookmark "Which Design pattern to use ?" Watch "Which Design pattern to use ?" New topic
Author

Which Design pattern to use ?

shukla raghav
Ranch Hand

Joined: Aug 03, 2008
Posts: 184
Here is my scenario

1. In my application I have a module : CommunicationMgmtSystem
2. CommunicationMgmtSystem (Package) has two submodules : MailMgmtSystem(package) and MobileMgmtSystem(package)
3. other modules call CommunicationMgmtSystem for sending automated mails or SMS, CommunicationMgmtSystem delegates the task of sending mails or SMS to respective submodule MailMgmtSystem or MobileMgmtSystem

I dont want other modules except CommunicationMgmtSystem to be able to access MailMgmtSystem/MobileMgmtSystem 's classes?
Arnold Reuser
Ranch Hand

Joined: Nov 20, 2003
Posts: 193
To answer this question. Your description is about the open closed principle.
Most applicable patterns are template method or strategy pattern.
You can differ between these two based on the answering the following question :
* Are you redefining a step of an algorithm without changing the algorithms structure. A positive answer on this will result in the template method.
* Are you redefining the structure of the algorithm used. A positive answer on this will result in the strategy pattern.
shukla raghav
Ranch Hand

Joined: Aug 03, 2008
Posts: 184
Hi Arnold,

My purpose is to modify the abstract factory pattern

You can get products from the factory by passing the relevant parameter. But i does not restrict any other class from accessing the product directly using new operator. How do we apply "Constraints" in abstract factory. I dont want to use reflection because it is expensive.

 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Which Design pattern to use ?
 
Similar Threads
SMS and MIDP(Urgent !!!)
Open or start a file using JSP
sending sms through mobile
struts + sending sms on registration
please help!urgent...on javamail API.