Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #5546
| From | blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: The greeting code in Java |
| Date | 2011-06-22 20:04 +0000 |
| Organization | None |
| Message-ID | <96f064F46aU6@mid.individual.net> (permalink) |
| References | <3d6aab49-9a4a-4614-af12-bb1c95bebbe7@w4g2000yqm.googlegroups.com> <itpi56$9du$1@dont-email.me> <96ce30Fc6lU4@mid.individual.net> <its9fk$5jt$1@dont-email.me> |
In article <its9fk$5jt$1@dont-email.me>, Tobias Blass <tobiasblass@gmx.net> wrote: > On 2011-06-21, blmblm myrealbox.com <blmblm.myrealbox@gmail.com> wrote: > > In article <itpi56$9du$1@dont-email.me>, > > Tobias Blass <tobiasblass@gmx.net> wrote: > >> On 2011-06-20, blmblm myrealbox.com <blmblm.myrealbox@gmail.com> wrote: > >> > In article <itlgsn$vr8$1@dont-email.me>, > >> > Jeff Higgins <jeff@invalid.invalid> wrote: > >> >> > >> >> On 06/19/2011 02:36 PM, Saeed Amrollahi wrote: > >> >> > On Jun 19, 6:31 pm, Jeff Higgins<j...@invalid.invalid> wrote: > >> >> >> On 06/19/2011 09:06 AM, Saeed Amrollahi wrote: > >> >> >> > >> >> >>> What are the problems of my code and how can I write > >> >> >>> a better one. Please throw some light. > >> >> >> > >> >> >> What means better? > >> >> > > >> >> > For example using less abstractions and less involve with Java > >> >> > stream class hierarchy. > >> >> > >> >> For a beginner, learning to write C in Java is unhelpful. > >> > > >> > Even in C one would not be likely to input a string by reading one > >> > charaacter at a time -- in a beginner program at least. [ snip ] > >> Hmm at least in K&R (the inofficial standard C learning book) you often find > >> while((c=getchar())!=EOF) > >> > >> It's less performant than reading whole blocks but in many cases much simpler > >> (And that's what matters in a learning book) > > > > Well, if you say so (my copy of K&R is not easily accessed right > > now). Certainly that style makes sense in examples in which > > the goal is to process a character at a time (to classify/count > > characters, for example, or to copy one file to another). > > > > But is this style used in examples in which the objective is to > > collect one whitespace-delimited "string" and print it? Huh. > > Maybe I need to reread K&R .... > > > > Obviously it is not the right choice for any problem you might encounter (the > K&R examples are copy input to output, count characters, count lines etc.) but > there are situations where getchar() is useful and one should be aware that > it exists. I don't want to say that one should use it everywhere. Well, we agree that there are situations in which reading input a character at a time makes perfect sense, and others in which it doesn't. I claim that the OP's greeting program is in the second category. You might disagree! -- B. L. Massingill ObDisclaimer: I don't speak for my employers; they return the favor.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
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