• Home

CodingExperiments.com

$ sudo make money

Search

Category:

  • Apple Inc.
  • Facts
  • Fun
  • Google
  • Google Android
  • Ideas
  • Internet
  • Linux
  • Microsoft
  • Programming
  • Rants
  • Security
  • Uncategorized
  • web 2.0

Archives:

  • April 2010
  • August 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009
  • March 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008
  • October 2008
  • September 2008
  • August 2008
  • July 2008
  • June 2008
  • May 2008
  • April 2008
  • March 2008
  • February 2008
  • January 2008
  • December 2007

Pages

  • About
  • About
    • The Authors
  • Commenting your code
  • How to Write Papers with Groff
  • ModCMS Anti-Spam Component Set
  • ModCMS Technical Specifications
  • Regular Expressions Guessing Game
  • Saving code directly to a web server
  • The (Almost) Perfect PHP 404 Page

Meta:

  • RSS
  • Comments RSS

Awesomeness tracker

CodingExperiments at Blogged View blog authority
Free Page Rank Tool

PHP Is Good. Yeah Really, Hear Me out Here

May 25th, 2008 by Rishabh Mishra

Introduction

PHP is an odd and inconsistent language. Many developers agree on this, but some of those developers still like PHP while others hate it. A few days ago, a post titled “PHP Sucks, But It Doesn’t Matter” appeared on Coding Horror. That post by Coding Horror is one of many negative PHP posts. I believe PHP is good, but I’ll also cover some of the bad points

Blessings

1) PHP has one of the best documentations, that programmers can add comments and code samples to.

This is one of the things that make PHP an easy-to-learn language. The top-notch documentation will usually help you find what you are looking for. If it’s not in the documentation, there’s always something interesting in the comments.

The bad side: Beginners often add code examples that use bad programming practices, resulting in more beginners using those bad programming practices

2) PHP is everywhere.

You can find a decent version of PHP everywhere. Bluehost, the one that I use for this site, has PHP version 5.2.6, which is currently the latest version. Bluehost, unfortunately, only has Python 2.3.4, which makes it difficult for me as a lot of my scripts rely on Python 2.5. Because PHP is so popular, web hosts work harder to cater to the demands of PHP developers rather than Python developers.

The bad side: While PHP is everywhere, the php.ini can be used to change the environment, making it difficult for PHP scripts to run everywhere.

3) PHP is HTML-embedded.

This makes it easy to create templates with HTML pages with one-line PHP scripts inserting the content that goes here or there.

The bad side: This makes it easy to escalate to spaghetti-code. However, it doesn’t mean that it is impossible to write good code in PHP.

4) PHP is beginner-friendly.

This makes it so non-programmers can quickly pick up PHP and start a web service

The bad side: It’s way too easy to have security holes and other bad programming practices in code. This is the programmer’s fault.

5) PHP is open-source.

Being an open-source fan, I love using an open-source technology.

The bad side: For now, businesses don’t take PHP seriously. This is partly because it’s open-source. This isn’t the fault of the language, but the attitude that people take to it.

Curses

1) PHP has inconsistent function names.

There is no one naming scheme for functions. You have the function strpos (); and str_replace ();. It takes a bit of practice to remember the naming conventions.

The good side: You can always consult PHP’s excellent documentation if you get confused.

2) PHP is slower than a lot of other languages.

Python and other languages are faster than PHP at doing a lot of things. PHP simply loses here.

The good side: It’s still a good language to for beginners that are not performance-crazed.

3) PHP developers don’t get paid a lot.

It probably stems from PHP being open-source and that there are many beginner PHP developers out there. For more reading, you can check out “Dealing with the low PHP salary problem“.

You could argue that this is not the fault of PHP itself, but this is still an important issue.

The good side: I’m not sure on this one.

4) You can make bad code easily.

Making bad code means that you will have to spend more developer time going back and fixing it. Recoding introduces new bugs which means even more time has to be spent fixing the bugs.

The good side: This one is the programmer’s fault, but plenty of anti-PHP blog posts list this as a reason on why PHP is bad. I think that you can make bad code in any language. Making a language idiot-proof is a waste of time. As the saying goes, “If you design something idiot-proof, the world will design a better idiot.”

Conclusion

It’s totally your opinion whether PHP is good or not, but I would like to point out that it isn’t as bad as everybody says it is. Yes, you can write horrible code with PHP. That’s the programmer’s fault. It’s wise for a beginner programmer to learn PHP through reliable sources instead of PHP documentation comments showing off bad code.

Some of the things, like PHP being slower, not being taken seriously by companies, and developers getting paid less will simply have to be fixed as time passes on.


Posted in Uncategorized | View Comments

blog comments powered by Disqus

 
Wordpress Themes by and Website Templates by Blogcut Blogged Blog Directory Blog Directory - Blogged