Functionality or interaction?

A

Aned

Is there any way to distinguish between methods that are responsible
for the communication between components(i.e. classes) and methods
that are responsible for providing the real computation?
 
M

Matt Humphrey

Aned said:
Is there any way to distinguish between methods that are responsible
for the communication between components(i.e. classes) and methods
that are responsible for providing the real computation?

At the finest level, everything the computer does is computation. You could
say that a method that does not invoke methods on other objects has no
communication, but it's virtually impossible to do anything interesting (at
a high enough level of abstraction) using only primitives and assignment.

Matt Humphrey (e-mail address removed) http://www.iviz.com/
 
P

Patricia Shanahan

Aned said:
Is there any way to distinguish between methods that are responsible
for the communication between components(i.e. classes) and methods
that are responsible for providing the real computation?

Difficult in most cases, except through identifier and comments. Also,
it is a somewhat fuzzy concept.

In floating point programs, such as many scientific and engineering
programs, the methods that do the real computation are those that do
lots of floating point arithmetic.

Similarly, in an editor it may be possible to identify methods that
directly access or modify the data structure representing the material
being edited.

Patricia
 
S

Simon Brooke

Aned said:
Is there any way to distinguish between methods that are responsible
for the communication between components(i.e. classes) and methods
that are responsible for providing the real computation?

A method exposed as an API (thus responsible for communication) should be
both public and usually not final. A method which is intended for internal
computation will be protected or private, and, if protected, may be final.

But note that a lot of people are less rigorous about this sort of thing
than perhaps they ought to be.

--
(e-mail address removed) (Simon Brooke) http://www.jasmine.org.uk/~simon/
Das Internet is nicht fuer gefingerclicken und giffengrabben... Ist
nicht fuer gewerken bei das dumpkopfen. Das mausklicken sichtseeren
keepen das bandwit-spewin hans in das pockets muss; relaxen und
watchen das cursorblinken. -- quoted from the jargon file
 
L

Lew

Simon said:
A method exposed as an API (thus responsible for communication) should be
both public and usually not final.

Why should a public method usually not be final?

- Lew
 
C

Chris Uppal

Lew said:
Why should a public method usually not be final?

Depends on whether you subscribe to the thesis that all methods should be final
unless they have been specifically designed to be overridden. I don't myself,
but I do think there's a lot to be said for the idea.

If you don't, then the reason is simply that methods should usually not be
final unless there is a specific reason to make them so.

BTW, there is another thesis to the effect that an object should not invoke its
own public methods unless they are intended specifically to be overridden. If
you do follow that pattern (which I admit I don't, though I probably should
make more effort to do so), then overriding public methods is always safe, so
there is no reason to make them final.

-- chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,282
Latest member
RoseannaBa

Latest Threads

Top