1
vote
1answer
253 views

Interface Dependencies or Abstract Classes

I have a decision to make and I am wondering what would be the better solution. I am refactoring an older application and intend to really get into the nuts and bolts of it. There are 8 report types ...
4
votes
1answer
266 views

Is using protected inheritance to hide (but exploit) implemented interface from the public ok?

Recently, we had a discussion about code using protected inheritance in order to hide the fact (to client code) a class inherits from a specific base class but to exploit this fact in the ...
2
votes
3answers
90 views

Can certain expectations of behavior be part of an interface's contract?

Given the following code: public interface IUserDataProvider { ICollection<SomeClass> getSomeClassRecordsForUser(int idUser); } Is it possible to define (via documentation) an ...
4
votes
1answer
192 views

Can a common interface be defined for Cartesian and Polar coordinate data?

I'm rewriting a set of file readers that a former-colleague of mine created that read raw-point data of XYZ (Cartesian) coordinates or RTZ (Polar) coordinates. Currently the data is stored directly in ...
1
vote
3answers
219 views

Should I use an interface when methods are only similar?

I was posed with the idea of creating an object that checks if a point will collide with a line: public class PointAndLineSegmentCollisionDetector { public void Collides(Point p, LineSegment s) { ...
8
votes
6answers
5k views

What are the differences between abstract classes, interfaces, and when to use them

Recently I have started to wrap my head around OOP, and I am now to the point where the more I read about the differences between abstract classes and interfaces the more confused I become. So far, ...
9
votes
7answers
2k views

Interfaces on an abstract class

My coworker and I have different opinions on the relationship between base classes and interfaces. I'm of the belief that a class should not implement an interface unless that class can be used when ...
7
votes
4answers
2k views

Can I consider interface methods as abstract methods?

I was thinking about that, and I had some doubts. When I declare an interface, for example: public interface MyInterface { public void method1(); public void method2(); } Could these ...