[UPHPU] Is OOP really bad in PHP?

Beau Scott beau.scott at gmail.com
Wed May 14 10:35:29 MDT 2008


I wouldn't be too concerned about this guy's judgment of your PHP skills, most of his clues are very generic and slap-in-the-face obvious.
(I've jumbled a few up just to keep them categorized by my responses)

>>> don't comment your code properly with something like phpDoc

phpDoc isn't something you comment your code with. It's a document generator that parses a semi-standardized way of commenting code (JavaDoc-esque)


>>> have never used some form of version control like Subclipse

Subclipse isn't version control, it's an Eclipse plugin for the Subversion version control system.


>>> don't adopt some coding & naming standards and general conventions and stick to to them at least throughout the project
>>> don't use a consistent methodology
>>> don't escape and/or validate properly input or sql queries
>>> don't plan your application thoroughly before starting to code
>>> don't use test-driven development
>>> hard code messages and configuration parameters
>>> don't see the benefits of a debugger
>>> don't refactor your code
>>> don't keep the different layers seperated using something like MVC
>>> don't know what these stand for: KISS, DRY, MVC, OOP, REST
>>> have never seen the advantage of unit tests or testing in general
>>> don't optimize your sql queries
>>> don't allow intelligent error handling
>>> don't know how to use regular expressions
>>> you've never heard of sql injection or cross-site scripting
>>> don't allow simple configuration, can be parameters passed to a class’s constructor, set/get methods called later, or constants defined at a runtime.
>>> don't understand the benefits and limitations of Object Oriented Programming
>>> misuse OOP / everything you write , no matter how small is OOP
>>> don't choose intelligent defaults
>>> don't have one single configuration file
>>> don't use a database abstraction layer
>>> don't keep it DRY, Don't repeat yourself. If you have to copy and paste or duplicate something your design may be off.
>>> don't make a function/class/method do just one thing and don't make them interact.
>>> don't try to take advantage of OOP specific features like abstract/interface classes, inheritage polymorphism & access modifiers.
>>> don't optimize your application design with established design patterns
>>> pollute the global namespace, one option is to prefix the functions in your library with a common string
>>> don't allow your user to define a base directory if you have multiple files and/or directories
>>> don't program & test with error reporting on
>>> don't return content but echo or print it from your functions or classes
>>> return HTML, not data, strings, or objects.

These are important, but aren't specific to PHP so why he singles PHP developers out for them I don't know.

>>> don't use __autoload

Really? Wouldn't using this when not needed defeat KISS (as pointed out above?)

>>> use $_GET instead of $_POST for any destructive actions

Agreed. (though it's not unique to PHP other than the syntax)

>>> you think reusable software equals/requires your code to be OOP

Might not equal or require, but sure makes it easier...

>>> don't want the file contents to be seen, but give it a .inc extension instead of .php

Agreed. This is just dumb. At the very least, setup a .htaccess rule that denies access too them.


>>> don't allow a table prefix when using database tables

Again, not specific to PHP... It's a good idea, but 99% of the projects I've worked on aren't things that will be used within the same database as other systems, so this isn't needed (again, KISS?)

>>> use a separate template engine

KISS, man. Yes templating engines are good to have, but the need for one should be determined upon the scale of the project. Also, most good frameworks have this built in, so why would I use a separate engine from what's already there?

>>> don't take a look at established php frameworks for inspiration, most of them have advanced web dev concepts and good code

Again, not specific to PHP. Any project in any language could benefit from using a good framework.

-------

Sounds to me like he's been burned by a few script kiddies doing rush jobs. But then again, that's a BENEFIT of PHP -- ease of use, rapid development and cheap labor. From a short term PM stand point, these are all great.


Beau





-----Original Message-----
From: uphpu-bounces at uphpu.org [mailto:uphpu-bounces at uphpu.org] On Behalf Of Nathan Lane
Sent: Tuesday, May 13, 2008 11:20 PM
To: UPHPU General Discussion
Subject: [UPHPU] Is OOP really bad in PHP?

This site, http://reinholdweber.com/?p=19, seems to say that OOP is bad in
PHP - like #26 and #27 give me this impression. Is that really true? If so,
then why is PHP 5 even more heavily OOP-based than previous versions?

-- 
Nathan Lane
Home, http://www.nathandelane.com
Blog, http://nathandelane.blogspot.com

_______________________________________________

UPHPU mailing list
UPHPU at uphpu.org
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net

No virus found in this incoming message.
Checked by AVG. 
Version: 7.5.524 / Virus Database: 269.23.16/1432 - Release Date: 5/14/2008 7:49 AM


No virus found in this outgoing message.
Checked by AVG. 
Version: 7.5.524 / Virus Database: 269.23.16/1432 - Release Date: 5/14/2008 7:49 AM
 




More information about the UPHPU mailing list