Fundamental question about visibility

N

Noah Roberts

WW said:
jeffc wrote:
[SNIP]
Now that is the voice of reason. Having said all that, it's pretty
clear why we don't have to post a whole page like this just because
someone in this newsgroup uses the term "method".


On the contrary. The above snipped post is filled with technical
inaccuracies,

By all means point them out. At a very basic level I believe everything
was more or less correct.

tries to mix OO and C++ terminology (while C++ is
multiparadigm)

You yourself, in a disagreement with me, claimed C++ supports the OO
paradigm. If this is true it must also support the terminology. If
indeed C++ is multiparadigm (and it of course is) then this is not a
problem.

and absolutely fails the task to define the term method in
the realm of the C++ language.

If you want to use differing terminology to avoid confusion between C++
classes and OO Objects then I won't argue, it might even be a good idea.
In my opinion it is acceptable to use the OO terminology in C++ if you
are using the OO paradigm.

And to spell it out for you:

If you consider C++ classes to equate with OO objects then your "member
functions" are indeed "methods", your calls to "member functions" are
messages, your "member variables" are "instance variables" except when
they are of course "static member variables" in which case they are now
"class variables" (and yes, there is also "class methods"). The only
other altered terminology that I can think of off hand is that "Base
classes" are "Super classes" and "Derived" classes are "Sub" classes.

When you design the architecture you use these terms, why not also use
them as you write the code?

Blah, Blah, and Blah

NR
 
N

Noah Roberts

WW said:
Noah Roberts wrote:
[SNIP]
Methods are actions you may request that an object carry out. You
invoke 'methods' by passing 'messages'; methods are implementations of
messages. This is basic OO terminology that you learn in any
introductory text.


That is the meaning of method in OO. What is the meaning of method in C++?

If you are using the OO paradigm while writing C++ code then they mean
the same thing. You could say that you implement methods in C++ with
functions.
That is one interesting issue. The other is that in C++ freestanding
functions (due to ADL and operator overloading) may very well be considered
part of a class types interface.

A very interesting point. They may very well be considered methods as
well then. It would have to be thought about more than I am prepaired
to right now :p
And this is already a source for confusion.

Of course. You must understand the limitations of the language you are
working with. This is always a source of confusion.
C++ is multiparadigm.

Few aren't, though with OO languages many are not. IMHO it is a bad
idea for a language to enforce a particular paradigm on all of its
types. One of many reasons why I hate Java.
Unless he starts to do tricks, like calling a member directly from C or
assembly. I saw that being done in an allegedly portable system. :) "Why?
The this pointer is the first argument, everybody knows!"

You can always break the paradigm. In Objective-C it is also possible,
in fact the language supports it (IMP == a pointer to the actual
function version of a method). With an unpatched gdb you in fact have
to use the function names (complete with underscores:
"__i_ClasName_method()") of the methods you wish to debug; I myself
recommend using the patch :p
Does nto have much to do with why it is wrong in C++. For example in
English fast is an OK word. The same word in Hungarian means "the private
parts of a man". So does that mean we should bad the word from English?
Nope. Does that mean we should not use it in Hungarian?

I would equate the situation more like the following: fast is an ok
english word. In hungarian it is not. Does this mean that if we are in
Hungary we should not say the word fast? I would say that depends on
whether you are talking in English or Hungarian. C++ is Hungary,
Hungarian is the terms C++ uses, English is OO terminology - many who
live in hungary also speak english and it works well for them.

Really? How about they *don't* know what do you mean? Or they do, and give
you the answer which is *wrong* for you, because they do NOT understand the
word the same way as you do? Remember the thread where the greenhorn asked
"what methods does the C++ compiler automatically generate for us".

At some point that could have been myself. I started with OO languages
like Java and Objective-C (deinately the better of the two)x and later
moved to C++. It took me a long time to supress the hate and begin to
like C++ for its differences.

There are several. In fact you could say that all C++ objects actually
subclass a non-existant super class which provides such things as
destructors, constructors, copy operators, etc... In some OO languages
the answer is *none* and so you subclass a super that provides these
interfaces or go through the pain of implementing "alloc".


NR
 
A

Attila Feher

Noah said:
WW wrote: [SNIP]
On the contrary. The above snipped post is filled with technical
inaccuracies,

By all means point them out. At a very basic level I believe
everything was more or less correct.

You use OO *theoretical* terms (message, method) which have no equivalent
concepts in C++. For example in the system I make there are messages. They
involve several design patterns and they do work as in OO. But not because
C++ has messages.

"the only reason to call a method "member function" is
because it is what C++ programmer terminology uses"

No. The *only* reason because it is called member fucntion, because it is a
member function. The reason why it is nto called method is because there is
no one to one mapping between that OO theory term and the C++ language
features.
You yourself, in a disagreement with me,
claimed C++ supports the OO paradigm.

Where? I have said C++ is multiparadigm. You can cut with a Swiss army
knife like a normal knife. But talking about "the blade" is nonsense, since
it has more than one blade. It support the notion of knife but it is *not*
a knife. It is *more* than a knife. C++ supports the OO methodology, but
it is *not* an OO language. It is *more* than an OO language. That is why
some OO terms (and thanx to some other wonders like C heritage, ADL,
namespaces) does not one-to-one apply to it.
If this is true it must also support the terminology.

I have just proven it is not so.
If indeed C++ is multiparadigm (and it of course is)
then this is not a problem.

It would only be a bigger problem if C++ had no OO support whatsoever.
and absolutely fails the task to define the term method in

If you want to use differing terminology to avoid confusion between
C++ classes and OO Objects then I won't argue, it might even be a
good idea. In my opinion it is acceptable to use the OO terminology
in C++ if you are using the OO paradigm.

We are not using the OO paradigm here. We are using C++. As defined by the
standard. And the standard has no definition of such term as method. If
you whish to discuss OO methodology then go to comp.objects and start with
killfiling TopMind.
And to spell it out for you:

If you consider C++ classes to equate with OO objects

I don't.
then your "member functions" are indeed "methods",

Unfortunately yes and no. There is no one to one mapping for the
theoretical OO term "method" and C++ language terms.
your calls to "member functions" are messages,

They corellate to them.
your "member variables" are "instance variables"
except when they are of course "static member variables"
in which case they are now "class variables"

This is the only thing which I can accept as one-to-one, non-confusing
mapping.
(and yes, there is also "class methods").

Not in C++. In C++ there are static member functions. In C++ classes are
not first class objects.
The only other altered terminology that I can
think of off hand is that "Base classes"
are "Super classes" and "Derived"
classes are "Sub" classes.

And member functions. There is no term "methods", which has an unambiguous
definition, known by all. It is only good to create confusion and
misunderstanding. Just in this newsgroup I have seen already 3 different
people to sware on 3 different meanings for method in C++.
When you design the architecture you use these terms,
why not also use them as you write the code?

Simple. For the same reason you do not use the same terms in designing the
architecture of a house, and designing its bricks.
Blah, Blah, and Blah

Yeah, it was.
 
A

Attila Feher

Noah Roberts wrote:
[SNIP]
If you are using the OO paradigm while writing C++ code then they mean
the same thing. You could say that you implement methods in C++ with
functions.

Yes. And you can also implement them by freestanding operator functions.
And who know in how many ways (actual syntax aside). Any ways ADL will find
them.
A very interesting point. They may very well be considered methods as
well then. It would have to be thought about more than I am prepaired
to right now :p

Yes. That is why the term method has no meaning in the realm of C++.
Method is an OO term. A theoretical term. Some languages took it in as it
is, some not. C++ is one of those, which did not.
Of course. You must understand the limitations of the language you
are working with. This is always a source of confusion.

Limitations??? You mean a multiparadigm language supporting more than OO is
a *limitation*????
Few aren't, though with OO languages many are not. IMHO it is a bad
idea for a language to enforce a particular paradigm on all of its
types. One of many reasons why I hate Java.

C3PO also hates Jawas. He said: disquasting creatures. ;-) I love C3PO.
:)
You can always break the paradigm. In Objective-C it is also
possible, in fact the language supports it (IMP == a pointer to the
actual function version of a method). With an unpatched gdb you in
fact have to use the function names (complete with underscores:
"__i_ClasName_method()") of the methods you wish to debug; I myself
recommend using the patch :p
:)


I would equate the situation more like the following: fast is an ok
english word. In hungarian it is not. Does this mean that if we are
in Hungary we should not say the word fast?

Yes. Unless you want to get your face repartitioned and reformatted. The
rough transalation of what fast will be received (perceived) in Hungary is:
a big c*ock into your mouth you S-Whole.
I would say that depends on whether you
are talking in English or Hungarian.

It depends.
C++ is Hungary, Hungarian is the terms C++ uses,
English is OO terminology - many who live in hungary
also speak english and it works well for them.

Nope. That parallel was only good up to the point I used it: while a word
can hold one meaning in one language it may not hold the same (or any
definable - agreed) meaning in another. The rest (what you wrote) is B/S.
Why? Because English and Hungarian people talk about the *same thing*.
While OO (theory) and C++ (implementation) is *not*.
Really? How about they *don't* know what do you mean? Or they do,
and give you the answer which is *wrong* for you, because they do
NOT understand the word the same way as you do? Remember the thread
where the greenhorn asked "what methods does the C++ compiler
automatically generate for us".
[SNIP]
There are several. In fact you could say that all C++ objects
actually subclass a non-existant super class which provides such
things as destructors, constructors, copy operators, etc...

No, you cannot. Because in this case they could be converted to that common
base class.
In some
OO languages the answer is *none* and so you subclass a super that
provides these interfaces or go through the pain of implementing
"alloc".

Yep. So let's not mix OO theory with C++ practice. They have a very strong
relationship but there are just things there with no one-to-one mapping.
 
G

Gavin Deane

jeffc said:
The part about the method was completely unhelpful. He was just saying it
to show off his book knowledge of detail unrelated to the question, so he
can appear authoritative, toe the party line, be part of the cool C++ geek
crowd, and waste space in the newsgroup. People like that are only
motivated partially by helping people. Terms like method are completely
valid when discussing C++ design and code, regardless of whether the word
appears in the C++ keyword list, or even the official standard. Just like
base class, parent class, and superclass can be used interchangably, even
though you won't find them in the language. Unlike some people, I'm not
sitting here with a steel rod up my butt waiting for the next time someone
uses the term superclass so I can pounce on them for using a word that
doesn't exist in the language.

Base class, superclass and parent class AFAIK all mean exactly the
same thing so could be interchanged. Whether this is still true in the
case of non-public, virtual or multiple inheritance I don't know. If
there were a princilpe of OO design that said that 'superclass' was
not the appropriate term in multiple inheritance, then that OO
superclass concept would not be interchangeable with C++'s base class
concept.

C++ has member functions, static member functions, virtual and pure
virtual ones, friend functions and non-member non-friend functions
that can make up a class's interface. I may have forgotten others.
'Method' is not technically defined in C++. When someone asks a C++
design question and talks about methods, it is important to ascertain
which of the above list of types of class interface function they
regard as methods. Otherwise how can you understand the question or
propose a solution?

It is also valuable to point out that 'method' is not a C++ term.
Someone who has learnt the term in the context of another language or
general OO design principles may well not be aware of exactly how C++
implements the concepts.

I don't know why you have a problem with attention to detail. It is an
extremely important quality in a computer programmer, since the
computer has to follow precisely what you told it to do, even if you
meant something slightly different.

GJD
 
J

jeffc

Gavin Deane said:
I don't know why you have a problem with attention to detail. It is an
extremely important quality in a computer programmer, since the
computer has to follow precisely what you told it to do, even if you
meant something slightly different.

Oh. I didn't realize that Gavin. Maybe that's why none of my programs have
ever compiled. In the future I will try to remember to be more detail
oriented if I expect success in computers. Thank you.
 
J

jeffc

Noah Roberts said:
You yourself, in a disagreement with me, claimed C++ supports the OO
paradigm. If this is true it must also support the terminology. If
indeed C++ is multiparadigm (and it of course is) then this is not a
problem.

His robotic responses change depending from which side of the fence he's
currently arguing.
 
N

Noah Roberts

WW said:
jeffc wrote:

Stop trolling!

I really must say now that this has become incredibly annoying. There
are at least 10 messages in which "Stop trolling!" is the only thing you
say spanning multiple threads. There really isn't any point in it.

NR
 
W

WW

Noah said:
I really must say now that this has become incredibly annoying. There
are at least 10 messages in which "Stop trolling!" is the only thing
you say spanning multiple threads. There really isn't any point in
it.

Any other, than to stop JEFFC from TROLLING in ALL of thsoe THREADS. Which
is just as annoying. So if you want to help, stop him from trolling.
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,067
Latest member
HunterTere

Latest Threads

Top