From: Daniele Futtorovic Newsgroups: comp.lang.java.programmer Subject: Re: Enums: Properties vs. Methods Date: Tue, 29 Mar 2011 22:45:21 +0200 Organization: A noiseless patient Spider Lines: 44 Message-ID: References: <2f38bb8e-9a8d-4464-ad3d-b9ce0b557219@e21g2000yqe.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 29 Mar 2011 20:45:18 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="x1ayPUl1Dd83Eixaqp6srw"; logging-data="30736"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+UC4qHI/MfedCnCCiVVb+e" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 In-Reply-To: Cancel-Lock: sha1:ix44mWeYSYqIEini3Ytz3RLfBqc= Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.stben.net!gegeweb.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:2561 On 29/03/2011 21:52, Roedy Green allegedly wrote: > On Tue, 29 Mar 2011 08:18:28 -0700 (PDT), Robert Klemme > wrote, quoted or indirectly quoted > someone who said : > >> Prop(boolean a, boolean b) { >> this.a = a; >> this.b = b; >> } >> >> public boolean isA() { >> return a; >> } > > I see what you mean. Do you. > You would never use custom methods when you > could use getters and setters. Wat? Getters and setters are methods, "custom" methods. How can a method not be custom anyway? This is Java. > It is a general principle you use the > smallest hammer that gets the job done. Wat? Which job? Which hammer? There's no difference between the alternatives with respects to what their methods are like. Leaving convenience and maintenance aside, the only difference between both is that in the first one (without fields), the instructions are probably easier to inline. > Using custom methods just > invites unintended divergence. "Custom methods" ... "customs methods" ... "divergence" ... AHA! Contraband! -- DF. An escaped convict once said to me: "Alcatraz is the place to be"