Originally posted by Chris Adamson
Copied here for quick reference by Satya Komatineni
by Chris Adamson
v 0.5, 13 Mar 06
This guide is meant to help you write an article that fits the general style and approach that we look for ONJava. After editing for a while, I have seen a lot of the same problems and hope reading this document can help you avoid them, resulting in a better article that gets published sooner and more easily. There is a companion document, onjava-javanet-template.html that addresses HTML source-level formatting details (please be aware that we only accept articles in HTML -- Microsoft Word documents will be discarded without being read). Another document, onjava-javanet-processGuide.html covers the process of proposing, submitting, and being paid for an article.
If you take away only one thing from this guide, it's this: write to be read. In other words, always be aware of what the reader is getting out of your article, craft the article in ways to help the reader understand the material, and don't create any roadblocks that will prevent readers from enjoying the article and learning from it. As an editor, my philosophy is that what counts is what readers get out of an article, not what the author, editor, producer, etc. put into it.
An ONJava article consists of four sections:
list that should be at the end of every ONJava article, collecting links relevant to the material covered in the article, like the home pages for any projects or products you've mentioned, or articles or books for further reading. If you are providing a sample code zip or tar.gz file (most articles should), the link for it should be the first item in the list. The resources header should look like this:
Resources
You can then refer to the resources section in the body of the article with a link like this:
See the resources section for the sample code.
Our ideal article size is 2,000 words. Research shows readers bail out of longer articles, so keep things short and focused. A 4,000-word article will be returned to you with suggestions for cutting half of it out, and a 7,000-word article will probably be returned to you unread.
As I said in the introduction, write to be read.
One way to do that is to appeal to the reader's self-interest: think of what they're going to get out of reading this article. Maybe they'll be able to build web pages more easily, create more reliable code, get better performance, etc. Whatever the benefits of reading the article, it's helpful for you as an author to know what they are, so that when you re-read your work, you can say "is the reader going to get the benefit of reading this article?"
Despite Java's balkanization, you might be surprised to know that many readers will read articles well outside their realm of experience ? for example, few developers actually code J2ME every day, but many want to understand it better. For this reason, you should try to make your article accessible even to those readers who aren't subject matter experts in what you're covering. Often times, you can catch people up with just a phrase here or there, providing a little information to allow the reader to infer enough information to keep reading your article.
For example, most readers of this document haven't worked with QuickTime (which I wrote a book about), and will not understand the following description of how it handles MP3 metadata:
The tags become children of thebut if I just add a little bit to catch you up:moov
atom'sudta
, which is created if necessary.
TheEven if you'll never write a line of QuickTime in your life, you can probably keep reading and get the general idea of what I'm talking about, since this explains whatmoov
atom, which describes the movie's structure, gets a new or updated user data (udta
) atom, with the tags as its children.
moov
is, what udta
is, and what their relationship is. And it's still only one sentence.
Because it's possible to help readers along even if they aren't familiar with your topic area, I frown somewhat on the "reader expectations" paragraph, the kind that goes something like:
The reader should be well-versed in Struts, Spring, Hibernate, WebWork, SiteMesh, JSP, and JSF ? preferably a committer on at least one of these ? and should be familiar with the changes checked into to the MongoWebApp project last week on the experimental
branch.
That, frankly, is a good way to narrow your target audience down to one reader: yourself. There are times when setting prerequisites is appropriate, but give your readers a little credit and don't send them away if you can help it.
Important update (Dec. 2005): We are no longer accepting series of more than two parts, and then only from established writers. We strongly encourage you to re-think your material so it fits into individual, independent 2,000-word articles. Analysis shows that readers do not stick with long series, and do not go back to earlier articles to read prerequisite material.
If you're writing a two-part article, you need to make sure that each part "stands alone", and is an interesting article in its own right. It's not very interesting for the reader to read a "part 1" that's just set up for a second part that hasn't been published yet. In a case like this, try to see what value part 1 has, and try to develop that. For example, if you are developing a complex GUI component in your article, with part 1 about the model and part 2 about the visual representation, you could close part 1 with some unit tests to show that the model behaves correctly.
Writing to be read means, obviously, following the rules of English. The more clearly you express yourself, the better received your article will be.
Probably the best advice I can give in this area is to read (or re-read, if it's buried in your school books) The Elements of Style by William Strunk, Jr. and E.B. White. The 1918 first edition is available online, and a more modern fourth edition is worth the purchase price several times over.
Some of the most important grammar principles to remember include:
One or moretoComponent
s may be contained by aContainer
AThe second version is more direct, and keeps theContainer
can contain one or moreComponent
s.
Container
as the subject of the sentence. By the way, this is Strunk & White's 11th principle.
in mid-paragraph when you have a sentence that you're not sure deserves a new paragraph. Make a choice one way or the other.Java has three major varieties: J2ME, J2SE, and J2EE.
Java applets do what DHTML cannot: bring a full suite of client-side functionality to the browser.
With your JAR built, you can send it to all your friends: "Write once, run anywhere."
The key to deploying a WAR file ? assuming you're using one of the various application servers that supports them ? is to let an automated tool like ant build and deploy the file for you.We used to write the em-dash should be written with the HTML escape
?
, but we're now using the the plain-text --
because it's simpler. Also note that the regular hyphen, not the em-dash, is used in hyphenated words like cross-platformIf you are unsure of your writing, particularly if English is not your native language, the best thing you can do is have someone else read it first and give you feedback.
We prefer to let a writer maintain his or her natural style as much as possible. I mention the following points only because they come up frequently.
toString
and toString()
are both acceptable ? but pick one style and stick with it.paint()
method for this component. That's OK. An alternative is second-person: you can implement a custom paint()
method for this component. It's a little less formal and a little more direct. Use whatever suits you, but choose one and be consistent.There are three concurrency-related methods inDid you realize that was two sentences, or did you read it as "Object
.wait()
is the most important one.
Object.wait()
"? Avoid this problem by rephrasing one or both of the sentences, moving the class and method names away from each other.A few basic rules suffice for special content like code and images. These are described in an Authors' Guidelines document that is common to all O'Reilly Network sites. Among the most important considerations:
...
block, like this:
public String toString() {
return "This is my toString() implementation";
}
Important: These blocks must be 50 characters wide or less ? break lines and indent as necessary. Also, do not number lines, as this impedes copying and pasting the code. ...
for class and member names inside of paragraphs - as in "HttpServlet
subclasses GenericServlet
."
<
and >
characters with <
and >
- browsers will tend to interpret a less-than character as the start of a tag, making the text after it disappear when rendered. This is a particularly big deal when you're showing XML code or Generics, but can still be a problem for Java listings that generate markup or use for
loops.A proper use of an image and accompanying caption is shown in Figure 1.Important: Images must be no more than 500 pixels wide. If absolutely necessary for clarity, we can link a smaller in-line thumbnail image to a larger version on its own page.
Figure 1. Example of an image
Your sample code file should be the first link in the resources section. It should contain only your source and not third-party libraries that your code would need in production (we don't want to be responsible for the license terms of n libraries times m articles published on the site). Use the article to describe any dependencies your code has, link to those sites, and trust the readers to get and install the code themselves if they really want to try it out -- typically, they're just interested in your source.
Ask us for help. That's what we're here for: making your article as good as it can be.