JSP Insider - http://www.jspinsider.com

News - Articles/Tutorials/Code/Reviews - JSP/Servlet Hosting Companies - Links

JSPBuzz Vol I: Issue 9 -- 11/21/2000

HTTP://WWW.JSPInsider.com/ .
================================================================

***** IN THIS ISSUE ************************************************** 
News
1:Sun Releases Bug Fixes for Java 1.3
2:UltraDev 4 Release

Rambles 
1:Thoughts on Code Reuse
2:Pondering Comments

Links 	
1:Struts Framework
2:Incremental Development with Ant and JUnit
3:Microsoft's Big Picture
4:Free Radical ( P2P Discussion )
5:JUnit 3.2
6:ITtoolbox
7:Experiments
8:2Ce
9:JSP Chart Tag Library

Main Topic 
1:A Programmer's Step-by-Step Guide to Netscape 6

Like this newsletter? Tell a friend about the JSP Buzz!


================================================================
                       THE LATEST NEWS
================================================================
1) Sun Releases Bug Fixes for Java 1.3 (Sun 11/10/2000)
Sun released Java Version 1.3.0_01. The biggest update is
support of the Java plug-in for Netscape 6. 

2) UltraDev 4 Release (Macromedia 11/17/2000)
The battle for the IDE of choice still rages for the JSP community.
One of the more popular JSP IDE's, UltraDev, just released a new
version that will be available December 2000.  


================================================================
                   Rambles by Casey Kochmer
================================================================

********************** Thoughts on Code Reuse **********************

In my Internet travels I wandered into a review for 'Extreme Programming' 
which made the following point:

    Don't design and code for reuse until reuse is needed. 

From, my programming experience I found myself agreeing and disagreeing 
with this statement. I code, breath and think in object orientation. 
The best programs I have ever written are OOP jewels, so I am a strong 
believer in code reuse. The extreme programming statement, however, has 
some truth in it.  Except for the largest projects, the object oriented 
framework should be minimized.

An object-oriented library should grow into your needs. Programmers 
should never try to pre-build more than what is needed. I have found 
from practical experience that 80% of the objects, functions and stubs 
which are built for future use, never get used. A project should 
concentrate on what is known to be needed. The framework and library, 
however, need to be built with some flexibility for expansion. These 
two requirements are in contention, so normally I use a 70/30 split. 
This means 70% of the design and layout effort addresses the immediate 
needs of the project and 30% of the effort is invested in making the 
library flexible. 

The most difficult part of design is distinguishing between perceived 
and actual needs.  Regular reality checks with customers and other 
programmers working on the project are required.  These checks are 
often ignored, however, because of tight schedules, over confident 
programmers and the desire to build the best possible product.  But 
often the best product is the simplest solution.  A minimalist approach 
gets the project done faster, allows programmers to react quickly to 
changing needs, and requires less training for the final framework.

Object oriented programmers like to anticipate problems and needs early
in a project.  But this is often overkill on small and average projects. 
The end result is code which won't be used and these unnecessary extras: 

- Time and budget spent for something not needed.
- Little used code that has to be maintained.
- Confusion from programmers who wonder what was the purpose of 
  the unused code.

I am not saying don't use OOP. The trick for most projects using OOP 
is to build toward minimal, not perceived needs. As I design my OOP 
projects, my first design question is, 'What do I need,' and my second 
question is always 'Will this be used in this release.'  This is 
something that takes experience and practice to get right. 

While I am not an Extreme Programmer myself, I have noticed, I do share 
some common beliefs with Extreme Programming. If you are curious to
read more about this methodology you can check out the following 
reference materials.

Going to Extremes (Bruce Abbott)

Extreme Programming: A gentle introduction. 


********************** Pondering Comments **********************

I came across another statement which made me stop and think.

     Comments are a waste of time so don't use them.

While I highly disagree with this statement, a certain truth hides 
within the statement. Sadly, many comments in code should never be 
written. I know programmers who, when they start to maintain code from 
someone else, they first remove the comments. On average, comments are 
never maintained, and as a result are dangerous to the unwary. Ask 
yourself, 'How many times have I seen comments in code which no longer 
apply and cause confusion to the person trying to maintain the code?'  
When you maintain someone else's code, how often do you look at the 
comments? The reason for the low success rate for code commentary is the 
misdirected effort to document the wrong things. While comments should 
be used, they should only be used for the following:

1) Training.  In coding examples comments are invaluable.
2) Documenting the logical process of the code, NOT what 
   the code is actually doing.
3) Generating decent Java documentation within Java.  This is a 
   simple and elegant solution for documentation management of
   objects and should be used where possible. 

The major reason most comments are useless is due to the fact they 
are detail oriented. Code statements and details change as you update
your code. For the most part, code statements are self documenting or
system documentation is readily at hand to determine what statements 
mean.  The only time a specific detail should be documented is when 
something is extremely confusing and a footnote will serve to lessen 
the confusion. 

Logical processing, however, is not always intuitive, tends NOT to 
change over time and is easily documented early in your coding process.  
I find these comments are very important to my style of programming, 
since, when numbered in sequential order, they quickly orient a 
programmer within the code -- like a road map. Also, while code 
statements might make sense, the logical sequencing isn't always 
clear without a detailed overview of the code. Commenting on logical 
flow saves time for code reviews.

In my opinion, using comments to build Java documentation files 
was a stroke of genius by Sun.  I strongly urge the use of comments 
to generate the system documentation for objects.  Note that these are 
high level comments which document the purpose of the objects and 
methods. Avoid using these comments for blow-by-blow detail of what 
is happening within the code. 

As with most things in programming, even the simplest of actions have
complexity to them. It is interesting to take a look at something which 
is taken for granted (such as comments) and then break it down into a 
practical implementation. In doing this, it often becomes apparent that 
perception and reality are actually two different things.


================================================================
              Links of Interest
================================================================
[Open Source] Struts Framework
The Struts Framework is an open source framework useful in building 
web applications with Java Servlet and JavaServer Pages (JSP) technology 
using a Model 2 layout. Struts is currently on release .5, but it
is worth looking into now since it will become the reference framework
of choice in many JSP projects.

[Article] Incremental Development with Ant and JUnit (Malcolm Davis 11/2000)
This article shows you how to use ANT and JUnit to set up unit testing 
on your Java project. Unit testing can reduce both long term development 
time and the amount of bugs your customer will experience. This is the 
first article I have come across which shows how to set up a simple test 
environment for a Java Project.

[Article]  Microsoft's Big Picture  (Luis Escalante 11.12.2000)  
More about the big picture from Microsoft. The .Net framework is more 
than just a new package for Microsoft's web tools. This is Microsoft's 
aggressive road map to achieving expanded dominance in the marketplace. 
But .Net is not going to be fully realized anytime soon.  Rather, this 
is an ambitious five year plan. This article gives a nice overview of 
what Microsoft is working to achieve and what to expect over the next 
few years.

[Interview] Free Radical ( P2P Discussion ) (Richard Koman 11/14/2000)
This very interesting interview with Ian Clarke discusses what peer-to- 
peer really is and where it might go in the future. Ian Clarke is the 
founder of the Freenet network.  

[Open Source] JUnit 3.2
This open source program provides a framework to write repeatable tests. 
JUnit is commonly used as a testing platform for programming with the 
Extreme Programming methodology. While reading the documentation, I came 
across a great statement  "Whenever you are tempted to type something 
into a print statement or a debugger expression, write it as a test 
instead.". This makes sense to me.  Instead of writing a once only
debugging check, why not spend a little extra time to make a reusable
test.

[Portal] ITtoolbox 
ITtoolbox provides access to several technological style portals. This 
link takes you to their Java Portal.

[Site] Experiments (Sebastien Chevrel) 
Sebastien has several nice DHTML examples on his experiment page. While 
the page is a bit frustrating to use, I found "reactive voyeurism" and 
"pseudo-physics simulation" to be interesting examples of what can be 
done with DHTML. 

[Browser] 2Ce 
What makes this browser different is the fact it lets you view 5 pages 
at a time. The set up is very different and has interesting possibilities 
for page and more importantly web site design.  2Ce is a hint of things to
come. After XHTML has become standard (which means web content won't be as 
bound to current media display restrictions) we will see an explosion of 
different user interfaces being built such as 2Ce.

[JSP Tag Library] JSP Chart Tag Library 
The Woolox Chart library is a custom JSP tag library used to generate 
dynamic charts.  This version is only for evaluation use and the 
product is still in development.


================================================================
         MAIN TOPIC by Casey Kochmer & Jayson Falkner
================================================================

********** A Programmer's Step-by-Step Guide to Netscape 6 ***********

Netscape powered by the Gecko browser engine is officially in production. 
Here's a step-by-step guide on how to kick start your web development to 
use Netscape 6.


Step 1:

First, of course, you will need to download it. But before you rush out
to install it, a helpful hint. Perform the custom install or AOL will 
force feed your machine all sorts of add-ins for which you will need 
a Hoover vacuum cleaner to remove from your system.

Netscape 6 Download


Step 2:

The good news is that Netscape 6 is built to support the HTML4.0, CSS 
and DOM standards recommended by the W3C. The bad news is that pages 
which worked in Netscape 4 may not work in Netscape 6 for the very same 
reason. So, if you are not familiar with these standards, a review is 
in order. To get an overview of what is happening in Netscape 6 and the 
changes in DHTML you are facing check out the following articles:

Is Your Site Ready for Netscape 6? (Michael Kay 04/06/2000)

DHTML First Aid for the 6.0 Browsers (Scott Andrew 4/28/00)

Preparing for Standard-Compliant Browsers, Part 1 and 2 (Makiko Itoh)


Step 3:

Review changes in the scripting environment. Scripting for your DHTML
became much easier and you have been given the keys to a more powerful
tool set. Rejoice and read on!

Scripting for the 6.0 Browsers (Scott Andrew 4/20/00)


Step 4:

Not only has your DHTML changed, but Netscape 6 now supports XML Name-
spaces, XML and RDF. If you are unfamiliar with these acronyms be sure 
to read up on them. Netscape is also pushing a new idea called XUL. It 
allows developers the freedom of defining a unique user interface which 
will run on any platform using a combination of the DOM, CSS and XML.

Netscape's XUL Developer Central

Netscape's XML Developer Central

Netscape's RDF and Metadata Developer Central


Step 5:

Throw away Netscape 4.  After fighting DHTML in Netscape 4, we are 
glad Netscape 6 is here so we can begin writing the next generation 
of cross browser pages.  We plan to write only for Navigator 6 and 
Internet Explorer 5.  We think, in most cases, trying to keep DHTML 
compatible with both Netscape 4 and 6 is an investment with diminishing
returns.  Make the switch as quickly as you can and don't look back.
 

Step 6:

Here are some observations and notes of interest.

Netscape 6 appears to be a solid browser.  It still has bugs, but it's 
a great improvement over Netscape 4.  The Gecko engine is a strong move 
toward standardization and will hopefully encourage other browsers to at 
least support all of the standards before creating extra features. 

Here are some tidbits to get you started with Netscape 6:

- CASE SENSITIVE! No more sloppy coding. The biggest hit on this will
  be your style sheets. For example, in our style sheet we had '.Green' 
  as a style and several of our pages referenced '.green'. As a result 
  our site didn't display correctly in Netscape 6. If you use style 
  sheets on your site you need to double check all your cases. (Note, 
  IE is not case sensitive)

- The days of 'document.write' are numbered. On-the-fly creation of 
  objects and manipulation of the DOM are now supported. If you need 
  something on your web page, just add it to the DOM and it is there!

- Your styles are now included in the DOM. Manipulating them just 
  involves editing the right nodes.

- JavaScript is unchanged. You just need to get used to using the 
  new DOM.

- Unlike NS4, the true source code is now shown in the view-source 
  option under the menu.

- If you want to debug look under the menu item Tasks>Tools.  The 
  Java and JavaScript consoles can both be found right here.

- While learning the new DOM try this small script to show what is 
  in the DOM.

  First add this line of code to a web page:
  <script src="http://www.jspinsider.com/jspbuzz/nov2000/domReader.js">
  </script>

  Then change your body tag to include onLoad="init()":
  <body onLoad="init()">

  Now view the page with Netscape 6.  A new window pops open displaying 
  the DOM!

- If you want to learn NS6, read, Read, READ! The links we provided 
  will give you a solid starting point. We then suggest learning the 
  W3C standards. The W3C explains everything from the ground up. Besides, 
  everything you could want to know is already documented!

  World Wide Web Consortium
 

A Final Note

The developer community has been in a flurry of debate about the Netscape 
release.  Many developers are upset because they feel that Netscape 6 
has too many bugs and was released too soon. David Flanagan started a 
petition to try to get AOL to fix these bugs before the release.  While 
we have experienced some of these bugs ourselves, we appreciate having 
a browser that is far superior to Netscape 4.7.  We'll give David the 
final word in this link to his response to the debate he launched a 
few weeks ago.

Netscape 6.0 Released (David Flanagan  11/16/2000)

================================================================
                           SUBSCRIPTION
================================================================
You may unsubscribe from or subscribe to this newsletter by going to:
http://www.jspinsider.com/jspbuzz/index.html

Browse all of the JSP Insider source-code.

Questions or comments? Contact support@jspinsider.com.