Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Which Design pattern to use ?

 
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
The longest recorded flight time of a chicken is 13 seconds. But that was done without this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic