Archive for October, 2008

Object-Oriented PHP 5 – just like Java

Sunday, October 19th, 2008

One of the best thing about PHP is how easy it is to learn.

If you come from Perl, you may have at times the feeling that “PHP is Perl for Dummies”  … as my Perl teacher liked to repeat.

If you come from Java, it is even better. PHP 5 OO concepts make it very close to Java, you can learn the few differences very quickly: the package concept in Java is replaced with namespaces in PHP, since version 5.3; the properties of an object are accessed with the awkward $this->myProperty.

Now, you can grab a book on PHP 5 objects, flip the pages and repeat: “just like Java”, “just like Java”, “just like Java.”

Why JavaScript is so difficult to learn

Sunday, October 19th, 2008

I have been a web developer for more than 3 years. In the process I have learned HTML/XHTML, CSS, Ajax, PHP, MySQL and a few things about HTTP and Apache. And overall this has been a fairly smooth experience. But, for some reasons that I have had troubles to pinpoint up to now, JavaScript is the language that has been difficult to learn.

Blaming it on awkward constructs misses the point

For a while I have been blaming that on some unique JavaScript features such as closures or JavaScript Object-Oriented constructs. But blaming it on those is missing the point.

What makes JavaScript so difficult to use in a browser is that you need to learn much more than just a language!
To understand JavaScript, you need to know about:
- browsers
- the DOM
- the BOM
- a UI platform
- 3 different event models
- web forms
- cookies
- Ajax

You need to learn way more than just a language

When you know all that, you can finally start learning JavaScript and its awkward constructs!
And then you’ll probably learn to use at least one JavaScript library because it will make your life much easier!
And of course you will have to worry about many other concepts such as “progressive enhancements” or “unobtrusive JavaScript”.

The worse is that I am not even kidding, you really need to understand all of the above quite well otherwise you will not make much progress in your JavaScript practice.

So, no wonder JavaScript is so difficult to learn and use well.

But here is the silverlining:
1. This is fun!
2. Once you have developed all these skills, you will have become quite valuable!