This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pattern: converters.

 
surlac surlacovich
Ranch Hand
Posts: 296
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Partners!
Please help with architectural decision.
I have 2 converters:

How to abstract from concrete converters to add new implementations in future?
 
Anayonkar Shivalkar
Bartender
Posts: 1557
5
Eclipse IDE Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi surlac,

I'm not sure if I got your question properly, but (especially in case of converters), I would use Abstract-Factory pattern - that is - an abstract factory - which will create a concrete factory (XMLConverterFactory or JSONConverterFactory) which will further create relevant concrete objects (XMLConverter or JSONConverter).

To make it even better, I would use an interface for converter (which will be implemented by all converters), an interface for node and so on.

I hope this helps.
 
surlac surlacovich
Ranch Hand
Posts: 296
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anayonkar Shivalkar wrote:
I'm not sure if I got your question properly, but (especially in case of converters), I would use Abstract-Factory pattern

You've got it right. Thanks for your advice.
So it can be used to load additional concrete converters from external jars, right? Separate from abstract factory jar.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic