Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Web Development

NetBeans 6.0: A First Look


NetBeans 6 Tools Support

Three areas of improvements worth noting regarding tools in NetBeans 6 are the Profiler, HeapWalker, and the integration of JMeter. Of course, NetBeans offers other tool support, such as JUnit for built-in unit testing, Ant for script-based system builds, deployment, and testing, as well as multiple source code control systems. First, let's look at the Profiler.

It's important to know how your code behaves as thoroughly as possible, even during the development cycle. This means you need to watch it in the debugger, force the execution of error handling code paths that otherwise get executed in rare conditions, and perform black-box testing. When those steps are complete, it's helpful to get a view of your code as it runs from the computer's point of view. This is where the code profiler comes in to play.

Code profiling measures the execution time of your code as methods are called, classes are loaded, and memory is allocated and freed. The Profiler tool that comes with NetBeans will do this for you when you choose the Profile Main Project menu option from the Project menu. After starting your application in the Profiler, exercise it as thoroughly as possible, as applicable to the area you're testing. Afterwards, NetBeans will display a graph that shows which classes and methods were called most, which code took the longest to execute, and so forth (see Figure 5). This is a tool that most developers should already be familiar with.

[Click image to view at full size]
Figure 5: The NetBeans Profiler displays code in graphs that highlight methodsthat are called most, and methods where the most time is spent (hot spots).

A new feature in NetBeans 6 lets you explicitly insert profile points (to measure execution time within a certain block of code) without requiring you to add invasive instrumentation code (see Figure 6). You can time the execution of code, or take snapshots of memory usage to perform deltas with at a later time. Profile points can be tied to specific lines of code, events that your code handles, or they can be time-based.

[Click image to view at full size]
Figure 6: You can insert profile points via this dialog, which is available when you right-mouse click on the line of code you'd like to profile, and choose the Profiling...Insert Profile Point option from the pop-up menu.

The HeapWalker tool, traditionally available as a standalone application with the JDK, is enhanced for use within NetBeans. With it you can monitor garbage collection, view which classes use the most memory in terms of percentage, instance count, or size in bytes (see Figure 7), and you can drill down into specific instances of a class and inspect its memory usage (see Figure 8).

[Click image to view at full size]
Figure 7: With the integrated HeapWalker tool, you can see your code categorised by instance count, size in bytes, or percentage of heap used.

The integration of Apache JMeter lets you perform server performance testing, for both static and dynamic web resources. All of the statistics are integrated with NetBeans' graphical profiler display.

[Click image to view at full size]
Figure 8: HeapWalker lets you drill down into specific class instances to get detailed memory usage information.

UML support has also grown in NetBeans 6. You can create projects based on UML, and then generate Java source code from the diagrams. New with this release, you can reverse engineer existing Java projects and create complete UML models from them. At that point, you can modify the UML, or the Java code, and the changes will be automatically round-trip integrated into the opposing view. The result is that both the Java code and UML models for your application will be kept in sync automatically. Additionally, the code that's generated is done so according to your customized code templates, and does not contain ugly code markers.

Other tools that are continually enhanced are the debugger and the GUI builder. For instance, with competing IDEs as well as previous versions of NetBeans, choosing to step over a line of source code that consists of multiple expressions (such as with if and for statements) would cause focus to remain on that line until all expressions were evaluated. With NetBeans 6, when you step over a line of source, all expressions are executed, and the focus moves to the next source line automatically. This feature alone is worth upgrading to NetBeans 6, in my opinion.

To aid in building applications with graphical user interfaces, new controls allow you to generate UI components directly from your data sources. From that point, the generated UI is automatically kept in sync with changes to the data source. Customizable boilerplate code is included to enable this feature.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.