|
|
It's unfortunate that Java has
gotten the reputation of being solely a Web
programming language. It is a full-fledged
application programming language. It contains
all the features you need to write some pretty
hefty programs-and they will all run on any
system that runs Java!
Java is young and is still
experiencing growing pains. One of these pains
is the fact that although Java runs on multiple
platforms, it doesn't quite run
exactly the same on every
platform. Most of the time, these differences
are in the implementation of the AWT, causing
the problems to appear more often in applets
than applications (unless you're creating a
graphical application, of course). Because most
people see only the graphical programs, the
platform-to-platform variations in Java look
worse than they actually are.
The big difference between a
Java application and a Java applet is the lack
of security restrictions. Java applications are
given free reign over the system (although they
can't get around the operating system's
security). A Java application is free to open a
socket connection to any host it wants, open any
file, and create its own custom class loaders.
If you have been banging your head against a
wall because you couldn't do these things in an
applet, you might be tempted to turn your
applets into applications (in other words, make
them stand-alone) so you can have all these
features. That is, of course, your choice. But
you should seriously consider keeping the user
interface and the application separate. For some
quick hack program that isn't very significant,
it probably won't matter. However, if you're
writing a big commercial application, it does
matter. There are many advantages to being able
to run applets in a browser; one of the biggest
advantages is that the browser performs
automatic software distribution for you. You
don't have to install the applet on a system
ahead of time in order for someone to use it. If
you start writing everything as a stand-alone
application, you fall back into the old trap of
trying to maintain a program on a large number
of machines.
Java's database API, called
JDBC, is a boon for application programming. You
now have a standard interface for accessing a
relational database. JDBC frees you from being
tied to a specific database API, meaning you not
only can create cross-platform applications, you
can also create cross-database applications.
Java is a great language for
handling little ten-minute hack programs, as
well. You have immediate access to an excellent
set of libraries that handle many tedious
functions that you won't find in the standard
library set of C or C++. You can buy these
libraries for other languages, of course, but
why bother if you get them free with Java? You
may soon find that you are writing Java programs
when you previously wrote C programs or Perl
scripts.
|
|