-
Notifications
You must be signed in to change notification settings - Fork 0
fraenku/java
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Item 1: Consider static factory methods instead of constructors
Item 2: Consider a builder when faced with many constructor parameters
Item 3: Enforce the singleton property with a private constructor or an enum type
Item 4: Enforce noninstantiability with a private constructor
Item 5: Prefer dependency injection to hardwiring resources
-> Classical by the use of constructor (or static factory, builder) or better by the use of a
dependency injection framework
Other variant with Java 8 use a supplier
Mosaic create(Supplier<? extends> tileFactory) { ... }
Item 6: Avoid creating unnecessary objects
Like String s = new String("k");
Boolean.valueOf("true") better than new Boolean(true)
https://www.gamedev.net/articles/programming/general-and-gameplay-programming/finite-state-machines-and-regular-expressions-r3176/
Item 8: Avoid finalizers and cleaners
-> There is no guarantee that at which time they are called (if at all).
Implement AutoClosable instead if you want that the client
Item 7: Eliminate obsolete object references
Have a look at Stack.java, do you find the obsolete reference
Item 9: Prefer try-with-resources to try-f inally
{code}
try (InputStream in = new FileInputStream(src); OutputStream out = new FileOutputStream(dst)) {
...
}}
{code}
item10
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published