object-oriented programming in php

object-oriented programming in php

Parifoot19

New member
Local time
20:36
Joined
Oct 29, 2019
Messages
11

I often laziness when he knew to learn OOP and especially the OOP in php. Do you think it's really important to use OOP for your projects? Do you use it?

 

Gummibeer

Astroneer
Moderator
Local time
20:36
Joined
Oct 5, 2019
Messages
1,185
Pronouns
he/him

Never without. You won't accomplish any larger project without OOP.
A good entry for PHP OOP would be Laravel. Great docs, easy to learn and amazing community.

And even WordPress OOPs itself but limits itself by this "we want simple updates and support every dev" policy. 🤮

 

kgx

Member
Local time
19:36
Joined
Oct 19, 2019
Messages
4

Yeah, always use OOP and as Gummibeer suggested, use a framework. This is true even for small personal projects. It makes life a lot easier.

 

adam

Mr. Webwide
Administrator
Local time
19:36
Joined
Sep 24, 2019
Messages
1,259
Pronouns
he/him

If the project calls for it! Not every simple script needs to be OOP. I think it makes it more sense for complex and growing projects. If it’s something I can do in less than 200 lines of code in a simpler way then no. A great thing about PHP is that it can be written in functional, OOP and procedural.

OOP doesn’t make good code on its own either, it’s possible to write good and bad code in every style.

It’s pretty widely accepted at this point that PHP standards are OOP and that the language is becoming more and more object-capable as the versions go on.

 

Gummibeer

Astroneer
Moderator
Local time
20:36
Joined
Oct 5, 2019
Messages
1,185
Pronouns
he/him

If the project calls for it! Not every simple script needs to be OOP.
Disagree here. EVERY of my projects starts with a composer.json and PSR-4 which requires OOP.
Let's take your procedural webwide helpers as an example: yes they work without OOP. But if you would use it you would be able to put them all together, use abstraction layers and unify common objects/code/data/calls. OOP isn't made to make your code shorter in total - this counts most times only for growing projects. But to make it more readable, prevent copy and paste and make it easier to test and definitely a lot more.

 
Top