Homework 5: Java vs. C++


Contents: [Background and Motivation] [What to Read] [Directions] [The Problems]
Due: July 22, 1997.

Background and Motivation

C++ was once top of the heap: the most popular and the dominant object-oriented langauge. But Java has a great syntactic similarity with C++, and a similar semantics. Will Java take over from C++ as the top language for object-oriented computing? For education?

In this homework, you will prepare for a class discussion and debate on these questions.

This homework will also help you learn how to use research resources better. Especially on the internet, be sure to consider who is saying what, and what their qualifications are. For example, are authors associated with Sun Microsystems unbiased in their assessment of Java? Are authors from Bell Labs?

What to Read

This homework requires you to understand Java and C++ in programming languages in detail. You may want to refer to several of our books. For example, look at chapters 2-7, 10, and 13 of The Java Programming Language by Arnold and Gosling (Addison-Wesley, 1996).

Or read chapters 3 and 4 of Just Java by van der Linden (Prentice-Hall, 1997).

For a definitive reference, look at The Java Language Specification by Gosling, Joy, and Steele (Addison-Wesley, 1996).

You might want to compare to a C++ reference, such as The Annotated C++ Reference Manual by Margaret A. Ellis and Bjarne Stroustrup (Addison-Wesley,1990) or the reference manual section (R) in The C++ Programming Language (second edition) by Bjarne Stroustrup (Addison-Wesley,1991). The draft standard for C++ is available on the web at http://www.cygnus.com/misc/wp/index.html.

Directions

This homework, like the others in this seminar, will be open-ended and somewhat ill-defined. we'll try to give you some idea of the difficulty/effort involved in each part. Do what you feel you have time for, but please do something so that you can participate in the discussion.

The following problems are really questions to ponder while you read. You don't necessarily need to write anything down.


Problems

  1. (easy) As you find new resources or good things to read, post a URL or description of where to find them to our newsgroup: isu.coms.java.
  2. (moderate) What makes one computer langauge more popular than another? What technical factors affect the popularity of a language? Do you think that the technical matters make a difference, in the short or the long run?
  3. (easy) What syntactic differences are there between Java and C? Between Java and C++? What is the rationale behind these differences? Do you believe the rationale? Why?
  4. (moderate) Java doesn't use a preprocessor, it has no #include directives and no macros. Is this a serious problem or a serious benefit in Java? Why or why not?
  5. (moderate) What differences are there between the type systems of Java and C++? What is the rationale behind these differences? Do you believe the rationale? Why?
  6. (harder) What problems would the C++ type system cause for Java security? Why?
  7. (moderate) Java has garbage collection as a standard language feature. How does this affect your programming style? Does it make programs easier or harder to write? Do you think it will make people more productive? Will it make programs more wasteful? Will it make it harder to write some kinds of programs in Java? What kinds of programs?
  8. (moderate) Java goes to some lengths to define details of arithmetic and primitive types such as characters and integers. Why? What benefits are there to the programmer from such precision in a language definition? Is there any cost in terms of speed of code execution?
  9. (harder) How would you compare the support for exception handling in Java to that in C++? Does this affect your programming style? Does it have other benefits for programmers? Does it have a significant cost in execution speed?
  10. (harder) Compare the library support for C++ and Java. Which makes it easier to write standard character-based applications? Graphical user interface programs? Network programs? Graphics? Are there any barriers to writing libraries of classes in Java or C++? Are there any barriers to code reuse in either language?
  11. (harder) Which language is more complex, Java or C++? Which would be easier to learn by experienced programmers? By novices (students)? Which would you recommend that we teach to freshman at Iowa State? Why? Does the complexity of a language have other benefits or costs?
  12. (harder) Which language is more regular? That is, which language has a more consistent set of rules and design principles?
  13. (moderate) Which language helps one write portable code more easily? Why?
  14. (hard) What things could be improved about both Java and C++? That is, what are the common problems they have?

[Back to the Fun with Java Seminar homepage]
Last update: $Date: 1997/07/22 22:05:33 $
Gary T. Leavens