October 01, 2014
Am 01.10.2014 23:16, schrieb po:
> On Wednesday, 1 October 2014 at 15:40:59 UTC, currysoup wrote:
>> I certainly believe C++ style and it's community promote the idea of
>> zero overhead abstractions and the kind of OOP style which _does_
>> cause cache misses.
>
>   Take a look at the STL. See any OOP? Right cause there isn't any.
>   Boost? Nope.

I see lots of it. How many examples do you want?

>
>   C++ jumped off the OOP bandwagon some time ago.
>
>

That I agree.

We have learned to not abuse hierarchies and to take advantage of the multi-paradigm capabilities of the language.

--
Paulo
October 01, 2014
>>  Take a look at the STL. See any OOP? Right cause there isn't any.
>>  Boost? Nope.
>
> I see lots of it. How many examples do you want?

 Well Boost might have some, I haven't looked at every library.

 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

October 01, 2014
Am 01.10.2014 23:44, schrieb po:
>
>>>  Take a look at the STL. See any OOP? Right cause there isn't any.
>>>  Boost? Nope.
>>
>> I see lots of it. How many examples do you want?
>
>   Well Boost might have some, I haven't looked at every library.
>
>   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
October 01, 2014
>>  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.


October 01, 2014
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.

--
Paulo
October 01, 2014
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.

October 02, 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






October 02, 2014
On 2 October 2014 00:16, bearophile via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> Max Klyga:
>
>> https://www.youtube.com/watch?v=TH9VCN6UkyQ
>
>
> A third talk (from another person) about related matters:
> https://www.youtube.com/watch?v=rX0ItVEVjHc
>
> He doesn't use RTTI, exceptions, multiple inheritance, STL, templates, and lot of other C++ stuff. On the other hand he writes data-oriented code manually, the compiler and language give him only very limited help, and the code he writes looks twiddly and bug-prone. So why aren't they designing a language without most of the C++ stuff they don't use, but with features that help them write the data-oriented code they need?

Most gamedev's aren't quite as staunch as Mike Acton. The principle is there, ingrained in every gamedev, but that doesn't mean we all love flat C (although lots of us do!).

I've never used RTTI, I've never used exceptions, certainly never use
multiple inheritance, I rarely use templates (in C++)... but I'm still
attracted to D!?
I often find this strange... but not really. In D, I still don't use
RTTI, I still don't use exceptions, I tend to box use of templates
into their own worlds, so I would never use them pervasively (like
phobos).
You'll notice at one point that he talked about using offline text
processing tools to do codegen... this is basically because C's
preprocessor sucks, and C++ templates suck. D templates have proven to
eliminate a lot of those offline tools for me. The code is kept in the
same place, and built using the same tool.
I suspect even Acton would appreciate features like CTFE.
You'll also notice he made repeated reference to build environment
complexity and build times.
D also offers potential compiler advantages, purity, immutable, etc,
which give the optimiser information which it can use to improve
codegen which is awkward in C/C++.
October 02, 2014
On 2 October 2014 01:17, po via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> On Wednesday, 1 October 2014 at 14:16:38 UTC, bearophile wrote:
>>
>> Max Klyga:
>>
>>> https://www.youtube.com/watch?v=TH9VCN6UkyQ
>>
>>
>> A third talk (from another person) about related matters:
>> https://www.youtube.com/watch?v=rX0ItVEVjHc
>>
>> He doesn't use RTTI, exceptions, multiple inheritance, STL, templates, and lot of other C++ stuff. On the other hand he writes data-oriented code manually, the compiler and language give him only very limited help, and the code he writes looks twiddly and bug-prone. So why aren't they designing a language without most of the C++ stuff they don't use, but with features that help them write the data-oriented code they need?
>>
>> Bye,
>> bearophile
>
>
>  He (deliberately I'd guess)conflates cache friendly data structures and
> access patterns with his particular preference for a C style.
>
>  It is a fallacy that he presents as fact.

He uses C style as an aggressive reminder of what you're actually trying to do at all times.

We actually did this in our own engine long before he started giving
lectures like this. One of the best ways to stop people doing insane
shit in C++ is to ban C++.
The engine dev's loved this commitment to C, but the game logic
programmers hated us ;)

There is a middle ground though...
October 02, 2014
On 2 October 2014 07:03, po via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
>
>> OOP style and AoS in general does cause cache unfriendly data access. You can separate out your hot and cold data but at that point you're not really programming in an OO style. He doesn't use RTTI, templates, exceptions, etc. for different reasons than cache friendliness.
>
>
>  Modern C++ != OO style.
>
> I'd say modern C++ is more generic + functional than OO.
>
> He seems to think C++ is about programming in some sort of Java design pattern inspired way.

That's what a post-grad often tends to do...