M
Marius Horak
As in subject.
Thanks
MH
Thanks
MH
Andreas Håkansson said:Marius
I would say that the previous reply to your post was more constructive
then your question. Please post a proper question, stating what you are
wondering and why.
situations".If you do not want to provide more information then
what you already have done, then you will have to do with the short answer
"Yes there are good reasons for not using interfaces in SOME
Andreas Håkansson said:Many of us spend our time helping people on this list, so there is no
need to be rude when someone asks you to clairify your question so a
correct answer can be given.
Andreas Håkansson said:Marius,
Once an interface has been published it may never be changed or
you will be breaking it. If you need to add a new parameter to an existing
interface method then you should create a second interface which contains
the new method overload and implement it. Then you have the old method
throw an NotImplementedException.
Any good reason for not using an interface for what?
I can bet that he/she does not do it everytime so his/her action (reaction)
is selective.
And all of this fuss can be avoided by not using interface.
Andreas HÃ¥kansson said:Many of us spend our time helping people on this list, so there is n
need to be rude when someone asks you to clairify your question so
correct answer can be given
Why I asked the question?
Well, I have to maintain an old system where most of objects are based on
interface.
In one case I have to add a new parameter to one of the methods.
This interface is used as base for 42 objects but the change is relevant to
one object only.
Without interface all would be simple as the method is referenced by the
object 7 times. With interface I face changing 411 lines adding useless
parameter or to create a separate object that will be 99% like other 41
objects.
Having this experience I will never use interface in my code.
Very simple, if you don't like interfaces, rewrite the code.
If you don't like my responce, don't bother to use your brain and respond,
just press the delete button if is not too much effort.
If you are polite to people, then they will respond polite too.
If you have to edit this many lines of code then that only means that the
original code is used in a "wrong" way to create interfaces and not in the
OOP way.
We are talking about a design fault here from the original programmer! He
simply did not understand enough about interfaces when he started creating
this.
The design of interfaces tells you that you have to duplicate the code and
assign a new ID to that interface to add the new function.
This is why you will find many documenst describing interfaces like this:
IMyInterface, IMyInterface2, IMyInterface3....
Interface does not contain code but maps external published functions to
inside published functions similar like dll entry points.
You are probably one of those designers that perfer to stick in a DOS
console way of programming, but the bad news is that DOS is getting outdated
fast.
You have a choice, evolve or get extinct.
For your information, the world is evolving to .NET so interfaces are also
old technology. Better to start learning the new stuff now. It takes a few
years to get to learn how to use it. Unless you want to sell DOS PC's.
only good for one specific part of a program, and uesless for the rest,TT (Tom Tempelaere) said:Why I asked the question?
Well, I have to maintain an old system where most of objects are based on
interface.
In one case I have to add a new parameter to one of the methods.
This interface is used as base for 42 objects but the change is relevant to
one object only.
Then your interface is not designed well. If a change to an interface is
You are probably one of those designers that perfer to stick in a DOS
console way of programming, but the bad news is that DOS is getting outdated
fast.
You have a choice, evolve or get extinct.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.