Design problem - Abstract or Interface
I am making a graphical application for a class. The problem is simple in that i need to create an array that stores a bunch of circles, but only if they don't intersect with a previous circle. This part is easy; however, I wanted to expand the functionality to allow for more shapes(like a square to be drawn). What in your opinions should i design it as. Either a interface or an abstract class - both seem to work and yet don't. Thanks for any help in this matter.
I think this depends on your exact usage. If this class will only ever be used to draw shapes then an abstract Shape class seems appropriate, with a method called something like draw() (among other things) that it could call.
If you want it to be able to draw anything, things that are otherwise unrelated, then an interface called Drawable (or something similar) would be appropriate. This would again have a method called draw() etc that would be used to draw it.
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL