LumbergTech
Diamond Member
I am not looking for a philosophical argument, but a practical implementation.
I am receiving XML messages from a client and I need to process them on a server and return messages which contain quite a few values. The return messages will also be in XML and I do not have a choice to change this.
Once I receive a message, I parse the message and figure out the values that need to be sent in the return message.
I am trying to break out the code that creates the return messages into a separate class. So the server figures out what kind of message needs to be sent, and the values, but then another class should compile my XML message so that the server code is not incredibly cluttered up.
The problem I am running into is that I can receive a variety of messages. The responses have a format that shares some commonalities, but they also change to a fair degree.
What kind of class design can I use? Right now I am confused because I feel like I have a massive number of parameters that must be sent to the message building class for some of the messages that must be returned. I really don't want to do it all in the server because the code has become long and messy.
Right now I have a:
Server class that processes 1 message at a time
and also a Message building class that can generate the types of packets required
What is the best way to get the data to the message building class? OR should I be doing something else entirely?
For reference, the messages sent between the client and the server can contain up to like 30 values which are spread out between text fields in XML elements and attributes on those elements.
I am receiving XML messages from a client and I need to process them on a server and return messages which contain quite a few values. The return messages will also be in XML and I do not have a choice to change this.
Once I receive a message, I parse the message and figure out the values that need to be sent in the return message.
I am trying to break out the code that creates the return messages into a separate class. So the server figures out what kind of message needs to be sent, and the values, but then another class should compile my XML message so that the server code is not incredibly cluttered up.
The problem I am running into is that I can receive a variety of messages. The responses have a format that shares some commonalities, but they also change to a fair degree.
What kind of class design can I use? Right now I am confused because I feel like I have a massive number of parameters that must be sent to the message building class for some of the messages that must be returned. I really don't want to do it all in the server because the code has become long and messy.
Right now I have a:
Server class that processes 1 message at a time
and also a Message building class that can generate the types of packets required
What is the best way to get the data to the message building class? OR should I be doing something else entirely?
For reference, the messages sent between the client and the server can contain up to like 30 values which are spread out between text fields in XML elements and attributes on those elements.
Last edited: