Object Oriented PHP vs Procedural PHP

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

OOP can be seen as another abstaction layer where chunks of logic can be separated in. It makes code reuseable more easy and allows to have another boundary around those functions (classes) to separate chunks of code.

vagabund
Автор

I'm writing my first independant PHP project and I have to admit to myself, I've written more procedural PHP code than I intended... I only have the user functionality wrapped in a class and used in the beginning of each php file, as well as a database class for 1-line query's in PHP. Everything else is... a little dirty. Will think about it more next time :)

aleksandar
Автор

OOP is so much better. I have a page of 20 or so of php functions and this I use in every project I make, functions like update database table, execute given query, validate logins, delete from table, etc and this makes writing php like 10 times faster so sure the function might be longer but it pays off cause now you can just call it once instead of writing many lines of code again

deepdive
Автор

Hey, do you think the question this vlog asks strengthens the case for java spring in the small business environment? I've seen a lot of your videos, the one on Ai I particularly liked since you mentioned my current job
I believe you call us semi drivers over there. I would like to get into the freelance game but probably rowing against the tide since I really like working with spring. I just can't understand why it's not more widely used by small business as it seems better than laravel on the one hand and these js frameworks react and others which seem to be experimenting with Serverside versions almost repeating the old school jsp implementations. What do you think?

paulm
Автор

Have to agree, OOP:) (I was not trying to make it rhyme either)

drewconroy
Автор

I see procedural and object oriented like showel and excavator on the construction site. While excavator is much more capable than showel it is also much more complex to operate and sometimes (for small holes) showel is better tool then excavator. So the best is to use both. You just have to know where in the project is better to use procedural PHP and where it is better to use object oriented PHP.

tongobong
Автор

Hey Stefan, great video! Quick question - do you think that OOP PHP is a must-have skill for a seasoned WordPress developer? Thanks!

toda
Автор

Someone needs to run a controlled experiment to measure cognitive load on developers as they build real world applications in different programming paradigms e.g. OOP, Procedural, functional, flow based programming, data driven programming etc.

AxleTom
Автор

Very clear and lucid observations, especially on the business side of thing : it's almost impossible to get a job today without writing oop code! Although i'm far less experienced than you in this subject, i will add two more points: 1) oop based code usually still contain chunks of procedural code, because oop is essentially just a wraper for ultimately executing elementary actions with the help of basic procedural functions. The oop part lets you just better organize your code and more efficently communicate between the different parts of your application, which directly leads to my 2sd point: 2) when combined with powerfull patterns like mvc, oop allows the developper to more easily avoid repeating him or herself and actually write less code than with pure procedural code!So, even with oop, procedural principles and core functions still apply!

Kwisatsoundman
Автор

I think its good to do a bit of both. Like for small easy tasks do procedural and for difficult ones do oop

harvindersingh-xbpz