UML Class Diagram: Abstract or Interface?
Posted
by
J Smith
on Programmers
See other posts from Programmers
or by J Smith
Published on 2014-04-05T15:31:23Z
Indexed on
2014/06/05
9:42 UTC
Read the original article
Hit count: 369
I am modeling a class diagram and have spotted an opportunity to simplify it slightly. What I want to know is, would this it be better to implement an abstract class or an interface?
The scenario is this, I have the classes:
- Artist
- Genre
- Album
- Song
All of which share the methods getName, setName, and getCount (playcount that is). Would it be best to create an abstract 'Music' class with the aforementioned abstract methods, or should I create an interface, since the classes that implement the interface have to include all of the interface's methods (I think, correct me if I'm wrong).
I hope I've given enough detail, please ask questions if I haven't.
Thanks!
© Programmers or respective owner