1 Reply Latest reply: Mar 13, 2011 3:32 PM by jschellSomeoneStoleMyAlias RSS

    Design assistance

    846956
      Hi all,

      I am developing an application at present and am currently at a cross roads as to how to proceed. I've simplified the step I'm at with the application needs at the moment into its core components below.

      I have 10 String values which contain Xml. Each of these strings is an "Xml method". Some of these Xml methods take two parameters from the user, some of the methods take three parameters. When the parameters are entered, a service sends the xml method to my testbed network platform (something I'm experimenting with at present - not relevant) and a response is returned.

      To summarise my issue, there are 10 string xml methods - each of these methods takes different parameters, executes different behaviour, and returns varying responses. Does anyone have any advice on how I should design this? Should I have an XmlMethodCommand base class and a seperate class for each of the 10 xml method commands that extends that class? How would one deal with the different amount of parameters that could be passed in?

      Any advice or links to relevant documentation would be apreciated! Thanks!

      Dave
        • 1. Re: Design assistance
          jschellSomeoneStoleMyAlias
          You don't have just a method. You have a method and a definition.

          So first step is to design a data model that describes both the method and the details of running the method.

          Certainly number of parameters would go in it. I bet type of parameter would help as well. As since probably the parameters are string a length is good. Even a regex might work for validation. But at any rate a collection of data attributes that describe how to run it. Probably includes the xml blob as well.

          Then how to implement it. You could hard code it. Or put it in a database. Myself I would probably put it in a configuration file.