aspose file tools*
The moose likes OO, Patterns, UML and Refactoring and the fly likes Design pattern for handling multiple String inputs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Design pattern for handling multiple String inputs" Watch "Design pattern for handling multiple String inputs" New topic
Author

Design pattern for handling multiple String inputs

Elchin Asgarli
Ranch Hand

Joined: Mar 08, 2010
Posts: 222

I have a code similar to following:


This code honestly speaking looks a bit ugly to me, so I was thinking of the ways to refactor it. I do have few ideas of refactoring this, however before reinventing wheel, I wanna to know if there is already any design pattern made to solve such situation. The problem seems common enough to me, so is there a common pattern to refactor it? Did anyone have an experience with such situations?


Personal page, SCJP 6 with 91%, SCWCD 5 with 84%, OCMJD
Ramon Anger
Ranch Hand

Joined: Apr 19, 2011
Posts: 56

Hi Elchin,

this topic has been discussed here several times.
See for instance http://www.coderanch.com/t/99377/patterns/Chained-if-else-statements-avoid

Best regards,
Ramon


Blackbelt on BlackBeltFactory.com.
 
 
subject: Design pattern for handling multiple String inputs