What Perl Programmers Should Know About Java

What should Perl programmers know about Java? It depends. Not knowing Java will not slow you down as a Perl programmer. However, Java is a popular and rapidly growing language, so there’s a good chance that you will find yourself using Java systems or writing applications that need to interact with them. In some situations, writing a Java application may be a good way to accomplish something that you cannot easily do in Perl.

This article is not a Java language tutorial. There are plenty of those available, both in books and online (see section 6). Instead, I want to present Java as a development platform with a special emphasis on those aspects of Java that are most complementary to Perl. If you are aware of Java’s strengths and weaknesses, you will know when it is potentially worth learning and when you are better off sticking with Perl.

Java is an object-oriented cross-platform programming language. Syntactically, Java looks a lot like C and C++. However, Java differs significantly from these languages in that it provides many of the high-level features that you are used to from Perl, such as automated garbage collection and memory allocation. Over the past 5 years, Java has become a popular language for introductory computer science classes because teachers can use it to teach high-level programming constructs before students are ready to wrestle with the details of memory management.

The most important feature of Java is the Java Virtual Machine (JVM), which functions as a “sandbox” or protected area in which Java applications are executed. This makes Java a safe language for applications that run over a network, because the JVM can prevent Java applications from performing hostile operations like deleting files. This is why you seldom hear about Java viruses. Java source code is pre-compiled into Java class files that contain a cross-platform Java bytecode, which are then interpreted by the JVM at runtime. Java applications are often distributed as .class files or in compressed form as Java ARchive (JAR) files.

The JVM can run as a stand alone application, a component of another application, or a plug-in for a web browser. Anyone can build a JVM using Sun’s Java Virtual Machine specification. There are several JVMs available for Windows and Unix, including a popular one from IBM. Many other companies have built their own JVMs for proprietary or less mainstream platforms. Ideally, a Java application will be able to run on any system that has a JVM.

Get pdf download What Perl Programmers Should Know About Java

Related Tutorial

Tags: , , , , , , , , , , , , , , , , , , ,

Comments

Leave a Reply