Wednesday, February 22, 2006

Why I Like PHP

I am happy to see that Tim Bray has a few nice things to say about PHP, and is giving the language some respect.

Although I program for the web in my day job with Java and JSP on a Websphere Application Server, I have been using PHP for my personal web sites for several years now, and wouldn't think of using J2EE for these. My personal view of J2EE is that it has much more overhead than necessary for most small web projects. If you need to put together a simple REST-style web service, PHP allows you to do it in a simple, straightforward manner. Using J2EE for such tasks strikes me as akin to using an elephant gun to shoot mice. PHP has proven to be plenty adequate for me to manage my sites and to work with Amazon.com's web services. I believe it would also do an adequate job on most of what I am currently doing for my employer with the J2EE (assuming I designed a workable XML schema for the mountains of data we use.)

I have a sign hanging over my desk that I printed from Sean McGrath's Blog back in 1973. It reads as follows:


"Some software complexity cannot be destroyed,
it can only be moved from one place to another."

"Recognizing this type of complexity is a key
skill in SW engineering in my opinion. Those
who cannot spot it are themselves easily
spotted. They are the ones swimming in layer
upon layer of interface/class/factory/aspect
as they struggle to get the ab initio
complexity to disappear in a puff of
refactoring logic."

I don't know what Sean was specifically thinking about when he wrote that, but I do know that the J2EE immediately came to my mind when I read it. I believe that a lot of complex problems are easier to solve with simple tools than with overly complex ones.

Sure, it's easy to write spaghetti code with PHP. But, it's easy to get very sloppy with HTML also. In fact, that's what allowed HTML to dominate the internet; it's very easy to use and it is very forgiving if you get sloppy. But that doesn't mean that you have to be sloppy in your programming. Those who choose to use good programming techniques can write some very elegant programs in PHP if they wish to do so.

It's a little like capitalism, where everyone is free to fail, or to succeed at whatever they want to do. While capitalism is sometimes messy, and allows people to be sloppy if they want to and still have some success, the really big rewards go to those who choose not to be sloppy. The big winners are those who choose to be well organized and bring self-discipline to their chosen work: people like Bill Gates, Paul Graham, Henry Ford, Sam Walton, Thomas Edison, Nikola Tesla, Dennis Ritchie.

In addition to its specialized design as a web scripting tool, I believe the biggest reason for PHP's success is that it is probably one of the easiest, and least expensive ways for anyone to get into web programming. It is widely available on low-cost web hosting providers, is easy to learn, and there is very low overhead. As a bonus, old C programmers, like myself, are very comfortable with it.

Like many things in life, success is not determined by the tools you use, although good tools are very nice to have, and certainly make life easier. The most important ingredient is the amount of commitment and self-discipline one is willing to bring to bear on the path one chooses to follow. You can write sloppy code with PHP and never improve. Or, you can learn to write some very elegant code and keep improving.

PHP started out as a simple library of tools developed by Rasmus Lerdorf in support of his personal web site. It has gradually improved over time, and along with the improvements came a worldwide following. One of the more recent improvements is a fairly good implementation of the W3C DOM2 in PHP version 5. Like C, I think that PHP allows you to do many things in a straightforward manner. Also like C, I find that PHP doesn't get in your way or bog you down.

Wednesday, December 14, 2005

Are we doomed to return to the Dark Ages?

Adam Bosworth points out that the modern industrial world would not have been possible without the renaissance and the spirit of scientific and intellectual inquiry that it fostered. In his younger days, he "...assumed that mankind understood that freedom to think, to reason, and to experiment were paramount and that any irrational intolerant irrational beliefs that threatened these freedoms or, even worse, abused or injured people in the name of some mystical or fanatic cause were horrific reminders of the past."

His blog post points out that he observes with dismay that mystical and irrational beliefs continue to cause many of the world's leaders to "... turn their backs on the spirit of reason and inquiry."

Perhaps part of the reason for this is that very few people are now learning about the history of Western Civilization. As George Santayana once stated: "Those who cannot learn from history are doomed to repeat it."

An overwhelming majority of the faculty at American colleges and universities are irrationally opposed to the rational, captialist, free-enterprise system. They are opposed to it to such a degree that they are also opposed to teaching the history of Western Civilization that gave rise to that system. The situation, as described in this article in Opinion Journal, must be serious when an institution like Yale University forfeits a $20 million donation to support a curriculum in Western Civilization simply because "...Yale's faculty had little interest in teaching such courses."

Wednesday, May 04, 2005

"Banned In Cupertino"

Way back when I was a young teenager in the late 1950's, one of the best ways to promote the sale of more books was to get it "Banned In Boston". It was a sure fire way to jack up book sales into the stratosphere.

Steve Jobs appears to be a control freak who either does not understand the predictable behavior of the book-buying public, or he secretly wants to promote the sale of the new unauthorized biography of him, or he just doesn't care about the consequences of his decision to ban all books published by John Wiley & Sons in all Apple retail stores.

I suspect the third reason may be the correct one. In any event, I believe that the new book "iCon: Steve Jobs, The Greatest Second Act in the History of Business," by Jeffrey S. Young and William L. Simon will sell a good many more copies than it would have had Jobs simply ignored it.

Friday, April 29, 2005

Clarifying My Criticism of J2EE

My criticism of J2EE was actually a criticism of the IBM Wepsphere Application Development system's implementation of the J2EE. Peering under the covers at the multiple CORBA calls has me convinced there must be a simpler, but fully effective way.

I am encouraged by this note posted by Tim Bray about IBM's attempts to simplify things.

Thursday, April 28, 2005

Programming is Design

Some of my recent reading gave me the impression that some people regard the idea that programming is a design process is a new idea. (Maybe it was just my interpretation of what I read.)

In any event, these Three Essays by Jack W. Reeves make it pretty clear that the idea is at least 13 years old. According to Mr. Reeves, he had the idea 10 years before he wrote about it, which makes the idea at least 23 years old!

In astronomy, one can make the assumption that the sun revolves around the earth, or one can make the assumption that the earth revolves around the sun. Either assumption is valid, but the the mathematics involved in explaining the motion of all the bodies in the universe is much simpler when one starts with the Copernican assumption that the earth revolves around the sun.

In a similar way, Jack Reeves' argument makes a pretty strong case that starting with the assumption that "final source code is the real software design...does explain some of the observed facts of the software industry."

Regardless of how old the idea is, it appears that Jack Reeves' argument is right on the mark, but appears to be only recently getting attention.

Reeves also states that "Ultimately, improvements in programming techniques are overwhelmingly more important to software development than anything else." Perhaps this explains why dynamic typing languages like Python, Jython, etc. and architectural ideas like Service Oriented Architecture are gaining so quickly in popularity.

Wednesday, January 19, 2005

My Nerd Score


I am nerdier than 98% of all people. Are you nerdier? Click here to find out!

Monday, January 03, 2005

Tying Knots In Your Underwear

Using W3C XML Schema is like tying your underwear in knots. It's totally unnecessary, and it's darned uncomfortable!

It appears there are forces at work in the world that are working very diligently to make XML much more complex than it needs to be.

Simple Systems always win out over Complex Systems. BUT...like the 80 year battle between Capitalism and Communism, there can be very long dark periods where it appears that Complex Systems are winning. (Or, like the Dark Ages, there can be periods of 500 years or more where it appears that the dark, murky world of superstition has won out over the world of reason.)

I wonder how long it will take to get the XML schema problem resolved.

RelaxNG anyone?