I would like to discuss why is PHP called a structural language? what are the OO concepts that cannot be implemented using PHP?
|
migrated from stackoverflow.com Feb 20 '11 at 13:31
closed as not constructive by ChrisF♦ Dec 9 '11 at 17:36
As it currently stands, this question is not a good fit for our Q&A; format. We expect answers to be supported by facts, references, or specific expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, see the FAQ for guidance.
I consider PHP language to be object-capable, not object-oriented. That's because most of the built-in constructs are not object-oriented. Take an array or a string for example. In object oriented language, you'd use it's methods to manipulate it. In fully fledged object-oriented language everything is an object. On the other hand PHP is object-capable, you can write code, that will be OOP. Instead of using for example normal arrays, you can use data structures from SPL, which actually are OOP. The only problem with that is, it's an extension, not a part of the language itself. |
|||||||||
|
Classification of programming languages is an art as most languages falls in many categories. In this case it's simple enough though. PHP is an imperative OO language, like C++. That is, you can select to use objects and classes if you like, but you don't have to. As regards to what you can and cannot do with objects in PHP, I don't really see anything missing. But "missing" is a relative term here, as some OO languages have more features and others less. For instance, some consider language-supported properties to be a hallmark of OO, something that is lacking in both Java and PHP. Still Java is undoubtedly in the OO camp. Judging from Wikipedia, the fundamental concepts in OO is:
All this is part of PHP. On a personal note, I haven't found anything in PHPs OO implementation that is lacking. There is lots of stuff in PHP that is seriously flawed, inconsistent and just weird, but that is another issue. It's OO constructs are good enough to be called complete. |
|||||||||
|
I wrote an article which might help to clarify this issue!
|
||||
|
1) the first paragraph of the wikipedia-artical on structured prog langs says why 2) there are no OO concepts you cannot apply in PHP |
|||||
|