Taligent Logo
Porting Paper
dot_clear
dot_clear

Java Cookbook: Porting C++ to Java

Background Information

Introduction, Basics, Next Steps, Well-Mannered Objects, Esoterica, Background, Index


The following sections provide background information, plus an index to topics.


References

I only mention a few books that I think particularly useful. There is already a huge, and growing, list of introductory Java programming books. If you are interested, there are some pretty good book reviews on the net, such as:


Introductions to Java

David Flanagan Java in a Nutshell: A Desktop Quick Reference for Java Programmers (Nutshell Handbook)
O'Reilly & Assoc, 1996
ISBN: 1565921836
Ken Arnold, James Gosling The Java Programming Language (Java Series)
Addison-Wesley, 1996
ISBN: 0201634554
James Gosling, Bill Joy, Guy Steele The Java Language Specification (Java Series)
Addison-Wesley, 1996
ISBN: 0201634511


Java and C++

Barry Boone Java Essentials for C and C++ Programers
Addison-Wesley Developers Press, 1996
ISBN: 020147946X
Michael C. Daconta Java for C/C++ Programmers
Wiley Computer Publishing, 1996
ISBN: 0471153249
Prashant Jain, Doug Schmidt "Experiences Converting a C++ Communication Software Framework to Java", C++ Report, SIGS Publications Inc., January 97


Object-oriented programming

Taligent
(David Goldsmith)
Taligent's Guide to Designing Programs: Well-Mannered Object-Oriented Design in C++
Addison-Wesley, 1994
ISBN: 0201408880
Erich Gamma, Richard Helm, Ralph Johnson, John Ulissides Design Patterns: Elements of Reusable Object-Oriented Software
Addison-Wesley, 1994
ISBN: 0201633612
Scott Meyers Effective C++: 50 Specific Ways to Improve Your Programs and Designs
Addison-Wesley, 1992
ISBN: 0201563649


About the author

Dr. Mark Davis is the director of the Core Technologies department at Taligent, Inc, a wholly owned subsidiary of IBM. Mark co-founded the Unicode effort, and is the president of the Unicode Consortium. He is a principal co-author and editor of the Unicode Standard, Version 1.0 and the new Version 2.0.

Mark has considerable expertise in both management and software development. His department encompasses Operating System Services, Text, International, Web Server Components, and Technical Communications. Technically, he specializes in object-oriented programming and in the architecture and implementation of international and text software: ranging from the years he spent programming in Switzerland, to co-authoring the Macintosh KanjiTalk and the Macintosh Script Manager (which later became WorldScript), to authoring the Arabic and Hebrew Macintosh systems, and most recently to architecting the CommonPoint international frameworks and the bulk of the Java 1.1 international libraries.

Mark has a doctorate from Stanford University, and is an avid reader of Jane Austin and follower of NPR's "Car Talk." This may help to explain the section titles.


Acknowledgments

The material in this article is based on collective years of experience at Taligent with the development of large object-oriented projects, plus more recent experience in porting from C++ to Java--and back again. The article itself was written within a very short time frame; my special thanks to the following individuals (in chronological order) whose efforts made this possible:

  • Doug Felt, for his careful reading of the first and second drafts, suggestions of topics to cover, and identification of early errors.
  • John Fitzpatrick, for his technique of read-only interfaces to replace const.
  • M. Srinivasan, Anson Mah, Tony Tseung, and Jay Tobias for catching various errors in the second draft.
  • Andy Heninger, for his detailed feedback on thread-safety in On pins and needles and for catching many typos.
  • Mike Potel, for his many clarifications of wording.
  • Bill Gibbons, for his detailed review of the C++ side, and improvements to the Shave and a haircut examples.
  • Guy Steele, for correcting a number of fine points in Java, and especially for improvements to the Allegro ma non troppo section.
  • Denise Costello, for her tireless work in managing media and artwork.
  • Brian Beck, for some good last-minute catches.
  • Odile Tarazi, for her final editing on short notice.

I hasten to add that these contributors have all reviewed different drafts of the document, and that they bear no responsibility for errors in the final version!

We envision continuing to develop articles of this flavor. If you have any criticisms, suggestions, or encouragement, please email cookbook@taligent.com.


Topic index

The following is an alphabetical list of the topics covered in this paper. Although most of the topics are relatively independent, the ones in Basics and Well-Mannered Objects may need to be read the first time in sequence.


Footnotes

[1]

Unfortunately, Object defines equals and hashCode to be public. A better solution would have been to have followed the pattern of Cloneable by defining:

  • A Comparable interface that contains equals and hashCode
  • A MethodNotSupportedException for classes that don't want to implement them

Well, that's water under the bridge at this point. The only improvement to Java that would not break backward compatibility would be to at least allow equals and hashCode to throw a MethodNotSupportedException.

[2] By the way, I'm not one of them. For us, large-scale introduction of C++ templates were an absolute, unmitigated disaster, costing our project hundreds of person-months to manage the code size and interface problems they introduced. If JavaSoft introduces templates (a.k.a. generics), I sincerely hope they don't repeat history!
[3] Brackets are used, since superscripts may not show up on some browsers.
[4]

If you do print, be forewarned that certain unnamed version 3.0 browsers often:

  • Clip lines at the top and bottom of pages.
  • Separate headings from their first paragraphs, captions from their tables, and terms from their definitions.
  • Position italics incorrectly next to roman text, as in [this].
[5] Some classes do not need to be in their own files. Also, it is better form to import by class name rather than importing a whole package; see JLS for more information on both of these topics.


Updates

 Jan 3, 1997
  • Updates to equals, clone.
  • Fixed two typos; my thanks to Richard Emberson.
 Jan 23, 1997

 Mar 25, 1997

  • Fixed serious typo in equals, plus other typos; my thanks to Jay Burgess and Marc Lavine.


Introduction, Basics, Next Steps, Well-Mannered Objects, Esoterica, Background, Index

 

dot_clear dot_clear dot_clear dot_clear dot_clear
navbar
Products Object Resources In the News Company Info Search
 
If you encounter problems with this service please contact webmaster@taligent.com.

© Copyright. All rights reserved. Taligent, Inc., IBM Corp.