Re: Scripting language for DBAs

From: Mladen Gogala <>
Date: Mon, 16 Apr 2012 12:33:50 +0000 (UTC)
Message-ID: <>

On Mon, 16 Apr 2012 09:26:18 +0200, Robert Klemme wrote:
>> PHP is not bad. Same for javascript.

> PHP does not even have proper OO, no thank you.

No? How comes? PHP 5.3+ has classes, with all the proper member protection, namespaces, inheritance, interfaces and everything else that comprises OO. What does it mean that "PHP doesn't have the proper OO"?

As for the question "why not python", here is a little story: I upgraded my home desktop box from F15 to F16, 64bit. As a part of the upgrade, I decided to move my CD's into my home directory. When that was done, I issued the following command:

perl -i.bak -pe 's|^/misc/|/home/mgogala|;' *.m3u

Voila. All my playlists have been fixed immediately. That's the sort of stuff that still only Perl can do. And OO is not always the answer. OO is a great thing, if used properly. Used as a religion, it is debilitating and harmful.

As for the "proper OO", you are probably referring to the fact that in PHP, as opposed to Python, the basic types are not objects, they don't have methods, so in PHP I would write something like

if (preg_match('/^\w+ 123/',$string)) {....}

instead of

import re
if'^\w+ 123',string)

Here, you would have PCRE function called as a method of the "re" object. Evaluating regular expressions is a traditional procedural task, you describe it as a process: "please check if this string matches the regex". There is no benefit from expressing this as an object notation, that is why PHP is still immensely popular. I can write procedural tasks in procedural fashion, like displaying an output of a query, mixing in OO techniques where I need them. OO was invented to help people collaborate on writing large programs, by hiding complexity of the operations on objects into the classes and have other programmers. Unfortunately, people have also invented agile methodology, so now people are creating their own sets of undocumented classes, which nobody understands and is making things far less maintainable than a good procedural script. If I have to present an output from a select as an HTML table, why would I even want to mix in OO?

Received on Mon Apr 16 2012 - 07:33:50 CDT

Original text of this message