concurrency - How to provide for IPC API backward compatibility -


I am preparing a (SOAP) inter-process communication protocol for calling functions on a network. I want to ensure that an old client can talk to a new server

  • After thinking about it for a while, it seems that I can only do one thing:
  • Adding function functions makes it possible
  • Adding function parameters
  • However, when the functionality of the server changes completely, it is not enough for example:

    • A parameter that needs to be moved from one function call to another.
    • A parameter type that changes, for example, on a string from an integer.

    My question is, can such changes be done while living in backward compatible, or can not they be made to make the only option?

    Note: I know, I am suffering from it, but in my opinion this question does not invalidate.

  • You have not said that how you implement the IPC, so I have some bad assumptions here I can make Anyway, from the top of my head, there are some arguments on this issue in such a way.

    First of all, about changing the parameter order / type, you can use a dynamic language like Python.

      & gt; & Gt; & Gt; Def Discriminate (A, B, C): ... Returns B * B - 4 * A * C & gt; & Gt; & Gt; Discrimination (1,8,2) 56 & gt; & Gt; & Gt; & Gt; & Gt; & Gt;  

    Python allows you to use the named parameter so that you can name the variable in any order, and all variables are dynamically written by you.

    A less efficient approach to the ordering issue may be to pass all the arguments as a dictionary (written in Python, but which can be adapted for language):

      & gt; & Gt; & Gt; Def dc2 (in_dict): ... return in_dict ['b'] * in_dict ['b'] - 4 * in_dict ['a'] * in_dict ['c'] ... & gt; ; & Gt; & Gt; D = dict (a = 1, b = 8, c = 2)> gt; & Gt; & Gt; D {'a': 1, 'c': 2, 'b': 8}> gt; & Gt; In order to expand on this  idea, you can also include a "version" field in your dictionary (or arguments, whatever) the server adjusts according to incoming arguments. This is not a dictionary, you can also enter the version field in packaged with IPC message. This can be an unfair example, but you can also lose the fields in such a way.  
      & gt; & Gt; & Gt; Diff D3 (D): ... if d ['version'] == 1: # original spec ... returns d ['b'] * d ['b'] - 4 * d ['a'] * D ['C'] ... and: # New customers are returning the small values ​​of C ... Return D ['B'] * D ['B'] - 4 * D ['A'] * (2 * d) ['c']) ... & gt; & Gt; & Gt; D ['version'] = 1> & gt; & Gt; & Gt; Disc 3 (D) 56 & gt; & Gt; & Gt; D ['version'] = 2> gt; & Gt; & Gt; Disc 3 (D) 48  

    Comments

    Popular posts from this blog

    c++ - Linux and clipboard -

    What is expire header and how to achive them in ASP.NET and PHP? -

    sql server - How can I determine which of my SQL 2005 statistics are unused? -