Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


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

Re: "Hello world!" without a public class?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Robert Klemme <shortcutter@googlemail.com>
Newsgroups comp.lang.java.programmer
Subject Re: "Hello world!" without a public class?
Date Sun, 06 Jan 2013 11:47:14 +0100
Lines 35
Message-ID <akt31nF36svU1@mid.individual.net> (permalink)
References <public-20130106091348@ram.dialup.fu-berlin.de> <40a19d18-6655-4256-85b9-6954e2f10b84@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net Q+vWir8Ezvb8qfIEkaqXjQAP7Tki0GaLDayAs1ROCr19og0ejvF56wPSylPqX7UD0=
Cancel-Lock sha1:deWDDYGnn44gntDMyaRbaaAf82M=
User-Agent Mozilla/5.0 (Windows NT 6.0; WOW64; rv:17.0) Gecko/17.0 Thunderbird/17.0
In-Reply-To <40a19d18-6655-4256-85b9-6954e2f10b84@googlegroups.com>
Xref csiph.com comp.lang.java.programmer:21019

Show key headers only | View raw


On 06.01.2013 09:44, Lew wrote:

> There's pedagogical merit in teaching the good habits first and the
> exceptional cases later. So you could begin with only 'public' classes
> overall, let alone for the main one, mentioning briefly at first that
> there is a way to drop the 'public' that you'll explain later.

+1

> As for 'final', that's harder. Hardly anyone in the field uses it,
> myself included, because most classes basically aren't inherited so it's
> not really risky to leave it out, and also there's a benefit to making
> classes heritable for test purposes.

I use it rather frequently on the basis of whether I intend a class for 
inheritance or not.  It's easier to loosen a restriction later than the 
other way round.  Plus, it /might/ help the JVM optimize.  But that's 
really the smallest benefit and the most unimportant reason.

> I think as a teacher I would use 'final' nearly always for classes, and
> explain to the class (of students) that I'm being picky, but for good
> reason. Also I'd mention that heritable classes support a certain style of
> test code, and teach it once inheritance had been covered.

That's a bit contradictory, isn't it?  I mean you say that almost nobody 
uses it (including you, and also for good reasons) yet you would 
recommend making it a habit to a beginner. :-)

Kind regards

	robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

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


Thread

Re: "Hello world!" without a public class? Lew <lewbloch@gmail.com> - 2013-01-06 00:44 -0800
  Re: "Hello world!" without a public class? Robert Klemme <shortcutter@googlemail.com> - 2013-01-06 11:47 +0100

csiph-web