Sponsored Link •
The main point of advice given in this article is:
If you need an object, make an object. Restrict your use of class variables and methods to defining utility methods and implementing special kinds of access policies for objects and primitive types stored in class variables. Although not a pure object-oriented language, Java is nevertheless object-oriented to a great extent, and your designs should reflect that. Think objects.
Next month's Design Techniques will be the last. I'll soon begin writing a book based on the Design Techniques material, Flexible Java, and will place that material on my Web site as I go. So please follow that project along and send me feedback. After a break of a month or two, I'll be back at JavaWorld with a new column focused on Jini.
A request for reader participation
I encourage your comments, criticisms, suggestions, flames -- all kinds of feedback -- about the material presented in this column. If you disagree with something, or have something to add, please let me know.
About the author
Bill Venners has been writing software professionally for 12 years. Based in Silicon Valley, he provides software consulting and training services under the name Artima Software Company. Over the years he has developed software for the consumer electronics, education, semiconductor, and life insurance industries. He has programmed in many languages on many platforms: assembly language on various microprocessors, C on Unix, C++ on Windows, Java on the Web. He is author of the book: Inside the Java Virtual Machine, published by McGraw-Hill. Reach Bill at firstname.lastname@example.org.
This article was first published under the name Design with Static Members in JavaWorld, a division of Web Publishing, Inc., February 1999.