views:

209

answers:

5

I am a Java EE developer working mainly with JSPs, Servlets, and frameworks like Spring.

  • Will learning PHP be a wise decision ?
  • What would PHP offer me ?
A: 

Learning a new language is always useful. You may never need to use it but at least you can communicate with other PHP developers on a knowledgeable level. It may be that one day you need to interface with a PHP project and having the knowledge will only help in making better design decisions.

northpole
A: 

PHP offers you a faster way to develop simple websites, but the resulting site will tend to be slower than if you used Java EE. Complex sites will tend to be less maintainable when implemented in PHP.

Whether learning PHP is "wise" is a loaded question ... but having extra development skills in your repertoire cannot do you any harm.

Stephen C
It will only be slower/less maintainable if the programmer doesn't do a proper job, it has nothing to do with the language. True, PHP gives you a lot of margin to mess things up but there are plenty of frameworks that correct this and give the programmer a proper path!!
AntonioCS
is that really true about the speed? I believe the java runtime has alot of engineering behind it and is faster than almost all dynamic languages including PHP
Fire Crow
@Fire Crow - no it is not true about speed. Assuming optimal coding, a Java application will be faster than the equivalent PHP application because Java is compiled to native code while PHP is interpreted.
Stephen C
A: 

I am a PHP and Java developer. IMHO, PHP will open you to the world of dynamic language more smoother than other language. You will learn to careless about the object types or even objects (if you don't do OOP). This give you different way of thinking as you will not thinking about class and object bot more of primitive data, array and associated array.

With less restriction, you will code faster and after a some experience running your php program, you will begin (if you care) to review your code without the helps of compiler.

All those with little expense of unfamiliar program syntax if you goes to Python or Ruby.

Just my thought.

NawaMan
I agree PHP will give more to a Java developer, I prefer python as a dynamic language, but its object model and namespacing is closer to java so PHP would be more of a streatch.
Fire Crow
+6  A: 

It's always wise to learn a new technology. Even if you run screaming from PHP, seeing how it solves certain problems might help you with your core Java EE development

PHP would offer you

  1. A familiar object model (abstract and concrete classes, interfaces, etc.) with some weird differences

  2. Less verbose syntax

  3. Not having to deal with types

  4. Having to deal with no type safety

  5. A built in dictionary type (confusingly called array) that offers the convenience of generics without the verbosity (I think what I just said is true, but I'm not really a Java guy)

  6. Superior string handling, including high performance mutable strings

  7. Experience with what happens when you take a globally scoped scripting/programming language and bolt Java style OO on top of it without taking that global scoping away.

  8. Access to a huge number of c or c++ based libraries, and the ability to expose functions for any c or c++ library if you're willing to do a little work and recompiling

Here's one way to think about the differences in the technology stack. In your world, Java came first and then JSP and servlets were developed to deal with the web/networked world. Imagine a language where JSP came first (with Apache serving the role of servlet), and then slowly a Java like syntax was developed built on top of JSP.

Alan Storm
Actually, Java has mutable strings in the form of the StringBuilder / StringBuffer classes. But in most situations, there is little benefit in (explicitly) using them.
Stephen C
True, better said PHP offers you mutable strings without trying. i.e. anyone who rights code will automatically be using mutable strings, even if they don't know what the difference is.
Alan Storm
A: 

simplicity, php is a different way of thinking specifically because of the limited number of tools available, associative arrays are very dynamic and as a main part of the language it changes the way you design a program significantly.

there is nothing in PHP that cannot be done in Java, the reverse is not true.

but having a limited, simple way of doing things can help bring out the problem space in a different light.

Fire Crow