This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Should I use Chain of Responsibility in mode choose? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Should I use Chain of Responsibility in mode choose?" Watch "Should I use Chain of Responsibility in mode choose?" New topic
Author

Should I use Chain of Responsibility in mode choose?

Paulo Diogo
Greenhorn

Joined: May 26, 2013
Posts: 5
Is a good choice use Chain of Responsibility in mode choice? Will I add complexity unnecessary in the project or it's does not matter?


mode = client mode, alone mode or server mode
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5147
    
  12

Extra complexity should always be avoided, simplicity is king! Because extra complexity means more code, more code means more (chance of) bugs, more maintenance cost,...

I don't see why you would use chain of responsibility in mode choice Because mode parameter is passed as a command line parameter to main method


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Paulo Diogo
Greenhorn

Joined: May 26, 2013
Posts: 5
Roel De Nijs wrote:Extra complexity should always be avoided, simplicity is king! Because extra complexity means more code, more code means more (chance of) bugs, more maintenance cost,...

I don't see why you would use chain of responsibility in mode choice Because mode parameter is passed as a command line parameter to main method


I passed the mode for the chain... but you are right... I will use a simple factory
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5147
    
  12

But what are/were you trying to achieve with the chain? Creating the user interface? Processing a request? Or something else?
Paulo Diogo
Greenhorn

Joined: May 26, 2013
Posts: 5
Roel De Nijs wrote:But what are/were you trying to achieve with the chain? Creating the user interface? Processing a request? Or something else?



I received the param and passa to chain...



I changed to factory...


Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5147
    
  12

Paulo Diogo wrote:I changed to factory...

Very good decision Chain of Responsibility isn't intended for this purpose.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Should I use Chain of Responsibility in mode choose?
 
Similar Threads
What Design Pattern should I use?
mapping a string to a method call
Help Identify the Design Pattern
Modifying vs inheritance
SCDJWS Beta : Some findings/points