
Coding Pitfalls
Tips
http://www.javaworld.com/columns/jw-tips-index.shtml
To follov…
Use .equals() when comparing strings, not ‘==’, as the latter compares references not contents. So “Hill” entered by the user will be a different String instance to “Hill” loaded from a file.
…obviousnesses like trap nulls, empty collections, …
‘Advanced’
See the Java Hall of Shame: http://www.cs.arizona.edu/sumatra/hallofshame/
Beware multithreading. This is a complete topic in itself, but here’s an interesting note on double check locking, and why you can’t count on it working.
Similarly a general rant at http://www.jwz.org/doc/java.html, but includes some useful things to bear in mind if you’re getting deep in.
(AstroGrid 2002)
Leave a comment