New to programming. Portable code. Perl or Java?
Historically, programs have been operating system dependent with a distribution that runs on (say) Windows NT not being suitable for use on Solaris. Or, in current operating systems, an XP distribution being unsuitable for Linux or OS X.
This has changed somewhat with more modern languages such as Java and Perl, but the "model" of how this works - and thus the ideal application - differs between the two.
HOW ARE PERL AND JAVA PORTABLE?
Java code runs in a virtual machine - a piece of software that is operating system dependent which provides an environment in which a system independent distribution can run. You'll need to install a "JRE" (Java Runtime environment) that includes this virtual machine on any system on which you want to run Java, or use a JVM that's supplied as part of something else such as certain browsers before you can run Java on a computer.
Java provides device independence by working at a level above the operating system, so it is NOT an ideal language for system admin, backup scripts and similar utilities. It's great for larger "OO" projects that run for months or years, with teams of programmers working together.
Perl can run on all major operating systems. In order for a Perl script to run on a computer, a version of Perl specific for the operating system must be installed (just like Java needs a JRE). Once Perl is installed, the same distributions should be able to run on any platform if the code was written suitably.
The vast majority of Perl code *is* portable. I've quite happily written code without even thinking about the target OS, and all our training examples work on Windows, Linux, OS X and Solaris quite cheerfully. In practice, Perl is very "Unix like", but where something's required that is of necessity operating system dependent, the Windows implementation (for example) mimics the Unix behaviour and does what we describe as the "moral equivalent". In that way, Perl code will typically run cross platform in a far wider range of applications than Java which simply cannot do certain things practically.
A warning - it IS possible to write operating system dependent Perl; if you say "run the following OS command" and ask it to run something that doesn't exist on some OS, then it's bound to fail. But Perl scripts aren't accidentally written like this, and can check.
CAN I LEARN TO PROGRAM IN PERL / JAVA AS MY FIRST LANGUAGE?
Yes, and knowledge gained of one will make learning the second easier. We're quite used to running "learning to program in Perl" and "learning to program in Java" courses - and the way we teach newcomers to programming is different to the way we teach people who are converting from other languages.
Having said that, both Perl and Java have a huge range of facilities and neither is the easiest of languages for the newcomer ... but then you end up being able to do really useful, portable things after your course.
VISIBILITY OF PERL AND JAVA
You'll see a lot more information around about Java and you'll feel that it's a much more popular language. It probably does have a bigger user base (see my comments earlier about how great it is for huge applications), but it's also been very much over sold by its originators who push it perhaps wider than they should.
Perl is an Open Source language. It's not really sold but has enthusiastic advocates who, however, will tell you its strengths and also its weaknesses - they have no income to make from overselling it. Thus it's a bit of a "hidden secret" compared to Java.
See also
Courses for newcomers to programming
Please note that articles in this section of our
web site were current and correct to the best of our ability when published,
but by the nature of our business may go out of date quite quickly. The
quoting of a price, contract term or any other information in this area of
our website is NOT an offer to supply now on those terms - please check
back via
our main web site
Web Application Deployment - The Components of a Web-Based Solution [34] - ()
[49] - ()
[166] - ()
[367] - ()
[433] - ()
[442] - ()
[510] - ()
[673] - ()
[924] - ()
[1176] - ()
[1198] - ()
[1265] - ()
[1496] - ()
[2099] - ()
[2896] - ()
[3891] - ()
Choosing your language [76] - ()
[1990] - ()
[2001] - ()
[2048] - ()
[2507] - ()
[2535] - ()
[2536] - ()
[2700] - ()
[2866] - ()
[3169] - ()
[3558] - ()
[3619] - ()
[3764] - ()
[3785] - ()
Web Application Deployment - Java - Basic Language Overview [659] - ()
[871] - ()
[2120] - ()
[2423] - ()
Perl - Introduction [25] - ()
[317] - ()
[382] - ()
[577] - ()
[594] - ()
[604] - ()
[629] - ()
[691] - ()
[743] - ()
[846] - ()
[924] - ()
[1717] - ()
[1753] - ()
[1852] - ()
[2070] - ()
[2812] - ()
[2832] - ()
resource index - Deployment
Solutions centre home page
You'll find shorter technical items at
The Horse's Mouth and
delegate's questions answered at
the
Opentalk forum.
At Well House Consultants, we provide
training courses on
subjects such as Ruby, Lua, Perl, Python, Linux, C, C++,
Tcl/Tk, Tomcat, PHP and MySQL. We're asked (and answer)
many questions, and answers to those which are of general
interest are published in this area of our site.