From: Daniel T. on
ram(a)zedat.fu-berlin.de (Stefan Ram) wrote:

> I recently wrote a small (51 lines) FAQ containing my current
> insight into the answers to the following four questions:

I'll bite. :-)

> What is object-oriented programming?

Programming with callbacks.

> What is an object-oriented programming language?

A high level language that allows easy construction of callbacks.

> What is the main advantage of an object-oriented programming language?

It's easier to write callbacks.

> Can you give a small example programm that shows something
> that can be done in an object-oriented programming language,
> but is not possible in a purely procedural programming language?

No. There is nothing that one turing complete language can do, that
cannot also be done by any other turing complete language. The only
question is, how easy is it to do it.
From: Doc O'Leary on
In article <ease-20071207213133(a)ram.dialup.fu-berlin.de>,
ram(a)zedat.fu-berlin.de (Stefan Ram) wrote:

> "Daniel T." <daniel_t(a)earthlink.net> writes:
> >>Can you give a small example programm that shows something
> >>that can be done in an object-oriented programming language,
> >>but is not possible in a purely procedural programming language?
> >No. There is nothing that one turing complete language can do, that
> >cannot also be done by any other turing complete language. The only
> >question is, how easy is it to do it.
>
> That was my actual intention - I seem to have chosen a wrong
> wording. So, the question is intended to be:
>
> Can you give a small example program that shows something
> that can be done easily in an object-oriented programming
> language, but is more difficult in a purely procedural
> programming language?

I'll do better and go back into the archives

<http://groups.google.com/group/comp.sys.mac.programmer.help/browse_frm/t
hread/392f22288f97af62/>

to call up an example of what even some purportedly OO languages have
trouble dealing with (in this case, why Objective-C crushes C++):

NSSet *myValues = [NSSet set];
[myValues addObject: [NSNumber numberWithInt: 42]];
[myValues addObject: @"1337"];
NSLog(@"One of my values is %d", [[myValues anyObject] intValue]);

--
My personal UDP list: 127.0.0.1, 4ax.com, buzzardnews.com, googlegroups.com,
heapnode.com, localhost, ntli.net, teranews.com, vif.com, x-privat.org
From: Daniel T. on
In article <toint-20071208221141(a)ram.dialup.fu-berlin.de>,
ram(a)zedat.fu-berlin.de (Stefan Ram) wrote:

> "Daniel T." <daniel_t(a)earthlink.net> writes:
>
> >ram(a)zedat.fu-berlin.de (Stefan Ram) wrote:
> >>my $values = newlist(); addint( $values, 42 ); addstr( $values, "123" );
> >>printf( "One of my values is %d.\n", findint( $values ));
> >The point of the code is that the intValue method can work on
> >either the integer 42 or the string "1337".
>
> I see. I change my print statement into the following line.
>
> printf( "One of my values is %d.\n", toint( anyof( $values )));

Yes, now what does "anyof" return? It, of course, is an "object".

> The example assumes run-time typing. Independently of the
> language used, there must be a type information stored with each
> entry of the list.

Run-time typing is a basic requirement of OO programming languages.

> The (procedural) function �toint� gets an entry of the list
> from �anyof�. It will inspect the type tag (run-time type
> information) of this entry: If this indicates a string value,
> it will convert the string value into an int and then return
> this int; if it already is an int, it will return this int.

And if it is of some type that wasn't created until after the "anyof"
function was written? If it can handle such a type, then it is
(practically by definition) an OO paradigm, not a procedural one.
From: Daniel T. on
ram(a)zedat.fu-berlin.de (Stefan Ram) wrote:
> "Daniel T." <daniel_t(a)earthlink.net> writes:

> > And if it is of some type that wasn't created until after the
> > "anyof" function was written? If it can handle such a type, then
> > it is (practically by definition) an OO paradigm, not a
> > procedural one.
>
> If an oo program is /required/ by the problem specification (here:
> the objective C code) then the solution needs to be an oo program.
> But this only is a tautology.

I don't see how the above relates to the issue at all. The specification
was to find a programming problem that OO solves better than procedural.
Such a problem was found.

> My own answer to my four questions actually goes in a very similar
> direction. Unfortunately, I was not able to provide an answer to
> the following problem, which I would deem much more convincing:
>
> Give a ("real-world") problem not using any programming concepts
> (as a non-programmer would state it). Then show an oo solution
> for it, so that it becomes hard to solve this problem in a
> procedural language with the same ease and elegance.

On very small problems, straight line BASIC code is fine. When the
problem is more complex, we can benefit from the extra level of
indirection that functions and procedures provide, more complexity
requires yet more indirection in the form of modular and OO programming
techniques. The OO paradigm is simply another level of indirection.
Indirection is good if used discriminately, bad if used indiscriminately.

So, to answer your problem above: Any real-world problem that is
volatile enough and requires a solution large enough, will suffice. For
an example, even Topmind agrees that the problems solved by GUI APIs
satisfy this criteria.
From: topmind on


Daniel T. wrote:
> ram(a)zedat.fu-berlin.de (Stefan Ram) wrote:
>
> > I recently wrote a small (51 lines) FAQ containing my current
> > insight into the answers to the following four questions:
>
> I'll bite. :-)
>
> > What is object-oriented programming?
>
> Programming with callbacks.
>
> > What is an object-oriented programming language?
>
> A high level language that allows easy construction of callbacks.
>
> > What is the main advantage of an object-oriented programming language?
>
> It's easier to write callbacks.

A lot of languages allow sticking behavior or pointers to behavior
into structures (arrays, etc.). Yet, that is hardly the defining
characteristic by most accounts.

>
> > Can you give a small example programm that shows something
> > that can be done in an object-oriented programming language,
> > but is not possible in a purely procedural programming language?
>
> No. There is nothing that one turing complete language can do, that
> cannot also be done by any other turing complete language. The only
> question is, how easy is it to do it.

Nobody agrees on what OOP really is. The question has started web
fights for a long time. Here are various lists of suggestions and
related debates:

http://www.c2.com/cgi/wiki?DefinitionsForOo

http://www.c2.com/cgi/wiki?NobodyAgreesOnWhatOoIs

Enjoy
-T-
oop.ismad.com