AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Somewhat of a big lie about OO in java book?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help
View previous topic :: View next topic  
Author Message
Andrew Thompson
Guest





PostPosted: Thu May 13, 2004 7:05 am    Post subject: Re: Somewhat of a big lie about OO in java book? Reply with quote



On Wed, 12 May 2004 23:43:52 -0800, [email]RobertMaas (AT) YahooGroups (DOT) Com[/email] wrote:
....
Quote:
The textbook for my java class (sorry for pun) is:
Introduction to JAVA (tm) Programming

I thought you had made a typo with 'JAVA', but..

Quote:
by Y. Daniel Liang, Fourth Edition
ISBN 0-13-100225-2

<http://images.amazon.com/images/P/0131002252.01.LZZZZZZZ.jpg>
...certainly speaks a thousand 'JAVA's.

....
Quote:
I like some things about this book,

What does it get right?

Quote:
..but this is one thing I detest,
lies like this. Anyone agree with me?

I would toss it, except for the fact it
is your 'class' text. (no apologies for pun)

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology

Back to top
Roedy Green
Guest





PostPosted: Thu May 13, 2004 7:26 am    Post subject: Re: Somewhat of a big lie about OO in java book? Reply with quote



On Wed, 12 May 2004 23:43:52 -0800, [email]RobertMaas (AT) YahooGroups (DOT) Com[/email] wrote
or quoted :

Quote:
I like some things about this book, but this is one thing I detest,
lies like this. Anyone agree with me?

He is probably a professor. They learn to talk that way.

Try my explanation. See if it makes any more sense.

start at http://mindprod.com/jgloss/static.html and chase the links.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.

Back to top
RobertMaas@YahooGroups.Co
Guest





PostPosted: Thu May 13, 2004 7:43 am    Post subject: Somewhat of a big lie about OO in java book? Reply with quote



The textbook for my java class (sorry for pun) is:
Introduction to JAVA (tm) Programming
by Y. Daniel Liang, Fourth Edition
ISBN 0-13-100225-2
On page 206, at the start of the chaper on Object-Oriented Programming,
he says "Object-oriented programming places data and the operations
pertain to them within a single entity called an OBJECT;"
If you're talking only about static variables and static methods, and
we're talking about a Class object, that's correct, but in general we
deal with instances of a class which each contain their own set of
instance variables, but the instance methods relating to them do *not*
have a complete set within each object, rather there's a single set of
instance methods within the class, so the variables and methods are in
separate objects, each individual instance object vs. a single Class
object. The diagrams at the bottom of that page and top of next page
only emphasize the lie.
I like some things about this book, but this is one thing I detest,
lies like this. Anyone agree with me?
Back to top
VisionSet
Guest





PostPosted: Thu May 13, 2004 8:12 am    Post subject: Re: Somewhat of a big lie about OO in java book? Reply with quote


<RobertMaas (AT) YahooGroups (DOT) Com> wrote

Quote:
The textbook for my java class (sorry for pun) is:
Introduction to JAVA (tm) Programming
by Y. Daniel Liang, Fourth Edition
ISBN 0-13-100225-2
On page 206, at the start of the chaper on Object-Oriented Programming,
he says "Object-oriented programming places data and the operations
pertain to them within a single entity called an OBJECT;"
If you're talking only about static variables and static methods, and
we're talking about a Class object, that's correct, but in general we
deal with instances of a class which each contain their own set of
instance variables, but the instance methods relating to them do *not*
have a complete set within each object, rather there's a single set of
instance methods within the class, so the variables and methods are in
separate objects, each individual instance object vs. a single Class
object. The diagrams at the bottom of that page and top of next page
only emphasize the lie.
I like some things about this book, but this is one thing I detest,
lies like this. Anyone agree with me?

Personally I like to think of methods being per object rather than per
class.
The same method is executed in parallel for many objects. So there are as
many instances of the methods as there are objects.

--
Mike W



Back to top
Tom
Guest





PostPosted: Thu May 13, 2004 12:55 pm    Post subject: Re: Somewhat of a big lie about OO in java book? Reply with quote

[email]RobertMaas (AT) YahooGroups (DOT) Com[/email] wrote in message news:<REM-2004may12-008 (AT) Yahoo (DOT) Com>...
Quote:
The textbook for my java class (sorry for pun) is:
Introduction to JAVA (tm) Programming
by Y. Daniel Liang, Fourth Edition
ISBN 0-13-100225-2
On page 206, at the start of the chaper on Object-Oriented Programming,
he says "Object-oriented programming places data and the operations
pertain to them within a single entity called an OBJECT;"
If you're talking only about static variables and static methods, and
we're talking about a Class object, that's correct, but in general we
deal with instances of a class which each contain their own set of
instance variables, but the instance methods relating to them do *not*
have a complete set within each object, rather there's a single set of
instance methods within the class, so the variables and methods are in
separate objects, each individual instance object vs. a single Class
object. The diagrams at the bottom of that page and top of next page
only emphasize the lie.
I like some things about this book, but this is one thing I detest,
lies like this. Anyone agree with me?

I think you are making a mountain out of a molehill. Yes, there is
only one set of methods stored in memory. Big deal. That saves
memory, since the code for the methods is identical.

The point is that in OOP, an objects instance variables and instance
methods are joined-at-the-hip, unlike procedural languages where the
data and methods are separate.

I wouldn't waste too much time worrying about a minor inaccuracy.

Back to top
Chris Smith
Guest





PostPosted: Thu May 13, 2004 4:47 pm    Post subject: Re: Somewhat of a big lie about OO in java book? Reply with quote

VisionSet wrote:
Quote:
Personally I like to think of methods being per object rather than per
class.
The same method is executed in parallel for many objects. So there are as
many instances of the methods as there are objects.

I disagree with this interpretation. It's just as possible to have only
one object, but execute a method thousands of times concurrently on that
one object. (Providing the method is not explicitly coded to prevent
this, as with the 'synchronized' keyword.) Hence, I find that
explanation more likely to confuse than help.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation

Back to top
Chris Smith
Guest





PostPosted: Thu May 13, 2004 4:59 pm    Post subject: Re: Somewhat of a big lie about OO in java book? Reply with quote

[email]RobertMaas (AT) YahooGroups (DOT) Com[/email] wrote:
Quote:
On page 206, at the start of the chaper on Object-Oriented Programming,
he says "Object-oriented programming places data and the operations
pertain to them within a single entity called an OBJECT;"

Yes, that's true.

I believe you're confusing model with implementation. It's not
specified in the general OO model, nor in Java, whether there is only
one copy of a method's code held in memory, or one copy per object, or
anything else. The one-copy case is more likely than the per-object
case for performance reasons... but that's an implementation concern
about the existence of code; the ownership of a method is a different
matter.

You'll often hear OO people proclaim that an object owns its "state",
"behavior", and "identity". What we mean by an object owning its
behavior is that the behavior depends on which object you're working
with. Basically, that's polymorphism. You can interact with two
objects in exactly the same way, and they may act differently because
they are different objects. (Your author's use of the term
"operations" instead of "behavior" is somewhat ambiguous because the
former could be interpreted as the client interface, i.e. the set of
possible operations, which is not owned by the object at all.)

Note that this doesn't conflict with methods being defined in classes.
In Java, they definitely are (though there are other class-less or
prototype-model OO languages where this isn't necessarily the case
either). Another way of putting it is that the point really relates to
locating knowledge. When code A interacts with object B, is the
behavior determined by prior knowledge from A, or from B. In an OO
language (and using OO language features... hence, not with static
methods in Java, nor with non-virtual methods in C++), the answer is B.

I hope that clarifies things. In essence, I think your author is right.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation

Back to top
Roedy Green
Guest





PostPosted: Thu May 13, 2004 6:50 pm    Post subject: Re: Somewhat of a big lie about OO in java book? Reply with quote

On Thu, 13 May 2004 10:47:15 -0600, Chris Smith <cdsmith (AT) twu (DOT) net>
wrote or quoted :

Quote:
The same method is executed in parallel for many objects. So there are as
many instances of the methods as there are objects.

First there is only one copy of each method. Each object has a hidden
pointer to a hidden object with a list of "active" methods for that
class, and the superclass. From that it can figure out where to get
its methods from -- this class or one of its ancestors.

Second there is only one thread to start, so no matter how many
objects you have only one method as a time executes. You can create
new threads, but there is never one thread per object, except for a
few special classes.


--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.

Back to top
Chris Smith
Guest





PostPosted: Thu May 13, 2004 7:47 pm    Post subject: Re: Somewhat of a big lie about OO in java book? Reply with quote

Roedy Green wrote:
Quote:
On Thu, 13 May 2004 10:47:15 -0600, Chris Smith wrote or quoted :

The same method is executed in parallel for many objects. So there are as
many instances of the methods as there are objects.

Roedy, despite your introduction saying "wrote or quoted", it would only
take a tiny effort to get your attributions right in the first place.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation

Back to top
Roedy Green
Guest





PostPosted: Thu May 13, 2004 8:56 pm    Post subject: Re: Somewhat of a big lie about OO in java book? Reply with quote

On Thu, 13 May 2004 13:47:58 -0600, Chris Smith <cdsmith (AT) twu (DOT) net>
wrote or quoted :

Quote:

Roedy, despite your introduction saying "wrote or quoted", it would only
take a tiny effort to get your attributions right in the first place.


I don't think it matters. What counts is what is said, not who said
it.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.

Back to top
VisionSet
Guest





PostPosted: Thu May 13, 2004 8:58 pm    Post subject: Re: Somewhat of a big lie about OO in java book? Reply with quote

"Roedy Green" <look-on (AT) mindprod (DOT) com.invalid> wrote

Quote:
On Thu, 13 May 2004 10:47:15 -0600, Chris Smith wrote or quoted :

The same method is executed in parallel for many objects. So there are
as
many instances of the methods as there are objects.

First there is only one copy of each method. Each object has a hidden
pointer to a hidden object with a list of "active" methods for that
class, and the superclass. From that it can figure out where to get
its methods from -- this class or one of its ancestors.

Second there is only one thread to start, so no matter how many
objects you have only one method as a time executes. You can create
new threads, but there is never one thread per object, except for a
few special classes.

And you quoted a little too little:

VisionSet wrote:
Quote:
Personally I like to think of methods being per object rather than per
class.

*I like to think of*

As in I know it isn't really the case, but personally it helps me to think
of it that way.

If you think of it as the one method per class than it can seem a little
confusing that the method can be a)executed concurrently amongst different
objects and b) that execution carries its own separate set of local
variables.

So I don't see anything wrong with what I wrote, especially if you explain
the proviso that the memory footprint is of just the one method.

I found OO totally baffling when I started 3+ years back, though I never
found this method definition business a difficult concept in the slightest.

And Roedy I have to agree with Chris please try and reply to the person you
intend to, you do this all the time Smile)

--
Mike W



Back to top
Québec
Guest





PostPosted: Fri May 14, 2004 2:07 am    Post subject: Re: Somewhat of a big lie about OO in java book? Reply with quote

Real chaos.
There is a fight: a priest comes by and preach, receive a fist on the nose
an join the fighters, so does the police, the army, etc. when getting near
to the chaos'black hole.
Ok, brigth guys, I am all mixed up. Java is confusing?



Jean
===================
If static method = one method for every instances?
If instance method = one method per instance?

One instance per thread at a time?
If more than one instance per thread deadlock is probable?

Per instance?
Back to top
Andrew Thompson
Guest





PostPosted: Fri May 14, 2004 4:52 am    Post subject: Re: Somewhat of a big lie about OO in java book? Reply with quote

On Thu, 13 May 2004 20:56:03 GMT, Roedy Green wrote:

Quote:
On Thu, 13 May 2004 13:47:58 -0600, Chris Smith wrote or quoted :
....
Roedy, despite your introduction saying "wrote or quoted", it would only
take a tiny effort to get your attributions right in the first place.
....
I don't think it matters.

Again, Roedy. People are different.
I was quite surprised that 'Chris'
said that.

Further, at times when I am skimming,
I may jump over what a or b in a
converstion wrote, to read only the parts
written by a single person.

I would ask you to please put more attention
to it. If we were to follow your scheme of
'anonymous' it would make best sense to leave
all attributions off, rather than have them
incorrect.

Quote:
What counts is what is said, not who said
it.

Perhaps a good point, but if a reader consistantly
finds the posts of one person to be accurate and
informative, while the posts of another trivial
and sarcastic,they may prefer to read the former and
ignore the latter.

To put in even finer edge on it. Would you want
people to believe that things *I write* were written
by 'Roedy Green'? I do not imagine you would be
comfortable with that, or that it would best serve
the reader (..,you *or* me).

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology

Back to top
Roedy Green
Guest





PostPosted: Fri May 14, 2004 6:33 am    Post subject: Re: Somewhat of a big lie about OO in java book? Reply with quote

On Fri, 14 May 2004 04:52:39 GMT, Andrew Thompson
<SeeMySites (AT) www (DOT) invalid> wrote or quoted :

Quote:

Perhaps a good point, but if a reader consistantly
finds the posts of one person to be accurate and
informative, while the posts of another trivial
and sarcastic,they may prefer to read the former and
ignore the latter.

I am so annoyed with how flaky the attributions scheme is. I can't
stand the thought of wasting time frigging around with something so
hopelessly inept.

It should be automated so that it CAN'T go wrong.

see http://mindprod.com/projmailreadernewsreader.html

I don't think you will persuade me. I pay no attention to them
myself.


--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.

Back to top
Andrew Thompson
Guest





PostPosted: Fri May 14, 2004 6:45 am    Post subject: Re: Somewhat of a big lie about OO in java book? Reply with quote

On Fri, 14 May 2004 06:33:11 GMT, Roedy Green wrote:

(attributions in posts)
Quote:
It should be automated so that it CAN'T go wrong.

Agree fully. Pity it's not.

Quote:
see http://mindprod.com/projmailreadernewsreader.html

I don't think you will persuade me.

Probably not. [ Wink ] But before I leave the
subject I thought I should just state specifically
that I feel that..

"Correct attributions server the reader, the
OP and other contributors to the thread best".

[ ..I have certainly badly stuffed up
attributions myself, ..and been on the
receiving end of full-on abuse for things
I _never_ said (HTML group). :-/ ]

Now ..checks subject.. OO? Oh! :-O
Outta' here.

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology

Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.