Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.lang.java.programmer > #5406

Re: The greeting code in Java

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From Joshua Cranmer <Pidgeot18@verizon.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: The greeting code in Java
Date Sun, 19 Jun 2011 16:25:54 -0400
Organization A noiseless patient Spider
Lines 42
Message-ID <itlm0i$5o5$1@dont-email.me> (permalink)
References <3d6aab49-9a4a-4614-af12-bb1c95bebbe7@w4g2000yqm.googlegroups.com> <4dfdf77e$0$4132$426a74cc@news.free.fr> <06cf6f85-5473-47da-b599-de2e7f81976d@d1g2000yqm.googlegroups.com> <itkvtd$ebt$1@dont-email.me> <125bbd94-dca2-4692-8c18-3c80d8717048@c41g2000yqm.googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Sun, 19 Jun 2011 20:25:55 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="bAymlyY9SkaJNa8Tz2rerw"; logging-data="5893"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+hbh1EO/AEJvghOH82Iw0NdgxGgcn4KKQ="
User-Agent Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.16pre) Gecko/20110305 Lightning/1.0b3pre Thunderbird/3.1.10pre
In-Reply-To <125bbd94-dca2-4692-8c18-3c80d8717048@c41g2000yqm.googlegroups.com>
Cancel-Lock sha1:WC5qcme/SRwYJd+CJncN177JDoM=
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:5406

Show key headers only | View raw


On 06/19/2011 10:17 AM, Saeed Amrollahi wrote:
> Well, in the case of C++ code, I have to
> explain cin, cout, string and two overloaded operators:>>  and<<
> in the case of java one: I have to
> explain, the stream class hierarchy, InputStreamReader,
> BufferedReader,
> in, string, new operator, final, the meaning of buffered,
> readLine, ...

If that is what you're explaining in Java, you also need to explain for 
C++ stack constructed-objects, references, #include (trust me, beginners 
can get very confused about #include, as simple as it looks), and 
probably the entire iostream interfaces if you're talking about Java's 
stream class hierarchy.

> I believe the C++ code is simpler for a beginner.

If it's simpler, it's only superficially so. C++'s interfaces heavily 
optimize for the most common case and render the development of the more 
critical components inordinately more difficult. For example, a fair 
amount of my work has to worry about the use of international characters 
and multiple charsets (it's not unimaginable that I have to use one 
stream to write in two simultaneous charsets (i.e., the control protocol 
is in UTF-8 but I send 8-bit MIME payloads of ISO 8859-1)). In Java, I 
can keep both the raw Stream and a controlling Reader/Writer around and 
use the character-based one for control information and the octet-based 
one for data payloads.

And, naturally, any talk of C++ being simpler becomes hard to stomach 
once you introduce templates, i.e., any use of the STL. std::string 
isn't actually a class, it's actually std::basic_string<char, 
std::char_traits<char>, std::allocator<char> >, as every error message 
involving std::set<std::string> will helpfully inform you. I mean 
std::set<std::basic_string<char, std::char_traits<char>, 
std::allocator<char> >, std::less<std::basic_string<char, 
std::char_traits<char>, std::allocator<char> > >, 
std::allocator<std::basic_string<char, std::char_traits<char>, 
std::allocator<char> > > >. Have fun debugging your template errors!

-- 
Beware of bugs in the above code; I have only proved it correct, not 
tried it. -- Donald E. Knuth

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

The greeting code in Java Saeed Amrollahi <amrollahi.saeed@gmail.com> - 2011-06-19 06:06 -0700
  Re: The greeting code in Java Aéris <aeris@imirhil.fr> - 2011-06-19 15:19 +0200
    Re: The greeting code in Java Saeed Amrollahi <amrollahi.saeed@gmail.com> - 2011-06-19 06:44 -0700
      Re: The greeting code in Java Jeff Higgins <jeff@invalid.invalid> - 2011-06-19 10:13 -0400
        Re: The greeting code in Java Saeed Amrollahi <amrollahi.saeed@gmail.com> - 2011-06-19 07:17 -0700
          Re: The greeting code in Java Jeff Higgins <jeff@invalid.invalid> - 2011-06-19 11:01 -0400
            Re: The greeting code in Java Saeed Amrollahi <amrollahi.saeed@gmail.com> - 2011-06-19 12:06 -0700
              Re: The greeting code in Java Aéris <aeris@imirhil.fr> - 2011-06-19 22:06 +0200
                Re: The greeting code in Java Saeed Amrollahi <amrollahi.saeed@gmail.com> - 2011-06-19 22:33 -0700
              Re: The greeting code in Java RedGrittyBrick <RedGrittyBrick@spamweary.invalid> - 2011-06-20 16:36 +0100
              Re: The greeting code in Java Jeff Higgins <jeff@invalid.invalid> - 2011-06-20 12:25 -0400
                Re: The greeting code in Java Jeff Higgins <jeff@invalid.invalid> - 2011-06-20 13:00 -0400
                Re: The greeting code in Java Jeff Higgins <jeff@invalid.invalid> - 2011-06-20 15:24 -0400
              Re: The greeting code in Java blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-06-20 19:23 +0000
          Re: The greeting code in Java Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-06-19 16:25 -0400
            Re: The greeting code in Java Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-06-19 17:22 -0400
        Re: The greeting code in Java Jeff Higgins <jeff@invalid.invalid> - 2011-06-19 12:08 -0400
        Re: The greeting code in Java "Nasser M. Abbasi" <nma@12000.org> - 2011-06-19 19:35 -0700
          Re: The greeting code in Java "Nasser M. Abbasi" <nma@12000.org> - 2011-06-19 21:41 -0700
        Re: The greeting code in Java Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-06-20 01:02 -0400
      Re: The greeting code in Java Aéris <aeris@imirhil.fr> - 2011-06-19 16:51 +0200
        Re: The greeting code in Java Stanimir Stamenkov <s7an10@netscape.net> - 2011-06-19 18:06 +0300
          Re: The greeting code in Java Aéris <aeris@imirhil.fr> - 2011-06-19 17:24 +0200
            Re: The greeting code in Java Jeff Higgins <jeff@invalid.invalid> - 2011-06-19 11:37 -0400
            Re: The greeting code in Java Jeff Higgins <jeff@invalid.invalid> - 2011-06-19 11:40 -0400
        Re: The greeting code in Java Saeed Amrollahi <amrollahi.saeed@gmail.com> - 2011-06-19 12:05 -0700
        Re: The greeting code in Java blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-06-20 19:21 +0000
  Re: The greeting code in Java Jeff Higgins <jeff@invalid.invalid> - 2011-06-19 10:31 -0400
    Re: The greeting code in Java Saeed Amrollahi <amrollahi.saeed@gmail.com> - 2011-06-19 11:36 -0700
      Re: The greeting code in Java Jeff Higgins <jeff@invalid.invalid> - 2011-06-19 15:03 -0400
        Re: The greeting code in Java blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-06-20 19:22 +0000
          Re: The greeting code in Java Tobias Blass <tobiasblass@gmx.net> - 2011-06-21 07:44 +0000
            Re: The greeting code in Java Tobias Blass <tobiasblass@gmx.net> - 2011-06-21 09:34 +0000
              Re: The greeting code in Java Gene Wirchenko <genew@ocis.net> - 2011-06-21 07:47 -0700
            Re: The greeting code in Java blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-06-21 20:43 +0000
              Re: The greeting code in Java Tobias Blass <tobiasblass@gmx.net> - 2011-06-22 08:35 +0000
                Re: The greeting code in Java blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-06-22 20:04 +0000
  Re: The greeting code in Java Stanimir Stamenkov <s7an10@netscape.net> - 2011-06-19 19:07 +0300
    Re: The greeting code in Java Saeed Amrollahi <amrollahi.saeed@gmail.com> - 2011-06-19 12:08 -0700
  Re: The greeting code in Java Jeff Higgins <jeff@invalid.invalid> - 2011-06-19 13:07 -0400
    Re: The greeting code in Java Jeff Higgins <jeff@invalid.invalid> - 2011-06-19 13:11 -0400
      Re: The greeting code in Java Jeff Higgins <jeff@invalid.invalid> - 2011-06-19 14:19 -0400

csiph-web