PHP vs. Perl vs. Java – a student's question.
Once and a while, I get a question from a student about PHP and programming that I use in a blog post … here we go again:
… you mentioned that you used to use mostly Java but have switched to mostly PHP. Would you recommend learning PHP as a primary method of creating dynamic web pages or is its strength in data base manipulation. I was learning Perl form processing which led me to your site when I was having trouble with mySQL, and I noticed PHP is very similar (at least in the basics) as Perl. Do you have much experience in using Perl to help create web pages and would you recommend using it at all?
About PHP vs. PERL vs. Java:
PHP is the way to go. Perl is a good language but it was not designed initially for web development – that functionality was added later.
Whereas PHP (which borrows from Perl btw) was designed specifically for web development, and so Perl is just clunkier compared to PHP when it comes to creating dynamic web sites.
I’ve used Perl in the past, mostly creating simple string parsing scripts and other little things. But I would NOT call myself an Perl programmer – so take that into consideration.
That said, I’ve always liked a common strategy used in Perl, where they generate static pages from dynamic code. For example, in our web designers directory, I used a Perl based directory script that uses that strategy.
… What’s interesting is that it generates the directory pages as static HTML pages. The advantage of this is that the directory itself is more portable and much less resource intensive because for the most part, the directory is just of pages that people just read … no need for them to be dynamically generated every time a user request it.
The problem I had with Perl, was its’ practically unreadable code. The language is so flexible in terms of the syntax and structure of the code (for lack of better words) … it becomes esoteric. Trying to decipher old Perl scripts is almost always a nightmare – even for the programmer who wrote it!
Java is great for the enterprise … that means, if you plan to be working for very large companies. But it takes a lot longer to create anything in Java vs PHP. The Java community likes to think their code will be more secure and stable, thus justifying the increased time in development. This perception is simply not true … in fact, my experience has actually shown it to be the opposite.
You can find the SQL videos you were looking for here: