A day as a Java Engineer
I’m a software engineer and my favorite language is PHP. I’m used to it, certified, is flexible, is fun and I can almost speak the language.
Fact is that a language is no different than a tool, so, if you can’t solve an issue with your current tool you need to find another one more appropriate. Well this is fairly what I did when I decided to solve an issue using Java.
Java and PHP are very similar, especially if you compare PHP 7+ to the latest of Java, but there are some caveats or some differences that make working with the language a bit hard if you are not used to it. Well, the last time I coded Java was about 15 years ago so there, that would be a challenge on itself.
PHP and Java are similar in a few things:
- namespaces
- object oriented
- now PHP has some type hitting
- based on C
- You can easily read both the PHP and Java code and understand.
The Oddities is what makes this a bit hard:
- If you have an exception thrown in java you either declare the function to throw that exception or you catch it. Different from PHP that simply bubble the exception.
- NullPointerException is a thing and takes a bit for you to remember that everything is an Object.
- Arrays on PHP and Java are not the same thing. Arrays on PHP is a lot more Maps and Lists in Java.
This experience was fun and reminded me the good things that Java has and how fun it is to have some flexibility with the Arrays in PHP. Either way, like PHP, Java is a beautiful language and I believe that, with some learning curve, either a Java Engineer or a PHP Engineer can code either language.
I don’t consider myself a Java pro, but I will keep the horizons open to it if I ever needed again.