I have a class called
Timeline. I want to allow several defaults in my code, such as a
Timeline with a
Start event (The details are not needed. All that matters is that I have a class, and I want to be able to have a few different default setting). Here are the options I thought of:
1) Following a GUI/Swing inspired idea, I might want to subclass the
Timeline class and, in its constructor, use the public functions to set the default. Then, I could later just instantiate those objects instead of the superclass
2) A factory class could have functions like "getTimeLineWithExplosion" and set everything up.
Which of those two is the better idea? Is there a design pattern better than both of them?
PS: This is implemented in Java, but could easily be in another language.