You will always have the joy of using enums, but have you ever thought that enums demonstrate the common characteristics of Object Oriented Design? I.e inheritance and abstraction. So what stops you from creating your own enum construct with the available constructs, i.e classes. I was just playing around with them and could build one. Let's first get to know the characteristics of an enum. Characterics of an enum Enums cannot be instantiated with the 'new' keyword since the constructor is private. Enums can contain only a finite set of states. i.e the value/s an Enum can contain should have been defined already. Enums do behave as regular classes complying with the OOD features like inheritance, polymorphism, encapuslation and abstraction The only exception I have noticed is that it does not allow generics, at least in Java 8. Those above properties can be achieved with some already available constructs. Good news is additional benefits can also be gained; generics!. Since...
'Final' keyword is a powerful modifier used in Java and in other OOP languages to denote that a given construct is no more extensible. Rather than a mere keyword, I would argue it's a 'key trade off' decision, by looking at the future and arriving at the conclusion whether we should really allow further extensibility in a given construct or limiting it. The final keyword is applied at 3 levels; at class level, at method level and at field level. It's a simple decision to decide whether or not one should apply the 'final' keyword at method or field level, so in this short note, I am focusing on the 'final' at the class level. By using the 'final' keyword in front of a class, you are essentially sealing the class off and preventing any further 'extensibility' of it, violating one of the SOLID principles, 'open to extension and closed to modification'. This violation means that you cannot create a subclass to add the new...