I have a coding style related question. In my example it is java, but I think this can be a generic question regarding languages that are changing rapidly.
I'm working on a java code base which was mainly written targeting java 8. The code was migrated to java 12. By migration I mean the code can run on jdk12, so the necessary library changes/additions were done. However the new language features haven't been used yet (e.g. var keyword).
My question is, what should be the approach to introduce new language elements from readability point of view? How important is consistency?
I have a few possible approaches in my mind.
- New language features should be used only in new classes
- New language features can be used in newly added parts of existing classes (e.g. a new method), even if the rest of the class is not updated.
- When a new language features are added to new parts of existing classes, then the rest of the class should be updated too
I know this question is a bit hard to answer (as coding style questions in general), but still I hope there will be some conclusion.