Click to See Complete Forum and Search --> : OOP or procedural
I have been writing PHP code freelance for about a year now and write everything "procedural" as I still haven't got round to learning OOP. Anyway I recently wrote some code for a job but the client rejected it because it was not OOP and stated that procedural code is old fashioned and inefficient.
Is this true?
What major advantages are there of writing OOP?
After looking at OOP it seems so different that I can't see any resemblance to procedural.
LiLcRaZyFuZzY
11-14-2005, 09:59 AM
Procedural PHP is not obsolete, it is more efficient and quicker for small applications, but if you do a large application, where you reuse the code a lot, OOP might become handy.
http://www.zend.com/zend/art/oo-proc.php
LiLcRaZyFuZzY
11-14-2005, 10:47 AM
hehe, i love this part:
The Procedural Fanatic
The Procedural Fanatic was criticized by his computer science teacher for not using a more abstract approach. His argument, "But it works!", didn't improve his grade. Later, he went on to a career writing drivers, file systems, packetizers and other low-level programs, where his focus on speed and terseness gained him recognition.
Extreme examples of the Procedural Fanatic go a step beyond rejecting objects, and criticize abstraction itself. They are always looking for ways to make things faster, and don't care if nobody else can read their code. Often, they consider programming a competitive rather than a team activity. They like to enter obfuscated code contests. Their favorite languages besides PHP are C and Assembler. In the PHP world they might write PECL modules, contributing code that is efficient.
The Objects Fanatic
The Objects Fanatic recently discovered object oriented programming and is eager to put it to use - everywhere! The Objects Fanatic doesn't really understand the performance considerations behind his approach. It sometimes seems that he enjoys abstract design concepts more than actual code. He probably has a career in project management or documentation.
Objects Fanatics are quick to point out to the proceduralists that without abstraction we'd all still be using ones and zeroes. They are known to speak in pseudocode. Extreme examples of Object Fanatics go beyond coding on objects at the expense of performance - they do it at the expense of elegance and even readability. Their favorite language besides PHP is Java or Smalltalk. In the PHP world, they may write PEAR modules, contributing code that is well documented and easy to maintain.