Small Java Programming Quick Tips
- Build Java class starting from the default scope before making way up to the protected scope and then the public scope.
- Use small short-lived immutable objects as opposed to large objects as much as possible.
- Restrict the use of getters/setters and if one is provided, ensure the attribute get/set is immutable and not modifiable via reference (eg. elements in a collection).
- Methods should return either a value or an exception. Returning a null object is not recommended and should be limited to checking that a variable has been removed/cleared/nullified.
This entry was posted in Program Coding
and tagged java
. Bookmark the permalink