Java Coffee Break Newsletter Volume 3, Issue 10 http://www.javacoffeebreak.com/ ISSN 1442-3790 ================================================================= In this issue * Featured Java Websites * Book Review - Web Development with JavaServer Pages * Book Review - Java in a Nutshell, 3rd Edition * Interview with Duane K. Fields, and Mark A. Kolb, on JSP * Interview with Ed Roman, on Enterprise JavaBeans * Q&A : What does a void return value mean? Which class is being returned? ================================================================= ........................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. A simple introduction to CORBA Trying to get your head around distributed objects and CORBA? It can be a tricky topic, but don't worry; this simple tutorial takes you through the steps involved in writing CORBA clients and servers, using VisiBroker and Java. The well-organized and explanatory approach facilitates digestibility and therefore speeds your progress. While there is certainly more to know beyond this source, it is a good place to start by learning about the theory involved with CORBA, along with some practical code. http://www.javacommerce.com/CorbaNotes/index.htm Painting on a Java canvas No, I'm not talking about the artistic applications of coffee (though as a stimulant, I'm sure it's had an effect on the art world at one time or another). I'm talking about the Java canvas, or more specifically, the AWT Canvas class. A mysterious component indeed, as it forms that basis for just about every component in Java you can think of from buttons to lists and text fields. Learn more about it in this fascinating article. http://www.easynet.it/~jhl/test/TestCanvas.html Intelligent agents, spiders and bots Botspot.com has a comprehensive section on bots that is billed as "The Spot for All Bots on the Net." If you're interested in writing intelligent agents that whiz across the Internet, smart software robots that gather information, or bargaining with merchants for the best deals, you'll find what you need here. A huge collection of Internet bots, agent research, and bot news awaits! http://www.botspot.com/ /* ....adv * Have you ever considered writing technical articles? Be the * envy of your peers, and give back to the Java community. * We're looking for technical articles of interest to Java * programmers. * If you have an article you think is suitable, drop us a note * at --> articles@javacoffeebreak.com */ ================================================================= Book Review - Web Development with JavaServer Pages Author : Duane K. Fields, Mark A. Kolb Publisher : Manning ISBN : 1-8847779-96 Experience: Intermediate - Expert Web Development with JavaServer Pages teaches the reader to construct rich interactive websites using JavaServer Pages technology. You may be wondering why JavaServer Pages is so useful, and how it can competes with other technologies like ActiveServerPages or CGI script. JavaServer pages allows you to abstract the web design aspect done by web designers from the programming down by programmers. This means that web developers can concentrate on beautiful pages, and developers can concentrate on cutting good code. This makes it an important component of web development, and a cornerstone of Java 2 Enterprise Edition (J2EE) Platform. This book offers a very comprehensive guide to the world of JavaServer programming, covering both theory and practical JavaServer programming in great detail. While the book is filled with many small practical examples, it also has a larger project which shows you how to create an FAQ management system. However, it was slightly disappointing not to see other large scale projects which would benefit the reader by seeing JSP in action. Web Development with JavaServer Pages covers all the fundamentals of JSP programming while providing easy to understand and concise examples. While the lack of many large-scale projects may detract from the usefulness of the book for some developers, it is nonetheless a fine guide to JSP that competes well with other similarly titled books -- Michael Reilly For more information about this title, or to order it, visit http://www.davidreilly.com/goto.cgi?isbn=0782121713 ================================================================= Book Review - Java in a Nutshell Author : David Flanagan Publisher : O'Reilly ISBN : 1565924878 Experience: Intermediate - Expert You can read an extract from Java in a Nutshell by visiting http://www.javacoffeebreak.com/books/extracts/javanutshell Java in a Nutshell, 3rd Edition, is the sequel to the highly successful series of books by author David Flanagan. His books have been both a handy reference when programming, and a quick-start guide to learning the Java language. Unlike other authors, when David releases a new edition, it is very much a complete rewrite, rather than just adding a chapter here and there.  This is, however, a double-edged sword. It means that you can pick up the latest edition, and still find it useful if you've read previous ones. However, to conserve space, the book becomes more and more compact, so some of the great sections like a comparison between C++ and Java from the first edition is reduced to a two page summary of bullet points. Java in a Nutshell, 3rd Edition is, nonetheless, the best Java reference available on the market. It covers all the core Java technologies, save the Abstract Windowing Toolkit and Swing graphical libraries, which have been relegated to the new book "Java Foundation Classes in a Nutshell". This will be a disappointment to some, but if you're looking for a language reference, and not a guide to GUI programming, this title is an excellent buy. Particularly if you're new to the Nutshell series, David Flanagan's fast paced guide to Java is a perfect desktop reference -- David Reilly For more information about this title, or to order it, visit http://www.davidreilly.com/goto.cgi?isbn=1565924878 ================================================================= Interview with Duane K. Fields, and Mark A. Kolb, on JavaServer Pages Duane Fields is a web applications developer and recognized Java expert, while Mark Kolb has been programming in Java since 1996, and in object-oriented languages since 1984. Together, they co-authored "Web Development with JavaServer Pages". Q: What do you believe has been the biggest change affecting the Java community in the last year? A: Duane and Mark - The biggest changes we've seen in the past year is the rapid acceptance of J2EE and the emergence of no or low cost application servers. A year ago support for servlets, JSP, was a bolt-on to other servers, and a free (at least for development) EJB server was nowhere to be found. Today servers like Orion and JRun are available for aspiring server side Java developers to sink their teeth into. I think the availability of such servers is allowing companies to investigate J2EE as well, without having to outlay a large sum of cash up front. Q: How do you find Java stacks up to other programming languages, such as C++ or VBScript for ASP? A: Duane - In terms of rich, object oriented design Java is the only game in town, in my opinion. ASP is by definition locked into Microsoft's platform, and doesn't offer the clean, modular abstraction one can obtain with Java. Q: How does Java Server Pages stack up to competing technologies like Microsoft's Active Server Pages (ASP)? Can JSP match the performance and scalability of ASP, or should developers be evaluating other issues such as portability and ease-of-use? A: Mark - If just addressing performance issues, NT solutions like ASP are throttled by the fact that they only run on NT. In my experience a similarly equipped Unix machine will beat the NT box in terms of scalability, concurrent connections, and performance. The performance of JSPs are a function of the performance of the VM, the application server, and the hardware, so it's hard to make blanket statements. Duane - All things being equal, in my experience they are "equally fast". So performance isn't really an issue. Certainly JSPs are more portable, and in many ways easier to use. Especially if you stay away from scriptlets (embedded code) and use the JavaBean related tags. The use of these tags, and custom ones as well, allows web content developers without any coding experience to create dynamic content with JSP. Q: How do you see JSP in relation to Java servlets? There seems to be a fair bit of overlap between the two. Are there some situations where JSP is preferable to servlets, and vice versa? A: Mark - Well, JSPs ARE servlets really. JSP code gets parsed, turned into a Java source file, and compiled into a servlet class on the fly. However, it is useful architecturally to speak of them as separate beasts. I recommend using servlets for application control only, deferring all content generation to the JSPs. For example, to display a record from a database you should direct the request at a servlet which collects the data into a bean and forwards the request onto a JSP page for display. Coders can work on servlets, web developers can work on the JSPs. Q: How do you see Java Server Pages fitting into the framework of the Java 2 Enterprise Edition (J2EE), and Enterprise Java Beans (EJBs)? Will the average JSP developer need to draw on all the different technologies in J2EE? A: Duane - As alluded to in the previous question, JSP is THE presentation layer for server side applications. JSP allows you to pull content out of servlets, and I think EJBs are great for pulling out business logic in to reusable modules. I think any server side developer working on projects of any complexity will need to learn EJBs, at least understand how to access beans written by others. Q: Since most, if not all, of your readers will be looking to deploy their JSP applications on the web rather than within an Intranet environment, what should they look for in a hosting provider? Are more hosting providers supporting JSP and servlets, or is it still an ASP lead marketplace? A: Mark - I don't think they are really competing in that space so much. I would think most JSP/Servlet developers are not hosting their pages and applications on ISP machines, but are rather co-locating their own boxes which they control. Since until very recently there were no low/no cost J2EE servers out there, you won't find that many JSP hosting services. Q: While there are plenty of e-commerce sites that use either existing technologies, such as Microsoft products, or proprietary systems, it seems like there's a large number of new web startups that are running JSP on their sites. What sort of percentage of the market do you think JSP claims now? A: Duane :  I have no idea.... Surely there are more ASP programmers out there, and NT is certainly pervasive (like it or not). I think that this percentage would differ dramatically depending on what market segment you were looking at. It is a whole lot easier, but not necessarily better, to throw together an ASP site. Developers are easier to find, and you can hack together something pretty easily by hard coding scripts into the pages, etc. In the long run, you end up constantly maintaining pages, writing the same code over and over again, and having to use programmers to edit your content. Mark : With respect to web startups, I think the appeal of JSP is its inherent flexibility. JSPs provide access to the complete suite of Java APIs and extensions, are fully integrated with servlets, operate on a wide range of platforms, and are supported by a large number of vendors. These qualities all support the quick response to changing market conditions that are the lifeblood of an Internet startup. Q: Looking to the future now, where do you see Java heading? Do you think Java will continue to make inroads with the server- side market and eventually topple other technologies like Microsoft's Active Server Pages? Are there other complimentary technologies on the horizon, such as J2EE, which you're particularly enthused about? A: Duane and Mark - Companies are starting to see the inherent risks of vendor lock-in. This is why we are starting to see such a leap to J2EE. Microsoft has a marketing machine however, and frankly I suspect that a lot of IT and development managers who don't know anything but the Microsoft way will happily submit to their captivity. Java is not just "multi-platform", more importantly its multi-vendor. At my company, we don't even like to tie ourselves to a particular servlet engine or application server. We want to be able to switch suppliers when something new comes along or they can't meet our requirements. Thanks Duane and Mark for talking to us about JavaServer Pages, and related technologies. Their book, Web Development with JavaServer Pages, is published by Manning, and covers JSP 1.1, the latest release. ================================================================= Interview with Ed Roman, on Enterprise JavaBeans Ed Roman is one of the world's leading authorities on EJB and J2EE. He is the author of Mastering Enterprise JavaBeans and the Java 2 Platform, Enterprise Edition, an advanced book on EJB and J2EE development. He is also CEO of The Middleware Company, a firm specializing in EJB training and consulting. In this exclusive interview, we talk with Ed about EJBs, and web development with the Java 2 Enterprise Edition platform.  Q: What do you believe has been the biggest change affecting the Java community in the last year? A: The biggest change is Microsoft's decision to drop Java in favor of C# (pronounced "see-sharp"). C# has a chance of becoming the de-facto programming language for Win32-only applications, just as Java has become the de-facto programming language for cross-platform applications. Another noteworthy advancement in technology is Microsoft's .NET initiative. There are some powerful ideas in their new architecture, and if Microsoft can execute on their promises, .NET will definitely give Java a run for its money. It's going to be an interesting battle ahead. Q: How do you find Java stacks up to other programming languages, such as C++, for designing large-scale enterprise applications? A: Java is my top pick. Why? Because: * Java has built-in security, networking, and threading, all essential for enterprise-class applications. * The virtual machine model, along with garbage collection, means applications are more reliable and less error-prone. * The fact that Java is divided into 3 platforms (J2ME, J2SE, and J2EE) means different markets benefit from different flavors of Java.  * Enterprise-class applications are often written by ISVs which don't control their deployment environment and require cross-platform development. There is incredible momentum behind Java. Most developers are hungering to get on Java projects. This means that organizations adopting Java are likely to have an easier time finding good developers in the future.  Q: For the novice, what exactly are Enterprise JavaBeans? How do they fit in with other Java technologies, like JavaServer Pages and Servlets? A: EJB is the cornerstone of server-side Java. You wouldn't use EJB for embedded devices or desktop applications, you'd use it for the hard-core business logic and data logic required for large-scale multi-user applications. EJB is tied together with JSP, servlets, and other server-side Java technologies via the Java 2 Platform, Enterprise Edition (J2EE) specification. You can think of EJB as a subset of J2EE. The rest of J2EE provides the glue and missing puzzle pieces to built complete web sites. Q: While it's still early days yet, have you seen any successful EJB/J2EE projects? A: Absolutely. My company has helped clients develop and deploy EJB systems used for a variety of tasks. These include: * Rating financial bonds * Performing online procurement * Coordinating with airplane navigation equipment * Mapping the human genome * Performing workflows to process orders * Managing telephony switches * Performing banking transactions Q: That's an impressive list of tasks. What methodology do you recommend companies take to develop successful EJB systems? A: We've devised a 4-step procedure to getting EJB projects started on the right foot. These steps include:  1. Training your staff on the technologies. By educating your developers in a controlled environment, they can learn in days what would normally take weeks or months. 2. Design work. This includes analyzing business requirements and mapping those into a reusable EJB architecture. The Unified Modeling Language (UML) should be used for all diagrams. 3. First-pass development. I strongly encourage firms to consider an iterative development process, where they divide their design into 'slices' of EJBs, JSPs, and servlets, and build a complete slice first. This re-usable slice is demonstratable to management and/or investors, and can be used to perform scalability testing before the entire application is developed. 4. Selection of an EJB server. To choose the right application server, first come up with a short list of 2-3 vendors you're choosing from. Then bring those vendors in-house, and deploy your first-pass into each of those vendors' application servers. This empowers you to evaluate how they handle your specific needs. You can find out more about this process at http://www.middleware-company.com/quickstart.html    Q: What would be the best development tool for an EJB developer? Which server do you think stands out from the crowd? A: My preferred tool is Visual SlickEdit because its simple and fast. However, that is not an EJB-specific tool. There are some newer tools that are emerging that dwarf SlickEdit when it come to EJB functionality, and they include IBM's VisualAge for Java, Inprise's JBuilder, and WebGain Studio. Q: The complexity of the Java 2 Enterprise Edition platform, and technologies like Enterprise JavaBeans, makes for a steep learning curve. In what way does your book assist developers in understanding and learning EJBs? A: My book explains EJB by first explaining the technologies that EJB depends on: RMI, JNDI, RMI-IIOP, and XML. So you only need to know Java to understand EJB. You can download a complete electronic copy of the book (in PDF form) from http://www.TheServerSide.com, or order a print edition from all good bookstores. Q: Looking to the future now, where do you see Java heading? Is there a particular technology that you're enthusiastic about? A: I think the most important technology that the Java community should keep an eye on is the Simple Open Access Protocol (SOAP) along with XML. In the future, many web sites will be constructed in a piecemeal fashion from other web sites that they subscribe to, and SOAP enables this to happen. Q: Ed Roman, thanks for talking with us. You can order Ed's book, Mastering Enterprise JavaBeans and the Java 2 Platform, Enterprise Edition, from all good bookstores, or online from Amazon.com.  http://www.amazon.com/exec/obidos/ASIN/0471332291/davidreillysprog ================================================================= Q&A : What does a void return value mean? Which class is being returned? You've probably heard of this method :- public static void main(String args[]) before. It's invoked by the JVM when starting a Java application. Have you ever wondered why it didn't have a return statement at the end of the method? After all, don't all methods return a value? It's possible, and actually quite common, to not return a value. If you're not going to return a value, however, you must mark your method as void. This tells the compiler there's no need to enforce a return value. ================================================================= 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