This really is part observation, part question.
First the observation:
While everybody talks of modular programming, OOP, procedural done correctly, aspect oriented, design designs, etc., several popular opensource PHP applications are plain script files using the structure being controlled by
This looked stupid in my experience till I faced a current problem with my shared hosting company - they do not support MySQL saved methods on hosting that is shared. I examined many competing hosting that is shared packages - same story.
I Quickly rewrote the code using SQL queries plus some static functions in DB-handling class.
Which was after i realized the stated PHP projects really consider the entire spectrum of website hosting packages and thus choose to keep your code as dumb as you possibly can, in order to achieve a wider users list.
Another factor may be the achieve from the script to newcomers with no formal Software Engg background: Scripts are simpler to compromise for newcomers.
Individuals two were the great reasons I saw to describe the phenomenon.
Make no mistake, the men maintaining these projects are very good at software development, so it's not mess.
Sometimes they've spare cash too.
The question: The other sensible reasons are you able to think about?
EDIT: Personally, i believe it isn't about OOP alone, as stated by others, good code structure isn't determined by OOP/Procedural style. I have seen and coded a couple of functions-based PHP projects myself.
The one thing that bothers me most would be that the folder/filesystem layout is nice, the file/folder naming is excellent, documentation is sufficient, standards are adopted, but, whenever you open the file to see the code, there is a hundred if-then-else conditions, version-checking, odd utilization of output loading in some places, cookie manipulation code, some constants, includes, with no obvious structure in lots of files.
A minimum of I appear to become lost each time I attempt reading through the code. But when I just read code from Java or C# code bases, as well as another sidelined PHP applications - there's proper separation of code inside functions, templating can be used for display and so forth. Looks organised. Looks easily understandable.
Backward compatibility might be the problem for maintainers, however they could be available to making the following version inside a more structured way. But this too does not occur!
Clearly, I am missing something because individuals maintainers always strive, in the end.
Provider compatibility is definitely an problem in lots of areas when building programs with PHP, it isn't the key reason why OOP sits dormant in a few projects.
Several Object Oriented Programming qualities like connects, the
public/private/protected key phrases and much more could be only present in PHP 5. Some programs still support PHP 4, mainly because you will find still companies available who will not upgrade (from the justified fear their clients' PHP 4 applications will crash through the dozen). Therefore, there's still lots of "primitive" PHP 4 OOP code around. But there's no living PHP version that doesn't support a minimum of fundamental OOP.
require are utilized to import code clips in to the current script. You will discover them in object oriented programs too.
You will find several software items which make very little utilization of OOP whatsoever, and that is fine as lengthy because the overall code quality is needed. Even though it is regarded as by many people (myself incorporated) like a important approach to write better, more multiple-use software, OOP isn't any requirement to create good software.
i see 3 primary reasons:
- compatibility: PHP didn't include OOP from begin. to become lower-suitable for older PHP conditions and also to achieve a wider audience, you are keeping things as they are.
- effort-switch: switching/refactoring a codebase fron non-OOP to OOP is(!!) of labor, transformation script in my opinion aren't an answer, simply because they often generate code for machines and never for humans. this really is OK from runtime aspect but horrible for maintenance.
- team-culture: i spoken with a PHP designers, some just don't wish to result in the switch, simply because they say things are good and dealing...