Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Robert Klemme Newsgroups: comp.lang.java.programmer Subject: Re: enum, what is it good for? Date: Fri, 24 Apr 2015 20:28:59 +0200 Lines: 20 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: individual.net FAwKDNBlGjjMKAZlelp3OAd7J5jGmU60c5G5rPU+BgXIt9Mp4= Cancel-Lock: sha1:FHIJsa81LY10qR3ufUNXRADZ2DY= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 In-Reply-To: Xref: csiph.com comp.lang.java.programmer:31612 On 21.04.2015 04:30, Stefan Ram wrote: > So, is there any reason to prefer =C2=BBenum=C2=AB to =C2=BBclass=C2= =AB? Additionally to what others have said in favor of enums already, you can = *very* concisely override methods in enum instances which is helpful for = implementing state, strategy and similar patterns. With classes that=20 will look a lot more bulky. Kind regards robert --=20 remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/