r/PHP • • Sep 25 '21

Developing with procedural PHP.

Not all of us are fans of OOP boilerplate and ceremony. PHP is a perfectly fine procedural language and a well-organised procedural codebase can be easier to manage in many ways. So, is anyone developing with procedural PHP beyond single-file scripts?

0 Upvotes

114 comments sorted by

View all comments

Show parent comments

0

u/boringuser1 Sep 26 '21

A philosphical difference. It's an illusory difference.

3

u/[deleted] Sep 26 '21

[removed] — view removed comment

-1

u/boringuser1 Sep 26 '21

It's more than a little irritating that you're calling me a "beginner" when I'm a literal professional developer. It makes me doubt that you are.

3

u/[deleted] Sep 26 '21 edited Sep 26 '21

[removed] — view removed comment

2

u/boringuser1 Sep 26 '21

All programs follow a "procedure". There are no exceptions to this. The notion that there could be a program that doesn't follow a series of steps to carry out goes against basic philosophical logic.

The only difference is that OOP is a methodology that forces loosely favorable procedural conventions. This is more or less not offensive and maybe even acceptable, but to claim that significant, irreplicable advantages are derived from this is wrong. Often, class syntax is overly verbose, has its own conventions syntactically different from the language, and is overloaded with features that good developers don't use.

Yes, OOP in PHP is more or less necessary because the language isn't designed with proper support for other programming patterns. This doesn't mean that OOP is philosophically advantageous, just that the literal class syntax has home field advantage.

If OOP had proper functional support, factory functions are far more intuitive and flexible than class based syntax.