Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2007

Tip: Looking for answers? Try searching our database.

What design plattern is needed to solve my problem?

Thread view: 
howa - 03 Jul 2007 17:36 GMT
Hello, I want to ask...

What design plattern is needed to solve my problems below?

P1.

Input -> ProcessA -> ProcessB -> ProcessC -> Output

Suppose Process A, B, C might use different alogorithm to solve,

e.g. ProcessA (A1, A2, A3), ProcessB (B1, B2), ...

so my program should be flexible enought to change the alogroithm on
runtime.

P2.

Similar to P1, but when some algorithms are selected, the flow
changed, e.g.

If I use A1, I can only use B2, but not B1

So considering both as 2 questions, what kind of plattern you would
suggest?

thanks.
bencoe@gmail.com - 03 Jul 2007 19:36 GMT
> Hello, I want to ask...
>
[quoted text clipped - 22 lines]
>
> thanks.

Just use an Abstract Class (or an interface for that matter) for your
algorithms, I don't think you need any thing too fancy for what you're
describing --

If you really do feel like being fancy, try the strategy pattern.

http://en.wikipedia.org/wiki/Strategy_pattern

Ben.
howa - 04 Jul 2007 03:45 GMT
On 7 4 ,   2 36 , ben...@gmail.com wrote:

> > Hello, I want to ask...
>
[quoted text clipped - 34 lines]
>
> -         -

Thanks. I think this is what I looking for.
Roedy Green - 03 Jul 2007 21:35 GMT
>So considering both as 2 questions, what kind of plattern you would
>suggest?
It has been quite a while since I read the book.  The one that my gut
says is a likely candidate is Command.

You might also check out Chain Of Responsibility.  I forget what it
does.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.