Results 1 to 3 of 3
Thread: Interface questoin
- 07-22-2011, 07:14 PM #1Member
- Join Date
- Mar 2011
- Rep Power
I am trying to figure out when to and not to use an interface. I have a class that implements my interface and the classes that call that use that interface are in different projects.
Now I want to create a new method within the class that implements the interface, however this time the method that will call it is within the same project and futhermore is in a helper class.
Is this clear enough for someone to help me decide if I should add the new method into the interface or not?
- 07-22-2011, 08:40 PM #2I want to create a new method within the class that implements the interface,
should add the new method into the interface
It would require you to change all the other classes that implement the interface.
- 07-23-2011, 01:16 AM #3
Like Norm said, it's your interpretation of how the design should be. There is no "must be" involved. My impression is that your "project with Interface" offers some services to the outer world, the interface is how the outer world should see this project and how it should communicate with the project via calls to this interface, and not bypass it (at least for this functionality). This interface should not be polluted with methods for project-internal use. You can compare it with private class-methods, but now on the level of projects: the same concept, but not enforced. Bottom line: you could (like making private methods public), but probably you shouldn't.
It would require you to change all the other classes that implement the interface.No bug ever had to calculate its fitnessfunction.