C++ programming

Kevin Cole kjcole at gri.gallaudet.edu
Mon Oct 21 12:08:38 PDT 2002


Without knowing either lanugage, I look at the C++ version and say
"Huh?" Whereas when looking at the Java version, I at least can make
some guess as to what it does.  The example provided is exactly what
keeps me away from C++ and the like: Instead of learning a few commands
and manipulating them, one memorizes the bible, the dictionary, and the
thesaurus (or searches through some tome -- electronic or hardcopy).  
IDE's or whatever may help search the tome, but still...

Granted, the wheels that people reinvent may not be the ideal wheel, and
there'll be a lot of variations in design.  I can see where that would
be a disadvantage if you do a lot of shipping your code around to the
four corners of the universe.

> "Consider the now-trite "word count" program that uses a map data structure
> to keep track of the number of instances of each word in a document.  In
> Java, a language not known for its economy of expression, you'll need code
> something like the following to process a word:
> 
> if ( !myMap.containsKey( key ) )
> 	myMap.put( key, new Integer( 1 ) );
> else {
> 	Integer count = (Integer) myMap.get( key );
> 	int icount = count.intValue( );
> 	myMap.put( key, new Integer( ++icount ) );
> }
> 
> whereas in C++ it is simply:
> 
> myMap[key]++;
> 
> More expressive power begets higher-level programming, which in turn leads
> to elegant, readable code."
> 
> I would love to see the FORTRAN version of this code....

	CALL something_I_write_and_understand (...)

;-)




More information about the Beowulf mailing list