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: Tobias Blass Newsgroups: comp.lang.java.programmer Subject: Re: The greeting code in Java Date: Tue, 21 Jun 2011 09:34:34 +0000 (UTC) Organization: A noiseless patient Spider Lines: 24 Message-ID: References: <3d6aab49-9a4a-4614-af12-bb1c95bebbe7@w4g2000yqm.googlegroups.com> <969l09FjduU8@mid.individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Tue, 21 Jun 2011 09:34:34 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="17WgcLqQtdfvz0nzLAsj7w"; logging-data="15434"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/x5itT2ofk5LXf1oEn2r/YOm1Q51E9uss=" User-Agent: slrn/0.9.9p1 (Linux) Cancel-Lock: sha1:WoKaWsigf1gBTpIpGp0mtD2J0zM= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:5465 On 2011-06-21, Stefan Ram wrote: > Tobias Blass writes: >>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) > > Usually, »getchar« already is buffered internally. > > (Also, thinking about optimising even before any > requirement specification is given really seems > to be premature.) > > [snip some quotes] > > M. A. Jackson > I know these quotes (every programmer should). I didn't want to warn of using getchar. I must admit the performance thing was a guess (and I think I read it somewhere), but even if it is the second part of the sentence applies. Premature Optimization is mainly evil _because_ you sacrifice simplicity (there are other reasons but this is the most important one).