Copy Link
Add to Bookmark
Report
Java Coffee Break Newsletter Volume 3 Issue 09
Java Coffee Break Newsletter Volume 3, Issue 9
http://www.javacoffeebreak.com/
ISSN 1442-3790
=================================================================
In this issue
* Featured Java Websites
* Book Review - Mastering Enterprise JavaBeans and the Java 2
Platform, Enterprise Edition
* Interview with Qusay H. Mahmoud on Distributed Computing
* Q&A : How I can find the class of an object?
* Q&A : How I can I return a null value from an object
constructor?
........................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.
Learn the difference between Java and JavaScript
JavaScript or Java - which way to go? Both have their advantages
and disadvantages. Though JavaScript is simpler it also has
limitations. Before making the choice, you really should look
into both languages. Rather than buying a thick and lengthy
text on the subject, jump straight into JavaScript with this
simple to read primer. It takes you through all the basics,
so you can start coding quickly.
http://wsabstract.com/javatutors/primer1.shtml
/* ...adv
*
* Looking for Java resources such as tutorials, source code,
* FAQ's, discussion forums and information on certification?
* At JavaCommerce, you'll find all this and more, as well as a
* job guide with over 400 Java positions that need to be filled.
* Whether you're looking for information, or looking for a place
* to apply your Java skills, we can help
* --> http://www.javacommerce.com/
*/
Battle of the titans - ASP vs JSP
If you're interested in seeing Scott "The Nerdinator" McNealy
taking Bill Gates in a headlock, you might be just as
interested in this site. Active Server Pages and Java
Server Pages are two competing technologies vying for the
server-side e-commerce market. Presented in a fairly neutral
way, this article covers the two technologies and shows their
strengths and weaknesses. As a developer, whether you're
backing the Microsoft or the Sun team, an objective analysis
of their languages may just change your mind :-)
http://www.jspinsider.com/articles/jspasp/jspasp1.html
How to write unmaintable code
Got them coding blues? If you're looking for a laugh or two,
this guide to writing unmaintable code is just the ticket to
pick up your spirits. There's full of useful tidbits of advice
(lie in comments to keep them guessing, and use false
indentation in your loops to confuse the reader). Of course,
if you're not going to be maintaining the project, you might
just want to put these tips into practice...
http://mindprod.com/unmain.html
Pass the Sun Certified Java Architect Exam
If you'd like to pass the Sun Certified Java Architect exam
with flying colors, you're going to need to do a little
studying. You could take a commercial training course from a
third party, but if you're looking to go it alone, a good
place to start is the Prasks Java Architect site.
It offers free training modules, which help teach you the
basic concepts a Java architect needs. Some of the modules
are still under development, but are nonetheless a valuable
guide to the SCJA exam.
http://prasks.webahn.com/architect/scja.html
=================================================================
Book Review - Mastering Enterprise JavaBeans and
the Java 2 Platform, Enterprise Edition
Author : Ed Roman
Publisher : John Wiley & Sons
ISBN : 0-471-33229-1
Experience: Intermediate - Expert
In the past few years, companies have been returning to
multi-tiered design of backend server architectures. Java has
become a popular language for implementing these systems, due
in no small part to the release of new technologies such as
Enterprise Java Beans (EJBs) and the Java 2 Enterprise
Edition (J2EE) platform. When used together, they help
programmers make more robust and interchangeable server
components -- but keeping up with the radical shift in
thinking, and new class libraries, is pretty tough for
developers.
This book was written by Ed Roman as a means of helping people
understand the complex technologies involved with EJB
programming, and to overcome them. Straight off in the
preface, Ed points out that EJB's are not easy and does
not want to lead the reader astray into thinking it is.
After reading this book, I have a very good impression of
it, and found that Ed was correct about EJB's not being
easy. It covers EJB's as a whole and explains any other
necessary technologies, such as transactions, servlets,
XML and RMI-IIOP, as needed. When certain technologies are
chosen over others, the author provides sound reasons as to
why the decision was made.
Due to the level of tasks that Sun designed EJB's to handle,
they are very complex and the API is very rich. That's why
you need an authoritative reference like Mastering Enterprise
JavaBeans, to help get you up to speed with EJB development.
Reading the specification alone with out a guide means many
hours of frustration and lost time, and you'll find you've
only scratched the surface of this topic.
This book covers the EJB 1.0 standard, but does point out that
the EJB 1.1 standard has improved some of the problems. An
appendix covers the improvements in EJB 1.1, but this book is
still highly useful and recommended.
One of the useful items I noted about the chapters is that the
author created a different EJB for each chapter instead of
reusing one single one over and over. I found this very useful
as an exercise. While this book covers a very complex topic, I
found that the author managed keep the complexity of each chapter
down to a good level. The material was covered in small chunks
that will not overwhelm most users. I believe that Mastering
Enterprise JavaBeans strikes the right mix between covering the
theory, without swamping the reader with jargon and abstract
topics.
The Java 2 Enterprise Edition platform is an extremely rich and
powerful API - but quite overwhelming for new users. Mastering
Enterprise JavaBeans does an excellent job of teaching the basic
fundamentals, and getting you up to speed on a complex topic.
While you'll find the tutorial a good guide to the topic, the
book also serves as a handy reference. I'll be keeping it within
arms reach while working on EJB components and the Java 2
Enterprise Edition platform.-- Michael Reilly
For more information about this title, or to order it, visit
http://www.davidreilly.com/goto.cgi?isbn=0471332291
=================================================================
Interview with Qusay H. Mahmoud on Distributed Computing
Qusay H. Mahmoud lives in Ottawa, Canada. He provides
Java and WAP consulting and training services through
JavaCourses.com. Qusay is the author of Distributed
Programming in Java, and has published dozens of
articles on Java. In this exclusive interview, he talks
to us about the distributed computing, networking,
and wireless communication using Java.
Q: What do you see has been the biggest change affecting the
Java community in the last year?
A: Over the last year or so there has been a number of changes
affecting the Java community. The Java Enterprise Edition
(J2EE) is probably the biggest change where more Java is
being used for Enterprise Applications.
The Java Micro Edition (J2ME) is going to play an important
role in the next while. Another technology to watch for is
Jini (a connection technology) that will enable all types
of electronic devices to work together in a community put
together with "free administration" -- no dervice drivers,
no operating system issues, and no weird cables.
Q: What do you see as the main advantages of Java, compared to
other languages like C++?
A: Both C++ and Java are object-oriented languages. However, in
C++ (unlike Java) OO is not really enforced. C++ is really a
hybrid language meaning that it can be used as a procedural
better-C language or as an OO language. On the other hand
Java is truly OO language and OO features are enforced
when programming in Java.
Also in Java there are certain things that a programmer
doesn't have to worry about including: memory management
and dangling pointers. Being architectural-neutral and
platform-independent though doesn't come for free: Java
is slower than C++ but lately we have been seeing much
increased performance and performance is not an issue
with Java anymore.
Q: What's your opinion of the networking support of Java? Are
there areas that you feel need improvement?
A: I LOVE the networking support that Java offers. This may
include the java.net.*, java.rmi.*, and java.lang.Thread
packages. Developing network applications in Java is
seamless. I don't know of any other programming language
that makes network programming any easier. Even low-level
sockets programming is so damn easy in Java!
The area I would like to see improved is security. The
security model supported in Java is unique and I personally
don't know of any other programming language that has this
kind of security model. The security model in earlier
release of Java (JDK1.0 and 1.1) was crude but it has
evolved in JDK1.2 and 1.3 but unfortunately it is getting
complex!
Q: What's your opinion of emerging networking and distributed
computing technologies, like Sun's Jini? Do you think Jini
will live up to its hype, or will we see it superceded by
other technologies?
A: Jini is an awesome technology. I do believe that it will live
up to its hype. However, I also believe that it will end up
being used for applications we never thought of and for
things it wasn't designed for. But I think that is OK.
Distributed Events and Transactions are features that can be
very useful for e-commerce and event-driven applications.
Q: One of the topics your book, "Distributed Programming with
Java", covered was mobile agency. I'm particularly interested
in the topic of software agents myself, and was quite
surprised to find coverage on this often neglected topic.
Do you think we'll see mobile agents used extensively in the
next few years, or is it just a passing fad?
A: Mobile agent technology has been under development for a
number of years. However, it was only in late '96 that some
useful mobile agent systems appeared. Java (with its
architectural neutral feature) has made mobile agency a
reality. I believe that software agents are going to play
an important role in the very near future -- we will start
seeing agents everywhere. Not only in e-commerce applications
but also in wireless data networks and push technology as well.
Q: The Common Object Request Broker Architecture (CORBA) is a
popular mechanism for communicating and implementing
distributed systems. I noticed in your book that you chose
to cover a third party ORB, and not the Java 2 ORB that Sun
Microsystems ships. Why was that, and do you perceive problems
with the ORB that Sun offers?
A: The reason I used a third party ORB (VisiBroker for Java) is
mainly because it was available a long before Sun had the Java 2
ORB. VisiBroker for Java (formely known as BlackWidow) was the
first ORB for Java. To answer the other part of your question,
I have been using the Java IDL (Java 2 ORB) lately and I don't
see any problems with it.
Q: Looking to the future, where do you see Java heading? Is there
a particularly dominant technology (e.g. J2EE, CORBA, Jini) that
you feel will change the way we look at Java?
A: In the future we will see Java everywhere -- Jini-enabled
consumer devices, Java-enabled cell phones. But I don't
think one particular technology will change the direction of
Java.
Personally, I am interested in using Java in developing wireless
software for WAP-enabled as well as Java-enabled cell phones.
Welcome to the Wireless Internet!
Q: Wireless devices that are Internet ready are predicted to be a
hot growth area. Will we see Java-powered web services, blending
WAP & servlets, or will we see Java code executing inside WAP
devices?
That is a good question. There is no doubt that Java will play
an important role in the wireless market. Developing wireless
applications can be done using either browser-based environments
as in the case of WAP-enabled devices (and this is the technology
being used today). However, if wireless devices are Java-enabled
then we can write more sophisticated and useful applications, and
we can achieve cross-platform compatibility by writing our
applications according to the CLDC and MIDP profile specifications.
I expect to see some commercially available Java-enabled cell
phones by the first quarter of 2001. Nokia is having a Java-enabled
phone coming out next year.
Thank you, Qusay, for this intriguing look into Java distributed
computing. Readers who would like to learn more will find
"Distributed Programming with Java", by Qusay Mahmoud, an
excellent start.
=================================================================
Q&A: How I can find the class of an object?
That's easy. Suppose you've got some objects stored in a
collection, like a Vector or a List of some sort. You might
want to check to see if an individual object belongs to a
particular class. The instanceof operator is used in this case.
For example:-
if (obj instanceof MyClass)
{
MyClass.doSomething();
}
else
{
// handle object differently .......
}
Easy yes?
=================================================================
Q&A: How I can I return a null value from
an object constructor?
The simple answer is : no, you can't.
The explanation why is simple. You don't return any value
whatsoever from an object constructor. The object has already
been created - in the constructor you're just initializing the
object's state. So there isn't any way to return a null value.
However, if you want to throw a spanner in the works, and stop
someone using your object (which is usually the intent of
returning a null value, or to indicate an error), why not throw
a NullPointerException ?
public MyClass()
{
// Something might go wrong, so throw a null pointer ex.
throw new NullPointerException() ;
}
=================================================================
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