Ferdinand Beyer wrote:
> [...]
C++ is difficult since it includes C. Nevertheless every C++ programmer is 100% coding (and thinking) object-oriented - even basic data types like strings are usually objects.

This is rather wrong - one of C++' main strengths is that it allows multiple paradigms of programming (procedural, object-oriented, generic, generative, functional, ...) which can also be mixed etc. Instead of ideologically focusing on only one paradigm (as Java seems/ed to try to), it provides a multitude of possibilities to tackle a problem and design a solution.

You can clearly see that when you, for instance, consider strings (which you mentioned): There is no built-in string type, the standard library introduces a std::string class, but it's absolutely not mandatory to use it. In contrast, many standard library classes rather accept a pointer to a zero-terminated (w)char(_t) array instead of a string, so that you can use your own, "domain-adequate" string type which suits your needs most (note that we're not discussing whether that would be a good thing to have for a scripting language like PHP -- I'm merely pointing out that it doesn't make sense to say that "every C++ programmer ist 100% coding object-oriented".

Another example would be if you consider the <algorithm> part of the standard library -- although classes are used for the "physical" architecture of that library part, it's rather the paradigm of functional programming/style which is applied there.

C++ is very pragmatic in its use of paradigms, and I think that's a good thing.

I don't think I have to explain why I consider Java an OO language, do I?
No, but I'm still missing your definition of an "OO language". Is it a language that only provides you with the means of developing in the OO paradigm? That seems rather restrictive, and more of a problem than a feature.

PHP is a procedural language with OOP being an "add-on".
I don't think that makes PHP inferior for using OO techniques. In contrast, consider the CLOS (Common Lisp Object System) -- you can implement it *inside* plain Common Lisp, but still it's the most sophisticated object system I'm used to (IIRC it's the only object system that satisfies certain criteria of the OMG).

The API (some extensions form the exception of the rule) is completely provided by functions.
There are quite some parts of the "API" which provide an OO interface, and with PHP5 that development continues. Also, you could always wrap parts of the "API" in your own classes, if you felt that made sense. Maybe the more pragmatic approach (resembling C++' standard library) is more adequate, though (but you still have the freedom to built your own string class providing ->length() member functions etc).

> Moreover, OOP still is expensive / slower than
procedural coding.
That is rather a problem of the implementation, and changing from PHP4 to PHP5, doesn't it?

Cheers,
Michael

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to