A comparative evaluation of generic programming in Java and C++

  • Authors:
  • Hossein Saiedian;Steve Hill

  • Affiliations:
  • Department of Electrical Engineering and Computer Science, University of Kansas, Lawrence, KS;Department of Electrical Engineering and Computer Science, University of Kansas, Lawrence, KS

  • Venue:
  • Software—Practice & Experience
  • Year:
  • 2003

Quantified Score

Hi-index 0.00

Visualization

Abstract

Generic programming has been defined as 'programming with concepts' where a concept refers to a family of abstractions. The criteria for generic programming include independence of collections from data types, independence of algorithms that operate on the collection, and the adaptability of the collections. This paper examines and evaluates the support for generic programming in the Java Development Kit (JDK) in comparison to C++'s Standard Template Library (STL). The evaluation will consider both the 'qualitative' factors as well as certain 'quantitative' factors (i.e. factors that can be measured). The qualitative factors that are considered include: 1. a comparison of the structure and APIs; 2. homogeneity versus heterogeneity; and 3. ease of use (including ease of converting to collection classes, ease of changing collection type, and ease of error handling).The quantitative factors include: 1. compiled size; 2. runtime memory usage; and 3. performance. The results of our evaluative comparisons based on the above factors and certain other criteria are presented at the end. Based on the results, we conclude that the support provided for generic programming in C++'s STL is superior to that provided by JDK.