The Artima Developer Community
Sponsored Link

Designing Object Initialization
Ensure Proper Initialization of Your Objects at All Times
by Bill Venners
First Published in JavaWorld, February 1998

<<  Page 4 of 7  >>


Some definitions
Before getting started with a discussion of design guidelines for object initialization, I'd like to clarify a few terms.

Designer vs. client programmers
If you're like most Java programmers, you alternate between two hats, which you wear at different times. Sometimes you wear your "designer" hat and build libraries of classes for others to use; other times you wear your "client" hat and make use of a library of classes created by someone else. Some Java programmers -- completely oblivious to the rules of fashion -- are known to wear both hats at the same time.

One aspect of the flexibility of a body of code is the ease with which a client programmer can understand the code. Whether a client programmer is planning to change code or just use it as is, that programmer often has to figure out how to change or use the code by reading it.

The guidelines discussed in the remainder of this article, and in subsequent articles of this column, will talk about flexibility in terms of client programmers. Designs and implementations that are flexible are those that are easy for client programmers to understand, use, and change.

Java jargon related to initialization
This article uses several terms related to initialization that are defined in precise ways by the Java Language Specification (JLS).

For more information on these terms, see the companion article to this month's column, "Object initialization in Java."

<<  Page 4 of 7  >>

Sponsored Links

Copyright © 1996-2018 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use