3 ms·
A few things to remember when programming java: 1) It's not pass-by-reference. Java is pass-by-value, but it is passing pointer values, not variable values. Th
by j2d2 18y ago
A few things to remember when programming java:
1) It's not pass-by-reference. Java is pass-by-value, but it is passing pointer values, not variable values. This sometimes behaves like pass-by-reference but if pass a from foo() to bar() and call new on a inside bar, a will get it's old value once bar() returns to foo().
2) Eclipse has a tremendously useful debugger and, as an emacs guy, I can vouch for Eclipse being well worth learning. You can change code in running programs, but beware it reruns whatever method you're in. Sometimes (possibly all times) without resetting values changed in that method.
3) Use interfaces when you can. Map instead of HashMap, etc.
4) Leverage the classpath for testing bugfixes easily. Create a jar with your fixed class, put it in front in the classpath. Keeps things simple and let's you build upon anything you shipped to a client.
5) If you have to use RMI, understand why readExternal() must reflect the order of things from writeExternal() and how this can break easily. This specific case may not be useful to you right now, but it will help you understand what RMI, and serialization in general, is actually doing.
I'm sure there are other good lessons but it's been a while since I worked with someone new to java.