Effective Java 2nd Edition: Difference between revisions
From My Limbic Wiki
No edit summary |
(→Core) |
||
| Line 2: | Line 2: | ||
=== Core === | === Core === | ||
==== 10 commandments: ==== | |||
* Use '''static factories''' and '''builders''' wisely. | |||
* Make classes '''immutable''' when possible. | |||
* '''Favor composition''' over inheritance. | |||
* Use '''Generics''' properly — never raw types. | |||
* Prefer '''Enums''' over constant values. | |||
* Validate arguments and maintain invariants. | |||
* Minimize variable scope and visibility. | |||
* Use '''exceptions''' only for exceptional cases. | |||
* Leverage '''modern concurrency utilities'''. | |||
* Write '''readable, safe, and self-documenting code'''. | |||
Revision as of 22:08, 5 October 2025
Book: Effective java 2nd Edition
Core
10 commandments:
- Use static factories and builders wisely.
- Make classes immutable when possible.
- Favor composition over inheritance.
- Use Generics properly — never raw types.
- Prefer Enums over constant values.
- Validate arguments and maintain invariants.
- Minimize variable scope and visibility.
- Use exceptions only for exceptional cases.
- Leverage modern concurrency utilities.
- Write readable, safe, and self-documenting code.