Copy Link
Add to Bookmark
Report
Java Coffee Break Newsletter Volume 3 Issue 11
Java Coffee Break Newsletter Volume 3, Issue 11
http://www.javacoffeebreak.com/
ISSN 1442-3790
=================================================================
In this issue
* Featured Java Websites
* Book Review - Java 1.2 In Record Time
* Book Review - Taming Java Threads
* Interview with George Reese on databases and JDBC
* Interview with Sing Li on Jini
* Q&A : What is a Sun Certified Java Architect?
* Q&A : How do I run the garbage collector to free memory
and delete unused objects?
=================================================================
........................advertisement..........................
\ /
\ Discount books, CD's, video, electronics, and more! /
\ /
\ You may have bought books from Amazon.com before, our /
/ preferred Java bookstore. But did you know Amazon also \
/ sells a *massive* range of CD's, video, DVD, and \
/ electronics at deep discounts? Visit Amazon now at \
/ http://www.davidreilly.com/goto.cgi?id=amazon \
...............................................................
Featured Java Websites
Each month, we feature a selection of premium websites devoted
to the Java programming language, and software development in
general. Here are a selection of websites that may be of interest
to readers.
Multi-threading demystified
Writing code that executes concurrently, regardless of the
language, can be pretty darn tricky to get your head around.
Of course, Java makes things a little simpler, by adding
language keywords to protect you from simple mistakes.
Learning *how* to use them, however, isn't quite as simple.
In this article by Benoit Marchal, you'll learn multi-
threading the easy way.
http://www.javacats.com/US/articles/MultiThreading.html
Get the answers fast from the Java Programmers' FAQ
If you're new to Java, chances are you've gotten stuck on a
problem or two, and have had no luck finding the answer in a
textbook. That's what the Java Programmers' FAQ is all about.
Written by Peter van der Linden, the author of the popular
"Just Java" series, this FAQ answers questions on every
conceivable topic, like applets and animation, setting up
your compiler and IDE, browsers, debugging, networking, and
file I/O. It's all here, waiting for the asking.
http://www.afu.com/intro.html
=================================================================
Book Review - Java 1.2 In Record Time
(also published as Java 2 In Record Time)
Author : Steven Holzner
Publisher : Sybex
ISBN : 0782121713
Experience: Beginner
I've reviewed quite a number of Java titles written for the
beginner. Some are fairly ordinary, others are exceptional.
Unfortunately, Java 1.2 In Record Time falls into the former
category. That is not to say it is not a good guide to learning
Java quickly, but it does have its flaws.
Firstly, the book was written for an early beta of JDK1.2
(now named Java 2 v1.2). Any of the code written for the
Swing platform will not run -- it uses the old
com.sun.java.swing.* packages, rather than javax.swing).
This means you must manually change all the import statements,
and recompile. This is an annoyance, particularly for those
who are unaware of the changes from early betas. If you
visit the website, you can find out how to fix this by
reading their errata.
Secondly, fourteen out of fifteen "skills" taught in the book
concern graphics and GUI programming (that's 87.5% of chapters).
While GUI programming is certainly a useful skill, the book
stops just after briefly touching threads and JAR files --
there is no networking, no coverage of data structures, files,
I/O streams, etc.
Putting these two flaws aside for the moment, Java 1.2 in
Record Time is a good way to get your feet wet. You'll learn
the Abstract Windowing Toolkit (AWT), and Swing libraries. As
an introduction to the language, Java 1.2 in Record Time does
a fine job, but readers will have to purchase other titles to
cover all the skills a beginner needs. -- David Reilly
For more information about this title, or to order it, visit
http://www.davidreilly.com/goto.cgi?isbn=0782121713
=================================================================
Book Review - Taming Java Threads
Author : Allen Holub
Publisher : Apress
ISBN : 1-89311-5100
Experience: Beginner-Intermediate
Of all the topics a programmer learns, it's been my experience
that the two most complex topics are recursion, and
multi-threading. Both require a different way of thinking about
software, very much out-of-the-box thinking. So if threads are
getting you down, Taming Java Threads is the book for you.
In Taming Java Threads, you'll learn how threads work, by
examining practical applications that demonstrate key topics and
which are backed up by theory. You'll learn about topics like
mutex and lock management, timer threads, synchronization, and
thread pools. The range of topics will interest both a beginner
and an expert. But to my mind, the most important topic was GUIs
and threads.
Older books on threads completely neglect topics like GUI design
and Swing -- yet as Allen Holub shows in Taming Java Threads,
threads are essential to the Swing event-dispatch queue, and a
knowledge of threads is required to prevent unresponsive GUIs.
The important information contained within these chapters should
be required reading for Java developers. Without it, you'll write
applications that can stall and freeze.
Taming Java Threads is a great guide to thread programming. If
there is one flaw in the book I detected, it was that it failed
to cover non-blocking I/O as an alternative to threads. Whether
you've just learning Java programming, or you want to hone up on
your thread theory, this is the book for you. -- David Reilly
For more information about this title, or to order it, visit
http://www.davidreilly.com/goto.cgi?isbn=1893115100
=================================================================
Interview with George Reese on databases and JDBC
George Reese has taken an unusual path into business software
development. After earning a B.A. in philosophy from Bates College
in Lewiston, Maine, George went off to Hollywood where he worked
on television shows such as The People's Court and ESPN's Up
Close. The L.A. riots convinced him to return to Maine, where
he finally became involved with software development and the
Internet. George has since specialized in the development of
Internet-oriented Java enterprise systems. He is the author of
Database Programming with JDBC and Java and the world's first
JDBC driver, the mSQL-JDBC driver for mSQL.
In this exclusive interview, we talk with George about database
programming in Java, and the Java Database Connectivity (JDBC)
API.
Q: What do you see as being the biggest change affecting the
Java community in the last year?
A: I think the beauty of the last year has been the lack of
significant change. Java has spent the last year maturing
across all of its APIs. As a result, you see a lot of the old
arguments -- performance, stability, etc. -- against using
Java going away. I think that is exciting.
I think the most interesting frontier arena for Java,
however, is Jini. It seems to me most people have a limited
picture of what Jini is when in fact it is a tool that
demands some out of the box thinking. When people start
truly thinking outside of the proverbial box with Jini,
you will start seeing some fundamental changes in the way
we use Java to build software.
Q: How do you find Java stacks up to other programming
languages, such as C++ or scripting languages that are
used to provide quick interfaces to a database?
A: I am of the opinion that there are only three important languages:
Python
Java
C++
Python and C++ are niche languages with Python supporting
scripting needs (the realm traditionally reserved for Perl)
and C++ for extremely low level programming tasks. Java is
there for everything else.
I believe in using Python for scripting that needs to talk
to a database, and Java for everything else. Java works so
beautifully for database programmers primarily because of
tools like JDBC that really minimize the need for a database
programmer to have to know the specifics about different
database engines. If you know JDBC and SQL/92, you have
the tools to write solid database applications against
any database engine. While other APIs such as ODBC
attempt to provide this power to other languages, the
fact is that they lack to simplicity of JDBC. And they
do not provide any meaningful extra functionality that
one would expect from added complexity.
Q: For the database novice, what exactly is JDBC?
A: JDBC is a database-independent API for access to a relational
database. You pass SQL to Java methods in the JDBC classes and
get back Java objects that represent the results of your query.
It is designed in such a way that most database programmers
need learn only a few methods in just three classes to do
most of what database programmers need to do to accomplish
database programming tasks.
Q: What type of database would you recommend for the entry-level
Java programmer who is learning JDBC from your book? Is the
choice affected by the availability of JDBC drivers?
A: MySQL. The temptation is to use Access since it comes with
some versions of Office. The truth is, most people have a hell
of a time getting Access set up and configured because of the
ODBC bridge people use to talk to Access. MySQL, on the other
hand, has several network drivers. It also looks more like a
"real database", so the knowledge an entry-level programmer
gets from it is more applicable to real world applications.
Finally, it runs on Windows and Unix, not just Windows machines.
Q: While JDBC is certainly useful for interfacing with external
databases, are there many 100% Pure Java database packages out
there, and how do they compare to their native cousins.
A: The terms 100% pure and native are a little deceptive when
talking about JDBC drivers. The 100% pure drivers are often
what are called type 3 and type 4 JDBC drivers. Type 4 drivers
are often referred to as "native" drivers because they use the
native network protocol of the database engine they support,
not any native code in the pure Java sense.
Type 1 and type 2 drivers are native in the pure Java sense.
That is, they generally use a C API or something similar to
talk to the database.
For server-side applications such as EJB middleware and
servlets, I recommend using the type 2 drivers. These drivers
use the databases native C API to talk to the database. These
drivers provide the best performance, but they are painful to
deploy.
For client applications, such as applets and two-tier Swing
apps, I recommend a type 4 network driver. These drivers have
100% pure Java portability. I recommend never touching type 1
or type 3 drivers--two different types of bridging drivers--as
they rarely have any tangible benefits but come with plenty
f headaches due to their complex architecture.
Q: When developing JDBC systems, would you recommend a
particular development tool (such as a database design package),
or should programmers stick with SQL for creating their tables?
A: I am a strong proponent of disciplined software engineering.
As such, I think developers should never just enter in SQL for
creating tables. The data model should be drawn and documented
somewhere. Now, that does not mean you need an expensive
modeling tool. Drawing a data model on a piece of paper (or
a whiteboard as long as you save the drawing somewhere) and
then writing a SQL script is totally acceptable.
Q: Looking to the future now, where do you see Java heading?
Is there a particular technology that you're enthusiastic about?
A: As I mentioned earlier, I am very interested in seeing where
the development community takes Jini. Beyond that, integrating
a JSP-like technology with solid content management technologies
should be really important to changing the way Web applications
are built. The problem now is that JSP is not a very good
technology and existing content management technologies such
as Vignette and Open Market are even weaker.
Q: Thanks for talking to us George. George's latest book, Database
Programming with JDBC and Java, Second Edition, is available from
all good bookstores, and online from Amazon.com.
For more information about this title, or to order it, visit
http://www.davidreilly.com/goto.cgi?isbn=1565926161
=================================================================
Interview with Sing Li on Jini
Sing is an active author, consultant, and entrepreneur. He has
written for popular technical journals and is the creator of the
"Internet Global Phone", one of the very first Internet phones
available. His wide-ranging consulting expertise spans Internet
and Intranet systems design, distributed architectures, digital
convergence, embedded systems, real-time technologies, and cross
platform software design. He is also an active participant
in the Jini community.
Q: What has been the biggest development within the Java
Community in the last 12 months?
A: Low profiled and quiet, jini.org is going through the
revolutionary ladder of an almost open-source software
development project. Revolutionary in the sense that it is
the very first venture that Sun has embarked on to turn over
control of a core technology to the public domain. Since then,
Solaris and the TomCat Servlet/JSP engine have followed a
similar path. This is a big development because the creative
and engineering might of the entire Internet has been
summoned at one place. It is a model system for collaborative
development and evolution of key (and revolutionary) technology
in the public domain. This "fruit of labor" may not be ripe
for the picking yet, and consequently a few impatient souls
may give up. The hype-masters are saying "been there, done that".
But the truth of the matter is that I first wrote about Linux in
1993 and it was not until 1999 that it was "noticed" and "chosen"
as a viable alternative operating system. Public domain projects
have this built-in latency, and when they finally mushroom --
watch out!!
Q: What are the advantages working with Java, as opposed to
working with other technologies?
A: Java provides an industry-proven and tested vehicle to improve
engineering productivity. Without having the hassle of figuring
out pointers, managing memory allocations, etc., a development
team can work "closer to the algorithm" and dramatically shorten
the concept-to-product cycle. In the "olden" days of Java, this
came at the cost of performance. With all of the energy currently
going into R&D on the compiler, code generation, and
optimization, Java is no longer the dark horse, but a speeding
gazelle destined to become the very foundation of the new
net-centric software universe.
Q: Java has become very popular for server-side development. What
does Java bring to server-side programming that other languages
have not?
A: Write once, and run on machines of any arbitrary level of
processing power and scalability: this is the Holy Grail of
server software development. It is a sad but well known fact
that a certain level of scalability, fault tolerance, 24 by 7
operations, etc. are bound and tied to a specific vendor's
hardware offering. Until now, you have had to code to that
vendor's operating system and environment. Today, properly
coded Java server components can be engineered on Open Source
Java over Linux systems, and then deployed on main frame or
clustered machines without change. In production terms, this
literally means that the same components can be used through
out a system's lifecycle as it grows - or as the underlying
dot com company succeeds in the market place - thus allowing
for a gradual scaling up of a system, from a few users to
millions of users.
Q: Beyond website servers, there are some new distributed
systems technologies on the market. Your new book is on the
topic of Jini. For those who have yet to read about Jini,
could you sum up in a few sentences what Jini is, and how it
came about?
A: Jini is a natural extension of Java in this new era where
the network is quickly becoming the 'computer'. It facilitates
robust, scalable, fault-resilient distributed processing across
a network of multiple machines - and does so in a
non-restrictive, generic, and elegant way, as you would
expect from a Java technology.
Jini is the inevitable 'next step' for any vendor or system
designer with Java-based project(s) running on a multiple node
network, with distributed intelligence or processing on each
node. This is quickly becoming the 'norm' of systems
architecture in the Internet economy. The designers of Java
intend Jini to be part of the natural evolution of Java
itself - it is not a design-by-accident episode.
Q: One of the areas of potential that Jini could really shine
is interfacing with devices in a non-OS specific way. Indeed,
for over two years we've been hearing of Jini devices "just
about to hit the market". Are there any Jini devices like
printers, copiers, cameras, portable audio players, etc. that
are available or set for imminent release?
A: Yes, within a localized network or a proprietary environment,
Jini can become a completely embedded technology that is integral
to the proper functioning of a network-based product - without
necessarily revealing it to be based on Jini. I think we will
soon see products and systems that are based on this type of
architecture. Generic device support is a chicken-and-egg
problem (if the consumers do not ask for Jini by name, the
manufacturer won't build it; and if the manufacturers don't
build it first, the consumers will not know what to ask for).
Wholesale device adaptation will depend on the temperament of
the mass consumers market, and whether or not some innovative
third-party can come up with a 'killer app' for the technology.
See my answer to the next question for more details.
Q: There's been a lot of hype over Sun's Jini technology, and
its been quite a long time since the initial release. Do you
think Jini will live up to its hype, or will we see it
superceded by other technologies?A: The marketing 'spin' on
the technology thus far is purely based on 'Jini as an instant
on network' (or plug and work) technology. Sun's marketing
forces have determined that their initial target market is
in networked device manufacturers. Their success in this area
is yet to be determined. And, just as Java was way more than
just Oak (an extensible set-top box controller script language,
as it was originally marketed), Jini is way, way more than just
an InstantOn networked device technology.
I really applaud the efforts of the top level Sun designers
because they have put out some of the most innovative, visionary,
practical research (pure research with potential applications)
products amidst a sea of 'me too' or 'clone the mainframe' code
fur balls.
We are just starting to see Sun's marketing 'spinning' Jini
back-on-track, away from the device-based image and more
towards the core and strategic technology track. Meanwhile,
competitive forces are busy reinventing proprietary versions of
Java. Since Jini cannot exist without Java, Sun has a time lead
that is not easily surpassed. Having said that, one must realize
that cloning an idea can always be done in a much shorter time
than the original evolution: I have my fingers crossed that Sun
will succeed.
Q: Reading texts like the Jini Specification, I get the
impression that Jini programming could be quite complex. Just
how hard is it to write a Jini service, or a Jini client? Can
one learn to program for Jini just by reading the specification,
or is it easier to learn from examples, like in Professional Jini?
A: Jini programming can really be quite simple. It can be done
directly from the specifications. Having said that, I must also
say that Jini leverages several advanced features of Java
networking itself. These features are quite difficult to master.
For example, the nuances of dynamic code downloading (getting
that CODEBASE annotation just right), the programming and
operation of the RMI activatable services, IP multicasting,
socket-based programming, the Java 2 security model, etc, are
very complex. Someone who is totally fluent in these more
advanced aspects of Java network programming should find Jini
'a very thin layer' and a piece of cake to learn. For the
rest of us, we must first brush up on these advanced Java
programming concepts by studying books on advanced Java
network programming, advanced RMI programming, etc.
The Professional Jini book is real nice in that it spends a
significant amount of time on covering these fundamental
generic Java networking concepts, with detailed code examples
and explanations. Once mastered, Jini itself is quite easy to
write programs for.
There is at least one current project on www.jini.org
(the publicly accessible community where Jini itself is
being evolved and defined) that is working on increasing
the 'ease of programming' for Jini further, to improve the
'out of the box' experience.
Q: What sort of tasks, either for consumers, or for business,
can Jini be used for? Is it more likely to be hardware services,
or is Jini being used for software based services as well?
A: My personal belief is that Jini will have its most dramatic
impact on the creation of a new breed of 'access anywhere by
anyone using any device' software-based services (potentially
hardware assisted) by providing an 'easy to use' substrate for
creating scalable, fault-resilient, robust, distributed
applications. This is especially significant in the emerging ASP
(application services provider) and business-to-business
e-commerce markets. It will also find significant applications
for roamable, occasionally-connected device networks (i.e.
wireless terminals, proximity/BlueTooth, SmartCard).
Q: Looking to the future now, where do you see Java heading?
Is there a particular technology (Jini aside), that you think
shows great promise?
A: Other than new vertical APIs, Java is architecturally heading
for Jini as the Java VM is extended beyond the single machine
boundary to across the network. Along this line of thought, the
Professional Jini book will have you thinking about the
fundamental question: "What, physically, is a Java object?".
In my (humble) opinion, when Jini becomes an integral part of
Java, the answer to that question will change dramatically.
Other than Jini, I am fascinated by the swell of 'tiny Java'
technologies, the ability to run Java application on a Palm PDA
using J2ME CLDC, embedded Java and super inexpensive controllers
hosting Java VMs, etc. Together, I think they will soon realize
the vision of having computers wherever they can be applied
appliances, wearable computers, disposable computers, etc. There
are limitless possibilities for exciting new applications.
Why not come and be part of this evolution at http://www.jini.org?
Q: Sing Li, thank you for your thoughts on Jini technology, and
the future of Java. Sing's book on the topic, "Professional Jini",
is published by Wrox Press.
For more information about this title, or to order it, visit
http://www.davidreilly.com/goto.cgi?isbn=1861003552
=================================================================
Q&A : What is a Sun Certified Java Architect?
How can I become one?
Developers who have achieved a Sun Certified Java Programmer, or
Sun Certified Java Developer title may want to consider becoming
a certified architect. Software architecture encompasses a broad
range of technologies and techniques such as :-
* object oriented analysis and design (OOAD)
* Unified Modeling Language (UML)
* Enterprise JavaBeans (EJBs)
* large scale system design
* Java 2 Enterprise Edition technologies such as CORBA/RMI
* internationalization and security
These are very complex topics, and only experienced developers
should sit for the certification exam. You'll definitely want
to pick up a study guide that covers the architect exam before
proceeding further. For more information on sitting for the exam,
please see http://suned.sun.com/USA/certification/archdetails.html
=================================================================
Q&A : How do I run the garbage collector to free
memory and delete unused objects?
First, you should be aware that the garbage collector works
automatically, whether you request it to or not. Secondly, you
cannot force the garbage collector to run.
That said, you can request the garbage collector to perform work,
by invoking the System.gc() method. Once working, you may
experience a short pause while the garbage collector does its
work. That means you should do it at an appropriate time, such
as before a big task or when the GUI is idle and waiting for
input.
=================================================================
The Java Coffee Break Newsletter is only sent out to email
subscribers who have requested it, and to readers of the
comp.lang.java.programmer and comp.lang.java.help
newsgroups.
If you'd like to receive our newsletter, and get the latest
Java news, tips and articles from our site, then get your FREE
subscription & back issues from
http://www.javacoffeebreak.com/newsletter/
If you are an email subscriber and no longer wish to receive
the JCB Newsletter, please unsubscribe by emailing
javacoffeebreak-unsubscribe@listbot.com