Re: Correct C++ tutorial chapter 2.1 "Classes" available (Windows, mingw/msvc/std)

From: Thomas Hansen (polterguy_at_gmail.com)
Date: 03/30/05


Date: 30 Mar 2005 03:35:29 -0500
To: (Usenet)


M Jared Finder wrote:
[snip]
> > But their motivation is still the same, OO is just after all an
> > extremity of typesafety.
> > Instead of having a method signature with a given type and issuing
a
> > compiler warning/error when trying to call the method with the
wrong
> > type you couple the method within the type making it impossible to
make
> > your sub fly...
> > In practise you're right, in theory I must declare that I
dissagree.
> >
> > But I guess this is one of those subjects where we all do alot of
> > armwaving and "you know what I mean" stuff...
> > At least in the theoretical perspective.
> > Let the chicken and egg problem pass us unnoticed!
> > ;)
>
> It seems to me like you're looking at OO backwards. OO to me is
about
> polymorphism, where you think of things in terms of shared interfaces

> and per-call implementations. What is dispatched on doesn't matter
as
> much to me as that the dispatch exists. The dispatch has the side
> effect of type-safety, but that has never seemed to me to be the
prime
> motivation.

Might be OO is polymorphism for you, but the single most importent
feature today with OO according to it's "creators" is Data Hiding also
known as Encapsulation!
You've got a "black box" you know if you feed it a direction it will
try to move in that direction, how this is being done is up to the
implementation to decide.
If this is a shared interface, a template policy, a concrete class is
less importent.
The point is that it may rely upon 500 non visible functions and 1000
private data-members which you don't even know exists!
Before OO we had stuff like (C) void * (typesafety), struct's where all
the data was "wide open" to manipulate for everyone (no encapsulation)
etc.
Basically if you had a bug somewhere you had a scope of "all the code".
After OO we could narrow that scope to only public functions and public
data in the class.
OO is about RESTRICTING developers from doing things (data hiding,
encapsulation, typesafety), not ENABLING them to do things
(polymorphism, inheritence etc.)

Ask your self how many times you've used virtual functions and how many
times you've used private data-members/function-members...
;)

[2_cents_of_zen_philosophy_in_the_morning]

The perfect class has no public members, no public data, can not be
copied, can not be assigned to, can not be instantiated and can not be
destroyed...
That's the perfect class!
(ref: If something is available it will cause trouble! )

[/2_cents_of_zen_philosophy_in_the_morning]

Thomas

      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated. First time posters: Do this! ]