Main Content

When should I use Java, Perl, PHP, or Python?

Archive - Originally posted on "The Horse's Mouth" - 2009-12-13 09:55:59 - Graham Ellis

Java is a good language for bigger systems ... teams of programmers writing bits of code that interact with each other. In fact, Java is so well tuned towards the bigger systems that it's not the ideal language for smaller systems - for the people who are just looking to write a quick piece of code to comb something out of their log files, or who are adding a straightforward little piece of program to their web pages. Those smaller systems are better in PHP (web page content), Perl (short utility) or Python (typically for things which are more than just a few lines, but don't come up to the Java size). OK - that's a simplification but I have no axe to grind one way or the other as we offer courses in all of them - it's a question of selecting the right tool for the right job. The diagram above / alongside shows a graph of application size (along the bottom) with appropriateness up the left hand side.


One of the ways that Java is tilted towards being a "big system" language, and the others tilt in the opposite direction, is its requirement for all variables to be declared and typed, and for all methods [named blocks of code] and static (class) and dynamic (object) variables to have a scope of visibility associated with them. The diagram alongside shows these various scopes - you have
private - visible only within the class in which it is defined
package - (default - you do NOT declare this) - visible within the class in which it is defined and within other classes in the same package - i.e. visible to its brothers and sisters, but not to its parents, children, nieces, nephews or other more distant relatives.
protected - visible within itself, to its siblings, and to their children (and their children's children, etc) too. Not visible to parents.
public - visible from within any other class.


Please do get in touch if you want to discuss your own specific requirements and which language suits you best; I'm always happy to talk through things with people so that they make the right choice. And it's not always a strict technical issue - if you already know PHP, it may be better for you to expand your use of it to cover non-web applications rather than learn something new, with all the extra maintenance needs for your company. Or if you already have a Java programming resource in house, it may be better to expand the use of that rather that branch out anew.