Introduction to Java
12 Design Principles
Perhaps the best summary of the design goals and accomplishments of Java comes from Gary Cornell in the introduction to Core Java.
In this introduction, Cornell outlines 12 design principles used in the development of the Java language.
To do so, he quotes from the Java White Paper from javasoft.
I will duplicate the quotes here, but you should not consider your Java Library complete without a copy of Core Java.
Java is Simple
"We wanted to build a system that could be programmed easily without a lot of esoteric training and which leveraged today's standard practices ... So even though we found that C++ was unsuitable, we designed Java as closely to C++ as possible in order to make the system more comprehensible.
Java omits many rarely used, poorly understood, confusing features of C++ that, in our experience, bring more grief than benefit."
To me, this is perhaps the primary reason that Java has done so well in the market.
Java is really, really easy to learn and to use.
And because it is so easy, Java developers can honestly tell their managers that they can deliver a prototype of a large application in one week, and deliver a working first one in three.
This is pretty revolutionary.
Java is Small
"Another aspect of being simple is being small.
One of the goals of Java is to enable the construction of software that can run stand-alone in small machines."
If you want to be a web-based technology, you must be able to squeeze down a narrow 56K modem-sized pipe.
Although server-side components do not have the same level of restrictions, client side applications must be extremely sleek if they are to provide full-featured functionality across the Web.
Java excels at this.
A well-designed applet, that relies on multithreaded connections to the server for any serious work, can be whittled down into a pure, tiny GUI core that can be transferred across the internet extremely quickly.
The trick, of course, is to design your applet to be small.
Java is Object Oriented
"Simply stated, object-oriented design is a technique that focuses design on the data (= objects) and on the interfaces to it ... The object-oriented facilities of Java are essentially those of C++."
We are going to talk a whole bunch more about object-oriented programming later in this tutorial.
But suffice it to say that when you get comfortable writing object-oriented code, your productivity will increase ten-fold and your code will be maintainable by the people who pick up after you leave.
Java's implementation of object orientation is clear and simple.
In fact, if you had to learn object-oriented design, there could be no better language than Java to learn it with.
Java was built from the start to help programmers program well.
Java is Distributed
"Java has an extensive library of routines for coping with TCP/IP protocols like HTTP and FTP.
Java applications can open and access objects across the net via URLs with the same ease as when accessing a local file system."
The phrase, "The computer is the network" is trite by now.
However we shouldn't ignore the ease with which developers can implement this maxim in Java.
Java has all the tools one would want to create a distributed application that really takes advantage of the network in which it lives.
Try comparing the code to implement sockets in ten modern languages, and you will see what I mean.
Java makes network programming easy for you.
Java is Robust
"Java is intended for writing programs that must be reliable in a variety of ways.
Java puts a lot of emphasis on early checking for possible problems, later dynamic (run time) checking, and eliminating situations that are error prone."
I guess the thing to realize about how Java was designed is that the designers took a lot of time to make the language idiot-proof.
After-all, they were releasing this language to the masses on the Web rather than to the hallowed halls of university computer programs.
Java makes mediocre programmers look sharp because it helps programmers to not make errors.
Java is Secure
"Java is intended to be used in networked/distributed environments.
Towards that end, a lot of emphasis has been placed on security.
Java enables the construction of virus-free, tamper-free systems."
Sometimes Java is secure to the point of being annoying because you can't do some of the things you want to.
But as they say, better safe than sorry.
And as you will see later, there are plenty of ways to dig yourself a tunnel out of the Java sandbox : )
Java is Architecture Neutral
"The Java compiler [generates] bytecode instructions which have nothing to do with a particular computer architecture.
Rather, they are designed to be both easy to interpret on any machine and easily translated into native machine code on the fly."
Java is Portable
"Unlike C and C++, there are no 'implementation-dependent' aspects of the specification.
[For example,] the sizes of primitive data types are specified, as is the behaviour of arithmetic on them."
Java is Interpreted
"The Java interpreter can execute Java bytecode directly on any machine to which the interpreter has been ported.
[Thus] the development process can be much more rapid and exploratory."
Java is High Performance
"While the performance of interpreted bytecode is usually more than adequate, there are situations where higher performance is required.
The bytecode can be translated on the fly into machine code for the particular CPU the application is running on."
Java is Multithreaded
"The benefits of multithreading are better interactive responsiveness and real-time behaviour.
[This is because a program can do more than one thing at a time.]"
Java is Dynamic
"In a number of ways, Java is a more dynamic language than C or C++.
It was designed to adapt to an evolving environment ... Libraries can freely add new methods and instance variables without any effect on their clients."
As you can see, Java is a fantastic language.
And having been coding in Java for several years now, I can tell you with confidence that writing Java is also fun, and actually quite easy.
Of course, there is one catch.
Java is only easy when you grasp the quirky way in which Java looks at the world.
Programming in the medium of Java requires that you think in terms of Java
And to think in Java, you must understand object-oriented programming.
Selena Sol contributes to the JavaBoutique's Introduction to Java. Selena curently works for Barclays Capital in London, one of the leading global investment banks in Europe and has worked as a software developer for the National Center for Human Genome research, Microline Software, Neuron Data, and Electric Eye in Singapore. Selena is perhaps best-known for creating the Public Domain Web Script Archive (Extropia) and writing several books on Web Programming (Perl, CGI, Java).
Email: selena@extropia.com
New on the Java Boutique:
New Review:
Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling
API boasts simplicity, ease-of-integration, a well-rounded feature
set, and it's free!
New Applet:
Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA
sequences into three useful formats.
Elsewhere on internet.com:
WebDeveloper Java
Lots of Java information on webdeveloper.com
WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.
ScriptSearch Java
Hundreds of free Java code files to download.
jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.
|