Skip to main content

Working from a Template

Posted by daniel on December 16, 2003 at 4:20 AM PST

Dear [reader.name], we hope you will enjoy the article published [content.date] by [content.author] called [content.title] about [content.summary].

Not exactly the personal approach we give you here at java.net, but a mail merge is just one of the obvious applications of a templating engine. Erik Hatcher explains that " A template engine processes a template and fills in the parameterized pieces with concrete data. The bulk of this article focuses on email templating with Velocity. The template, in this context, is an email body with special syntax used to indicate points within the email to insert specific data, such as a name, order number, or order details."

In Velocity: Fast Track to Templating, Erik starts with a quick example to motivate his explanation of the key concepts of the context and the template. "Objects in the Velocity context are accessed using references from within a template." After providing you with a detailed email template example, Erik writes that, "The trickiest thing when working with Velocity is configuration. Several configuration options are available with Velocity. For the Emailer example, Velocity needs to know how to find the template." His examples provide a great (and very fast) introduction to using Velocity.


In Projects and Communities, the Java Web Services and XML community points on an ONJava article Understanding JAXB: Java Binding Customization. Author Sayed Hashimi writes that the benefit of JAXB is that it "automates the mapping between XML documents and Java objects and vice versa." The down side, he writes, is that "the compiler usually generates bindings that are awkward to work with." His article shows you how you can customize the default bindings to fit your needs.

In his Velocity article, Erik Hatcher writes that Velocity is used as a templating solution in the code-generation tool XDoclet2. The JavaPedia page on XDoclet refers to XDoclet as "A code generation engine that provides a solution to DeploymentDescriptorHell. "


In Also in Java Today Ramnivas Laddad publishes the first of his two part Server Side series on Aspect Oriented Refactoring. He argues that refactoring can only go so far. "Aspect-oriented refactoring goes beyond conventional refactoring techniques. While steps in conventional refactoring modularize code into a clean OO implementation, the use of AOP squeezes out code that cannot be further refactored. Aspect-oriented refactoring offers substantial improvement in a variety of situations such as exception-handling policies, local contract enforcements, concurrency control, and worker object creation."

Bill Venners continues his discussion with Ward Cunningham. In this part they discuss Collective Ownership of Code and Text. Ward explains that sometimes "there's a problem in a bunch of code. You know the solution to the problem, but the solution touches a bunch of modules. The needed refactoring is a lot of hard work, and it's made even extra hard if you has to go negotiate with every original author. You just want to go make it right. The trouble is that the code might be organized in a hierarchy, but the solution has more dimensions than will fit in a hierarchy. So when you discover a solution in a dimension that crosses across the hierarchy, you just have to go where the solution takes you and put the solution in. "

Ward explains what happens when two programmers disagree about the best solution for a given problem. "I can't tell you how much time is spent worrying about decisions that don't matter. To just be able to make a decision and see what happens is tremendously empowering, but that means you have to set up the situation such that when something does go wrong, you can fix it. When something does go wrong, it doesn't cost you or your customer an exorbitant amount. It isn't ridiculously expensive. When you get in situations where you cannot afford to make a mistake, it's very hard to do the right thing. So if you're trying to do the right thing, the right thing might be to eliminate the cost of making a mistake rather than try to guess what's right."


In Weblogs .
Douglas Tait asks Interoperability or Portability - When Networks converges with Computers.. He defines the terms: "Portability is the ability to move a program or programing logic from one system to another system, usually with minimal overhead, or in the case of Java, virtually no overhead. Interoperability is the ability of systems to seamlessly communicate with each other. " He concludes that there are many good portability solutions but "Unfortunately the same cannot be said about interoperability. The only success story is the Internet, where vendors either adhere to the standard or do not play. This is not the case with other networks such as Telephony with SS7 and even with newer protocols such as SIP for Voice of IP. There is no enforcing agency for these networks, and the communications industry is not as economically driven as the IP Network to drive companies to a a single standard."

In Security Strategies Philip Brittan blogs about an article he recently wrote for CNet News.com that argues that "fat-client architectures are inherently vulnerable to attack, and that by switching to a thin-client model we can cut down on the amount of raw material that malware has to attack." He then points to his recent article for ZDNet about what must be done to employ "fence in" strategies for viruses, hackers, and spam.

James Todd relays the announcement that JXTA 2.2 [is] final. The Timpani release includes both new features and bug fixes. The new features include Lightweight PeerGroups, Extendable Advertisement, and the Improved JNLP packaging that Todd has recently written about. He also invites you to help shape the next "Chirasco" release of JXTA".


In today's java.net News
Headlines
:

Registered users can submit news items for the href="http://today.java.net/today/news/">java.net News Page using
our
news submission
form
.
All submissions go through an editorial review by news director Steve
Mallet before being posted to the site. You can also subscribe to the
href="http://today.java.net/pub/q/news_rss?x-ver=1.0">java.net News RSS
feed.


Current and upcoming Java
Events
:

Registered users can submit event listings for the href="http://www.java.net/events">java.net Events Page using our href="http://today.java.net/cs/user/create/e"> events submission
form.
All submissions go through an editorial review before being posted to
the
site.


This blog is delivered weekdays as the href="http://today.java.net/pub/q/java_today_rss?x-ver=1.0">Java Today
RSS
feed. Once this page is no longer featured as the front page of href="http://www.java.net"> java.net it will be archived at href="http://today.java.net/today/archive/index_12162003.html">
http://today.java.net/today/archive/index_12162003.html. You can
access other past issues in the href="http://today.java.net/today/archive/">java.net Archive.