Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Robert Klemme Newsgroups: comp.lang.java.programmer Subject: Re: "How do you arrive at classes?" Date: Wed, 14 Jan 2015 08:03:31 +0100 Lines: 28 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 e1fSBnLF9J5YuhvXXiyMlA0i+ybOr4e/zYYHPFHowuheUQndI= Cancel-Lock: sha1:CImvHmeM4wDz++61mojngOpqBpA= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 In-Reply-To: Xref: csiph.com comp.lang.java.programmer:30702 On 14.01.2015 05:57, Stefan Ram wrote: > I tried to answer the question =C2=BBHow do you arrive at > classes?=C2=AB in the classroom, kind-a stuttering, because > I was not prepared for this question. Now, I am curious: > How would /you/ answer this question? One of the simplest approaches I am aware of is to write down a=20 description of the problem in prose and identify nouns. These are then=20 candidate classes. "The buyer enters the shop and places his order. Each order contains=20 one or more items. Items can be books, DVDs and concert tickets." OK,=20 that is just a simplistic example, but I guess you get the drift. Additionally there are also classes which have more technical reasons.=20 For example to implement the order from above you likely need a list or=20 some similar collection. These are usually harder to "find" I'd say.=20 Luckily a lot of these are part of the standard library. Kind regards robert --=20 remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/