Marketing of D - article topic ideas?

Nick Sabalausky a at a.a
Sat Jun 5 19:02:33 PDT 2010


"Robert Clipsham" <robert at octarineparrot.com> wrote in message 
news:huembk$2660$1 at digitalmars.com...
>
> Being the only two languages I'd call myself fluent in, I'd definitely 
> call D easier to maintain than PHP... I guess this is easily debatable 
> though.
>

Easily debatable? Not without an existing brain injury ;)

I've used a lot of different languages. PHP's maintainability is one of the 
worst I've ever seen. The whole design of it *begs* for bugs.

Hell, PHP is the only (*cough*) modern (*cough*) language I can think of 
where bugs can actually be introduced without any programmer involvement and 
without even touching a single line of code. The sysadmin just needs to 
change any one of certain PHP server settings (or move the code to another 
server that isn't configured exactly the same), and suddenly random parts of 
the code are silently broken and the programmer is screwed.

An old example is magic quotes - your code will magically (and silently) 
break if the setting is changed without adjusting the code to compensate. 
Yea, I know they're deprecated in PHP5 and removed in PHP6, but it's just 
one off-the-top-of-my-head example of a bigger theme:

It's standard practice by PHP's creators to toss in language-changing server 
settings, and without even having predictable defaults (the *defaults* can 
be configured. Seriously, WTF?). These settings often either can't be 
adjusted in the code itself (ex: magic quotes) or can only *sometimes* be 
adjusted in the code depending on how the server settings are configured (I 
think some session-management stuff falls into this category...and speaking 
of PHP's session-management...well, better *not* to speak of it). So not 
only does stuff change from one PHP version to another, but even within a 
*single exact* version of PHP you *still* have 2^^n number of what are 
essentially different languages, and no realistic way to work around it.

So to write good reliable code in PHP:

First, you have to have a deep understanding of every fucking setting 
offered by every version of PHP that you use. Of course, many of the 
important gotchas are completely undocumented and you have to go by hearsay 
and anecdotal advice. So good luck with that.

Then you have to identify which of those settings might cause problems 
depending on how they're set and make sure to set them properly at the start 
of every single page (not always easy when your "package" system is one step 
away from the C preprocessor).

Then, for the ones you can't change (because of either your sysadmin or PHP 
itself), you have to find the common "safe" subset and not venture beyond it 
(Ex: goodbye '<%%>' and '<??>', it's '<?php ?>' or nothing). When there 
isn't a safe common subset you can rely on (ex: magic quotes) you have to 
detect the active setting (if possible) and adapt. Of course, even doing 
that isn't always possible.

Then when the server's PHP is upgraded, you have to check everything all 
over again (or just pray). Oh, and did I mention sometimes the OS and 
OS-configuration abstractions leek? Needless to say, writing good reliable 
code in PHP is realistically impossible (frankly, I don't even bother to try 
anymore). And if you want to make a re-usable library...hah! Ha ha ha!! Ah 
ha ha ha ha ha!!!

So, PHP maintainability? Welcome to hell. PHP is evilness itself, given form 
as a programming language. Given a choice, I would seriously consider 
writing classic-ASP in VBScript on a WinME workstation running Microsoft Bob 
with an IDE that included Clippy if the only alternative was to do a big 
project in hand-written PHP.




More information about the Digitalmars-d mailing list