Enums & Annotations
Use enums instead of integer constants
Before the introduction of enums, it was common practice to use integer constant values to indicate different variations of domain constants.
Use enums instead of integer constants
Before the introduction of enums, it was common practice to use integer constant values to indicate different variations of domain constants.
26. Don’t Use Raw Types
Since Java 5, generics were introduced. However, before that Collections (e.g. List) where still part of the language.
With generics it became possible to declare, inside the diamond declaration (), which type a List would be working with. Without a diamond declaration, it would be classified as a raw type.
Because of backwards compatibility these raw types where not removed after java 5’s release. However, regardless of them being part of the language, they should never be used.
Raw types enable the possibility to add unintended objects to the List, which will throw an exception at runtime.
Your Code as a Crime Scene (Affliate Link) is essentially a book about utilization of version control systems (VCS) to analyze and determine hotspots in the codebase.
15. Limit Accessibility To Classes And Members
Generally, any class or member of a class should have the lowest possible access level, which still allows for its functionality to work.
API Example:
Take the case of an externally exposed API, where the interface represents all public accessible methods. Any implementation of this interface should only have public access level on the implemented methods.
The additional members of the implementing class should never be made public. Ideally private or package-private if required for unit testing.
In the case of the exposed API, any publicly available member of the implementation will have to be supported forever, if they have once been published. If members are degraded to a lower access level, it will ruin the API’s backwards compatibility.
Hobby projects can sometimes be frustrating.
Not because of the challenges you meet on the way, but because of the time you have to allocate on it. Where do we find these small windows of time? Isn’t it just because we prioritize something else?
I have now for more than a month worked remotely while traveling to multiple locations around the world and have through this experience learned a thing or two of how to adapt to this sort of situation.