I am more practiced in PHP than in Java, and when I use Java I find myself looking at it from a PHP perspective. This can cause trouble, so I'd like to know, what are the most common programming mistakes PHP programmers make in Java?
Perhaps slightly flippant, but after bingeing on PHP for many years (it pays the bills), I've often been happy to be able to use crazy things like enumerated types and native data types that aren't arrays/objects playing dress-up.
Whilst a sweeping generalisation (the best ones always are), I guess what I'm getting at is that perhaps the most common mistake is to remain in the PHP mindset and not take advantage of the features that the language offers.
I'd say the biggest mistake I've seen is approaching Java, which is OOP, with a procedural mindset. Methods to a PHP person look like functions, and the main method (or constructor) looks like the procedural part of PHP. So you end up with entire programs existing in 2 giant classes with thousand line long methods.
As a PHP dev who made the move to Java, I can say that it is difficult. But of course this is the case with any move from a procedural language to an OOP language
A few things I notice:
Keeping views clean
PHP makes it very easy to "leak" logic into your views. Keeping them clean is often a chore. With some Java frameworks it's easier, but still you find a few things in them that should not be there
OOP vs Procedural
With Java everything is an object, and this forces you to think through how you plan on using this object. Often times this isn't done in PHP and cheats are used. Either assoc. arrays,
stdClassblanks, or other things created without a clear purpose
Java development doesn't encourage spontaneous quick changes whereas PHP does.
Java is easy to unit test, PHP less so. The often (above mentioned) dirty views mean there is less test coverage then ideal. If the application is using tests it's often ignored by PHP developers who are new to Java.