Hi guys.
I've a situation and I would like to read some opinion from the experience people.
I'm trying to decide which approach to use, if possible, without using IF.
I've a
Servlet that receive messages from many servers, each server has a different
pattern of message. e. g. Server 1, pattern of msg 1. Server 2, pattern of msg 2.
For each pattern I've a Decode class, e. g. Pattern 1: Pat1Decode, Pattern 2: Pat2Decode and each message has the server name on it.
How should I implement this on my Servlet? Using a Factory Pattern?
I would like to remove the logic from the Servlet and a clean solution without use:
If message is from server 1: Use Pat1Decode
If message is from server 2: Use Pat2Decode
Thanks