We help IT Professionals succeed at work.

Hoist the colors! We’ve added location flags to usernames sitewide, so it's easier to connect with the global community on EE. View My Profile

x

pros vs cons of procedural vs Object oriented of php

J N
J N asked
on
11,623 Views
Last Modified: 2015-06-30
Hi,

im curious if there are pros and cons of both. it seems like procedural style is fading away and more and more leading to OO.
Comment
Watch Question

OOP is more of a modular approach and allows you to build a reusable code base that can be shared between applications. I wouldn't say that procedural is fading. It is still very useful depending upon what type of program you are building.

Here is a good description that I found on another forum:

I would choose OOP if:
 1.) There was a lot of code that could be shared and reused between the forms.
 2.) The data entry forms were anticipated to change often over time.
 3.) Many new data entry forms were anticipated to be added to the project over time.

I would choose PP if:
 1.) The forms were very unique and few elements were shared.
 2.) The forms were static and not expected to change much over time.
 3.) None or only a few forms were expected to be added to the project over time.

http://www.linuxjournal.com/content/programmer%E2%80%99s-discussion-procedural-vs-oo

Commented:
The main problem with OOP is that it requires a lot of artificial constructs in the code that is widely used, to allow broad general use.

jmiller's description is excellent, and if you don't know that you *need* OOP for your application, avoid it like the plague.  It is harder to manage, harder to change, and any changes have to be tested against ALL using programs.
CERTIFIED EXPERT
Most Valuable Expert 2018
Distinguished Expert 2019
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Most Valuable Expert 2011
Author of the Year 2014
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Most Valuable Expert 2011
Author of the Year 2014

Commented:
@jmiller1979:

Electrician: "Apprentice, bring me a wrench."
Apprentice: "What kind?  Stillson, adjustable, pipe, lock, monkey..."
Electrician: "Doesn't matter.   I'm just going to use it as a hammer."
aikimarkSocial distance; Wear a mask; Don't touch your face; Wash your hands for 20 seconds
CERTIFIED EXPERT
Top Expert 2014
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Most Valuable Expert 2011
Author of the Year 2014
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
J NUnicorn wrangler

Author

Commented:
thanks guys

It definitely looks like procedural will become a thing of a past as like ray said OOP makes the language more richer
F P
Top Expert 2015

Commented:
PHP is a top down / left right scripting language, and tries its best to be OOP. Shame it truly can't be the way the web is architected currently. Java / Javascript / Ruby / Python ... and so on. Those are OO. When PHP makes the jump into C extensions like it has been, e.g., HHVM, PHPNG, and other JIT or C style compilations, then it could be OO, but not as an interpreted scripting language that it is which forgets it existed every time it's invoking a script and is mainly (I've written apps that are persistent and it can't do it correctly or keep up with Java) used without persistent connections...

The reason you should learn procedural when OO style is available? When I learned programming, it was using the CL on IBM AS/400 - they invented SQL before Oracle - and that was a procedural language which loved to use GOTO. Similar to vbscript or batch files in Windows. It's 2015, and you shouldn't think that a language developed in the early 1960's has a place in anything you're learning today for the same reason you don't put faux wood paneling on a wall instead of drywall. They accomplish the same thing, but it looks ugly and people will look at you funny while valuing your input less.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.