Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #30714
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: "How do you arrive at classes?" |
| Date | 2015-01-15 08:43 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <m98g61$c3o$1@dont-email.me> (permalink) |
| References | <classes-20150114054030@ram.dialup.fu-berlin.de> <classes-20150115032323@ram.dialup.fu-berlin.de> |
On 1/14/2015 9:36 PM, Stefan Ram wrote:
> ram@zedat.fu-berlin.de (Stefan Ram) writes:
>> Now, a student asked me: »How do you arrive at classes?«,
>
> Thank you all for your answers!
>
> I have written a German-language web page to answer
> the question. Here are some parts of it in English:
> [...]
> 3. hints
> [...]
> - find fields (variables) that belong together and
> group them into one class, than add methods for them
Sometimes it's the other way around: You start from the
behaviors you want to model, and from those you discover what
fields the class will need to support those behaviors. That
is, you sometimes begin with the methods and derive the fields.
Perhaps the clearest example of behaviors-then-data as
opposed to data-then-behaviors is in implementing an interface:
The interface says nothing about the data and everything (well,
everything it can) about the methods. If you are implementing
the Iterator interface you must write hasNext() and next(), and
although it's clear that you must keep track of the iteration's
progress there's no specification of what sort of data you must
maintain to do so.
From the perspective of the Java language (not necessarily
that of all O.O.P. frameworks), methods and fields are simply
"members" of their classes; they are peers, without primacy.
--
esosman@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM
Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread
Re: "How do you arrive at classes?" Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-01-15 08:43 -0500 Re: "How do you arrive at classes?" Martin Gregorie <martin@address-in-sig.invalid> - 2015-01-15 14:28 +0000
csiph-web