task

Text-only Preview

Computer Programming 2
Essay
Essay: C++ or Java?
Task
Consider the task of designing a library of reusable components -- such as the Java Collection
Framework or the C++ Standard Template Library (STL) -- that are intended for use by programs that
represent and manipulate complex data.
Although (obviously!) you could use either Java or C++ to build such components, aspects of the
language design would influence many detailed decisions that you would need to make in the design of
the components, which in turn would affect users of the components. Often-cited differences between
Java and C++ relate to memory management, run-time checking, and language complexity, although there
are many more.
* Memory management: Java has a built-in memory manager; programmers need never worry
about when to free objects that are no longer needed, which means that memory leaks and illegal
pointers don't occur. On the other hand, C++ provides the programmer with fine-grained control
over memory allocation and de-allocation, which means that memory can be used more efficiently
and that performance of programs can be optimised.
* Run-time checking: Java provides run-time checking for common errors such as out-of-bounds
array indexes and null pointers, which means it can report information that helps programmers
locate and fix problems. However, equivalent C++ code will run faster because the Java run-time
checks slow execution.
* Complexity: C++ provides full support for both object-oriented and procedural programming
paradigms, including multiple inheritance and operator overloading, which means that it can be
used to build components that are fully compliant with built-in types. On the other hand, these
features can be approximated using Java's simpler object model; often, the simpler approach is
more than sufficient and results in code that is easier to write and debug.
Which language do you think is more appropriate for building a reusable component library? If you were
charged with making a recommendation, which way would you lean? Write an essay presenting your
opinion and arguing the case.
Your essay should clearly present and defend your position; the reader should be in no doubt what you
believe and why you believe it. To be convincing, you'll need to back up your opinions with examples
and citations. Of course, you must make sure that you acknowledge any material that you use or
reference in your report. Use an established convention, such as the Author-Date ("Harvard") system, for
citations and bibliography. General advice on academic writing and on correct use of sources and
referencing is available from the Student Learning Centre web page:
http://www.flinders.edu.au/SLC
Assessment
This essay must be done individually.
Your essay should be submitted in the form of a typed document of around 1500 words (3 or 4 typed
pages) that conforms to accepted norms for style and presentation of academic writing. You will be
assessed on the clarity of your discussion, the degree to which you have demonstrated your understanding
of the issues, and the strength of your argument.
Submit your work as a PDF document to the appropriate handin on FLO.
Flinders University / School of Computer Science, Engineering, and Mathematics
1