When composing object hierarchies, it is often useful to create abstract classes, those meant for extension not instantiation and final classes, those meant for instantiation not extension. The same modifiers are also useful at the method level.
For example, LiCK contains a class AbstractBounce which as the comment says is not meant to be instantiated, it only provides functionality shared among concrete subclasses. Ideally this class would be marked with an abstract class modifier so that it cannot be instantiated and its easeIn(float) and easeOut(float) methods marked with a final method modifier so that they cannot be overridden. Then the concrete subclasses BounceIn, BounceOut, and BounceInOut could be marked with a final class modifier so that they cannot be extended.
When composing object hierarchies, it is often useful to create
abstract
classes, those meant for extension not instantiation andfinal
classes, those meant for instantiation not extension. The same modifiers are also useful at the method level.For example, LiCK contains a class AbstractBounce which as the comment says is not meant to be instantiated, it only provides functionality shared among concrete subclasses. Ideally this class would be marked with an
abstract
class modifier so that it cannot be instantiated and itseaseIn(float)
andeaseOut(float)
methods marked with afinal
method modifier so that they cannot be overridden. Then the concrete subclasses BounceIn, BounceOut, and BounceInOut could be marked with afinal
class modifier so that they cannot be extended.https://github.com/heuermh/lick/blob/master/AbstractBounce.ck
For reference, here are the definitions per the Java Language Specification
abstract
class modifier http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.1.1.1final
class modifier http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.1.1.2abstract
method modifier http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.4.3.1final
method modifier http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.4.3.3