Design Issues

  • Thread starter Thread starter Ramakant
  • Start date Start date
R

Ramakant

Hi,

I am creating an object say File in the middle layer. I have designed
methods like Delete, Update etc. I also want the static versions of these
methods. So having the two methods with different signatures. The instance
method is parameterless and calls the static method which has paramerters.
This design is useful in my project. But I want the second opinion if this
design is good? And that if there could be any issues in the future?

Regards,

Ramakant K
 
If you are duplicating code, then it might not be the best design. However
creating methods available through the instance is fine if they have a
relevance to that instance (which you say is the case too).
Therefore I would probably do what you are doing, but have the instance
methods call the static methods to save on code duplication.

Br,


Mark Broadbent

mcad, mcdba , mcse+i
 
There is a similar pattern followed by System.IO.File and System.IO.FileStream - providing both instance methods and static methods (albeit not on the same class) to acheive the same thing. The critical difference between the two is that a CAS demand is issued for every static call to the File class whereas with a FileStream onoly performs the demand in its ctor

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

If you are duplicating code, then it might not be the best design. However
creating methods available through the instance is fine if they have a
relevance to that instance (which you say is the case too).
Therefore I would probably do what you are doing, but have the instance
methods call the static methods to save on code duplication.

Br,
 
Back
Top