CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

View Poll Results: Code clarity or code compatibility?

Voters
1. You may not vote on this poll
  • Keep the code compatible and forget consistency

    0 0%
  • Make the model clear and consistent and break code compatibility

    1 100.00%
  • I don\'t care either way

    0 0%
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 1999
    Location
    Dublin, Ireland
    Posts
    1,173

    Code compatibility or clarity and consistency?

    I am writing a new version of a dll I have made generally available (the EventVB.dll) and in doing this I am altering the object model (class names and enumerated type names mainly).

    However this extra clarity and consistency comes at a cost - the dll will no longer be backwardly code compatible if the existing code uses the changed functions (mainly in the area of windows hooks).

    The question is which should I pay most attention to - providing a consistent object model or providing code compatibility?
    (I realise I should have been consistent from the start, but hindsight s always 20:20)

    I'd appreciate your thoughts,
    Thanks in advance,
    Duncan
    '--8<-----------------------------------------
    NEW -The printer usage monitoring application
    '--8<------------------------------------------

  2. #2
    Join Date
    May 2002
    Location
    Quebec City, Canada
    Posts
    374
    It depends how many clients use this DLL. Obviously, if they want to use the new functionalities, they will need to adapt their code. There is no simple rule to decide what to do. One thing you could have done is provide the same interface but declare this interface as deprecated, but then it might be difficult to sustain two versions of the same thing.

    If I code for myself or my code is not provided as a SDK, I would think clarity is the way to go. If I already put my feet forward and the code has been downloaded by people, well, your guess is as good as I am, but usually, the situation will dictate what you should do. If a client wants compatibility, give him compatibility. Period.

    Good luck
    Last edited by proxima centaur; May 22nd, 2002 at 09:34 PM.
    Martin Breton
    3D vision software developer and system integrator.

  3. #3
    Join Date
    Feb 2001
    Location
    teh INTARWEB
    Posts
    542
    How about letting the size of the library grow a bit, and add another *copy* of the class with the new Name and arguments, etc. (Although there are less expensive *interfacing* options, if you plan to change ONLY the names) ?

    Then, as Martin said, announce the older classes as deprecated. People will slowly shift over to the new classes. Add new functionality only to the new classes. So developers wanting to utilize it will use the new Classes by itself.

    Later..after 2-3 versions, you can choose to remove the old code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured