all groups > dotnet remoting > may 2006 >
You're in the

dotnet remoting

group:

Versioning question


Versioning question Rick
5/23/2006 1:42:07 PM
dotnet remoting: Let me preface my question by stating that I'm a remoting newbie...
I've inherited a project that the first version was designed and coded
by an outside consulting company. I've been asked to make some changes

I've got a client and a server that implement a common interface:

using System;

namespace Company
{
public interface IData
{
// Methods
bool SaveActivity(Activity a, string username, string password);
bool SaveActivity(string username, string password, int
ActivityTypeID, DateTime FollowUpDate, int TimeSpent, bool isOpen,
string notes, int client_id, DateTime ActivityDate, string Subject,
bool ShowOnCreatorHome, string FileName, bool TeamAccessOnly, string
FilePath, int fileSize);

}
}


In the same assembly as the interface, I've got an Activity object:


using System;

namespace Company {
[Serializable]
public class Activity {
private int _ActivityTypeID;
private DateTime _FollowUpDate;
private int _TimeSpent;
private bool _IsOpen;
private string _Notes;
private int _client_id;
private DateTime _ActivityDate;
private string _Subject;
private bool _ShowOnCreatorHome;
private string _FileName;
private bool _TeamAccessOnly;
private string _FilePath;
private int _fileSize;

public Activity() {
}

public Activity(int _ActivityTypeId, DateTime _FollowUpDate, int
_TimeSpent, bool _IsOpen, string _Notes, int _client_id, DateTime
_ActivityDate, string _Subject, bool _ShowOnCreatorHome, string
_FileName, bool _TeamAccessOnly, string _FilePath, int filesize) {
this._ActivityTypeID = _ActivityTypeId;
this._FollowUpDate = _FollowUpDate;
this._TimeSpent = _TimeSpent;
this._IsOpen = _IsOpen;
this._Notes = _Notes;
this._client_id = _client_id;
this._ActivityDate = _ActivityDate;
this._Subject = _Subject;
this._ShowOnCreatorHome = _ShowOnCreatorHome;
this._FileName = _FileName;
this._TeamAccessOnly = _TeamAccessOnly;
this._FilePath = _FilePath;
this._fileSize = filesize;
}

public int FileSize {
get { return _fileSize; }
set { _fileSize = value; }
}

public int ActivityTypeId {
get { return _ActivityTypeID; }
set { _ActivityTypeID = value; }
}

public DateTime ActivityDate {
get { return _ActivityDate; }
set { _ActivityDate = value; }
}

public DateTime FollowUpDate {
get { return _FollowUpDate; }
set { _FollowUpDate = value; }
}

public int TimeSpent {
get { return _TimeSpent; }
set { _TimeSpent = value; }
}

public bool IsOpen {
get { return _IsOpen; }
set { _IsOpen = value; }
}

public string Notes {
get { return _Notes; }
set { _Notes = value; }
}

public int Client_Id {
get { return _client_id; }
set { _client_id = value; }
}

public string Subject {
get { return _Subject; }
set { _Subject = value; }
}

public bool ShowOnCreatorHome {
get { return _ShowOnCreatorHome; }
set { _ShowOnCreatorHome = value; }
}

public string FileName {
get { return _FileName; }
set { _FileName = value; }
}

public bool TeamAccessOnly {
get { return _TeamAccessOnly; }
set { _TeamAccessOnly = value; }
}

public string FilePath {
get { return _FilePath; }
set { _FilePath = value; }
}
}
}

The requested change will require an additional field in the Activity
object (int FileType). Is the best solution to create a new assembly
with a new interface and a new Activity object, inheriting from the
old? The odd thing (to me) about this is, if I inherit the old
interface in the new one, I still have to implement the old methods in
the new client. I understand the server would need the old
implmentation for backwards compatibility.

Hope this makes sense....

ANY suggestions would be greatly appreciated!!
RE: Versioning question William Sullivan
6/1/2006 6:29:01 AM
This isn't really a remoting question, but I'll bite. Whenever you change an
interface, you require all referenced code to be recompiled. A definite
breaking change. But it appears that what you need to do will be a breaking
change anyhow, so it doesn't matter. I would just start fresh; it doesn't
appear that you would gain anything by the new interface extending the old
one. I would also make a couple suggestions:

Your interface's methods take an amazing number of parameters, which isn't
the best thing. You might want to create a simple class (or struct) that
contains the data you need to pass and have the interface's methods accept an
object of that type as its sole parameter. Put the implementation of this
object in a different assembly from the interface to allow you to more easily
change what information is kept in that object without disturbing the
interface.

You might also consider having your interface take an IDictionary object as
its sole parameter. Your callers can define whatever key value pairs they
want to pass via the interface. You lose type safety, but you gain extreme
flexibility for the types of data passed.

[quoted text, click to view]
AddThis Social Bookmark Button