Archive for January, 2007

Why PHP?

Monday, January 1st, 2007

We already have Perl, we already have Java, and both claim they can do the job on the web. So why introduce another language? Why use PHP?

P stands for Pragmatic

PHP is just the smallest tool that gets the job done. Why use anything else than a hammer when you just want to pound a nail in the wall.

Together with MySQL, PHP provides a simple and complete web solution on the server side. It is simple: you can create very quickly a web prototype. It is also highly scalable: some of the largest web sites use PHP.

Whether the task is to generate HTML, manage sessions or interact with a database, PHP always comes with a very simple solution.

A simple language

Many languages have difficult concepts to grasp; some of them are even weird at times. This is not the case for PHP. In fact, if you know any modern language, you should be able to learn PHP quickly.

The simplest tool for the job

PHP is a simple scripting language and you can certainly write sloppy code with it. However if you want you can write highly maintainable code; actually, you can easily write object-oriented code. In fact, PHP 5 can look very similar to Java (with one big hole: no packages/namespaces).

The best feature

The best PHP feature may seem like a little thing. The big deal is that you can mix PHP tags and HTML tags: you can put PHP code inside HTML tags, and you can put HTML tags in PHP code. This makes it a very pragmatic tool to produce HTML pages, the core of the web.

I heard at a conference that at one point Yahoo wanted to standardize their development on one language. They reviewed 10 possible solutions and they ended up choosing PHP: the deal breaker was that capability of embedding PHP tags directly into the HTML.

The best tool for web development

So, as far as I am concerned, on the server-side PHP is just the best tool for web development (i.e. web page manufacturing).
Now, I would not use PHP for anything else. But for that one essential task, it is an outstanding tool.

 

JavaScript has nothing to do with Java

Monday, January 1st, 2007

We probably have all stumbled on this one when we discovered the two names Java and JavaScript.

At both ends of the spectrum

Java? JavaScript? Probably the same language, right? Or at least very similar languages, like part of the same family, right? 

A marketing ploy

JavaScript was first developed by Netscape under the name Mocha, and later LiveScript. At that time the hot new language was Java.
I guess someone at Netscape must have thought that it would be cool to give that new language the name of JavaScript, confusing in the process generations of developers, managers and headhunters.

At the opposite ends of the spectrum

So the truth is that JavaScript has nothing to do with Java, except for the fact that both are modern software languages.

In fact if you rank current languages according to how structured they are, JavaScript will rank as one of the least typed, most dynamic, least structured, potentially dangerous and difficult to maintain and Java will rank as one of the most structured, highly typed and easier to maintain.