I am writing an application that translates JSON messages to SOAP messages. Currently I am handling 16 JSON messages and 20 SOAP messages.
I have defined embedded schemas to validate the incoming JSON messages and to build the XML SOAP message using heex templates.
I have a Parse module with a multiple clause parse function for each incoming message. I also have a Convert module with a multiple clause convert function for each JSON message. This same pattern is repeated in other modules and each module has hundreds of code lines.
I feel this is a smell for bad code organization. Am I right?
I have the idea to use protocols to reorganize my app. I would move each parse and convert function to the corresponding schema file. Is it a good idea?
Would my code be more object oriented (which I want to avoid)?
I appreciate any comments.