[Semi OT] Language for Game Development talk

Paulo Pinto via Digitalmars-d digitalmars-d at puremagic.com
Wed Oct 1 22:49:47 PDT 2014


Am 02.10.2014 01:07, schrieb Max Klyga:
> On 2014-10-01 22:33:39 +0000, Paulo Pinto said:
>
>> Am 02.10.2014 00:11, schrieb po:
>>>
>>>>> I don't know of any OOP in the STL, unless you mean the 1980's stuff
>>>>> like iostreams and the other shit most people avoid using, but I don't
>>>>> think this is considered part of the STL
>>>>>
>>>>
>>>> Any use of a class instance is part of OOP.
>>>>
>>>> IOStreams, iterators, strings, containers, ranges, filesytem,
>>>> networking, graphics, traits
>>>>
>>>> Being lazy, and counting its occurrences in comments and when used as
>>>> instead of typename in templates as well
>>>>
>>>> /cygdrive/c/android-sdk/android-ndk/sources/cxx-stl/gnu-libstdc++/4.8/include
>>>>
>>>>
>>>> $ grep -R class * | uniq | wc -c
>>>> 15601
>>>>
>>>> STL is a name that stuck from the old days when it wasn't part of the
>>>> language. Nowadays it is just the C++ standard library.
>>>>
>>>> --
>>>> Paulo
>>>
>>> According to Stepanov STL author:
>>>
>>> http://www.stlport.org/resources/StepanovUSA.html
>>>
>>> "Yes. STL is not object oriented. I think that object orientedness is
>>> almost as much of a hoax as Artificial Intelligence. I have yet to see
>>> an interesting piece of code that comes from these OO people."
>>>
>>> I'd agree with him, just using a class, because it is the primary
>>> abstraction in C++, does not make your code OOP.
>>>
>>>
>>
>> Well I disagree with him and can find examples of static and dynamic
>> polymorphism, data encapsulation and aggregation everywhere in STL,
>> even if he dislikes OO people.
>>
>> Algorithms is probably the only part that is free of OO concepts.
>
> Data encapsulation is not unique to oop. STL is ADT not OOP.
>

STL was ADT when it was initially written in Ada 83, not any longer.

First of all it doesn't exist any longer as such. The International 
Standard ISO/IEC 14882:2014(E) Programming Language C++ has zero 
occurrences of the word STL.

ADT implies using modules, data structures and functions that operate
on those functions. Which in C++ is achieved via separate compilation, 
namespaces and functions.

Basically what Ada 83, Mesa and Modula-2, UCSD Pascal offered as 
abstraction for organizing algorithms and data structures.

If a class is being used, then it already uses the first concept of OOP. 
Aggregation of data and member functions into a type. A module on steroids.

The door is also open to inheritance and aggregation.

If a class does not forbid inheritance, then it can have derived 
classes, even if the author did not intend it. Thus inheritance and 
dynamic polymorphism came into the picture.

Two other OOP concepts.

Finally, just for the fact that we have objects, member function 
invocations are now static dispatch. But if virtual methods are 
declared, then dynamic dispatch comes into play. Both properties of OOP 
systems.

Given the way C++ allows for function overloading, static multi-method
dispatch is also possible when used with NVO.

Just because inheritance is not used, it doesn't mean something isn't 
OOP. There are much more concepts at play.

When concepts lite come into the language, then C++ gains another way to 
deal with interfaces. Which will be used a lot in the standard library 
as well.

As I mentioned in another post. I can easily provide examples of the C++ 
standard library classes and how they use OOP concepts.

--
Paulo








More information about the Digitalmars-d mailing list