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


Groups > comp.lang.java.programmer > #30702 > unrolled thread

Re: "How do you arrive at classes?"

Started byRobert Klemme <shortcutter@googlemail.com>
First post2015-01-14 08:03 +0100
Last post2015-01-14 14:00 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.lang.java.programmer

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: "How do you arrive at classes?" Robert Klemme <shortcutter@googlemail.com> - 2015-01-14 08:03 +0100
    Re: "How do you arrive at classes?" Martin Gregorie <martin@address-in-sig.invalid> - 2015-01-14 14:00 +0000

#30702 — Re: "How do you arrive at classes?"

FromRobert Klemme <shortcutter@googlemail.com>
Date2015-01-14 08:03 +0100
SubjectRe: "How do you arrive at classes?"
Message-ID<chmim5F33onU1@mid.individual.net>
On 14.01.2015 05:57, Stefan Ram wrote:

>    I tried to answer the question »How do you arrive at
>    classes?« 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 
description of the problem in prose and identify nouns.  These are then 
candidate classes.

"The buyer enters the shop and places his order.  Each order contains 
one or more items.  Items can be books, DVDs and concert tickets." OK, 
that is just a simplistic example, but I guess you get the drift.

Additionally there are also classes which have more technical reasons. 
For example to implement the order from above you likely need a list or 
some similar collection.  These are usually harder to "find" I'd say. 
Luckily a lot of these are part of the standard library.

Kind regards

	robert

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

[toc] | [next] | [standalone]


#30708

FromMartin Gregorie <martin@address-in-sig.invalid>
Date2015-01-14 14:00 +0000
Message-ID<m95sqe$45o$1@dont-email.me>
In reply to#30702
On Wed, 14 Jan 2015 08:03:31 +0100, Robert Klemme wrote:

> One of the simplest approaches I am aware of is to write down a
> description of the problem in prose and identify nouns.  These are then
> candidate classes.
>
I do something similar but with a fairly long exposure to database design 
as well as programming, I tend to start by drawing an Entity Relationship 
Diagram that describes the data structure needed to underpin the problem. 
Then the entities become the main data-related classes with closely 
related operations as their methods. The various relationships become 
Collections (TreeMaps of key sequence is important, HashMap where it 
isn't and Lists to support other types of ordering such as arrival 
sequence.


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web