Order matters
Efficiency notes from coffee to code
Each morning after updating java.net, I head downstairs to make coffee and take care of our dog. The order in which I address the tasks depends on which method of coffee preparation I'm using. I prefer to use the vacuum brewing method - in which case the water needs to come to a boil before anything else much can happen. This means that step one is fill the pot with water and set it to boil. Then feed the dog. Grind the coffee while she eats. Put in the top part of the brewer, insert the stopper, add the grounds, and set the timer for three minutes. Let the dog out.
If instead, I decide to use a drip coffee maker, the changes. I might as well get the dog food on my way in to the kitchen. As I pass the grinder, I pause with the dog's food still in hand to set the grind and start the process. Feed the dog. Fill the coffee maker with water and the grounds and flick the switch. Let the dog out.
This labored look into my morning schedule was sparked by a blog on improving performance in your code from JavaWorld magazine. In the kitchen, you smooth out your day by considering which machines you will just end up waiting on. The same is true in your code - I know you aren't supposed to prematurely optimize, but if your code is not performing as you would expect, the blog contains a reason that I'd never considered. It's arises from the order of evaluation of the JVM.
In Also
in Java Today , as you look to improve the performance of
your code,
Be Careful of Premature Parameter Construction. Ray Djajadinata
writes an investigation into code in which "It turned out that an
old (but unfortunately huge) part of our app was sprinkled with
method calls like this:
logger.debug("parameters: " + parameters.toString());
These thousands of string concatenations still happened although we
had turned disabled the DEBUG logging level, because the string
concatenation (and the call to parameters.toString()) happened before
the debug() method is even called! This "unwanted parameter
construction" is mentioned very clearly in log4j's FAQ and javadoc,
but... people do forget."
"What is preventing people from building GUIs in an Agile way? Whether their application is web-based or a desktop application, most developers don't do test-driven development (TDD) of the user interface. This is for a simple reason: unit testing GUI software is hard." This is the problem that Paul Hamill, author of Unit Test Frameworks sets out to fix in Agile User Interface Development. By splitting his GUI elements into "smart objects" and "thin views", he maximizes the functionality that can be exposed to testing.
In Projects and Communities, The new Portlet community is featuring a book excerpt Building Portals with the Java Portlet API . "Several example portlets are developed to give you hands-on portlet experience. You'll even learn how to port existing servlet and JSP applications into a new portal environment."
From the Mac Java Community homepage: Apple's Development Tools page is featuring JDock, a Swing-based framework for managing inner windows or components, using common layout managers like BorderLayout or GridBagLayout. It allows you to dynamically add and remove actions, save and restore the state of your environment, and avoid using split-panes.
. In today's Forums,
In today's java.net News Headlines :
- Tomcat 5.0.30-beta
- Netty2 1.8.0
- Sleep 11.25.04
- Microsoft Proposes Piracy Amnesty
- TightVNC 1.3dev6
- JDock 1.1
Registered users can submit news items for the java.net News Page using our news submission form. All submissions go through an editorial review before being posted to the site. You can also subscribe to thejava.net News RSS feed.
Current and upcoming Java Events :
- November 27 Hong Kong JUG - J2SE 5.0 Update
- December 6-9, 2004 TheServerSide Enterprise Java Architecture Workshop
- December 7-8, 2004 Eighth Jini Community Meeting
- December 13-17, 2004 JavaPolis, 2004
Registered users can submit event listings for the java.net Events Page using our events submission form. All submissions go through an editorial review before being posted to the site.
Archives and Subscriptions: This blog is delivered weekdays as the Java Today RSS feed. Also, once this page is no longer featured as the front page of java.net it will be archived along with other past issues in the java.net Archive.
Efficiency notes from coffee to code- Login or register to post comments
- Printer-friendly version
- daniel's blog
- 467 reads





