Saturday, June 20, 2009

Time Waster: X-PHP-QUESTION - Yes, I did notice

Welcome to Time Waster article #1. Time Waster is going to be where I put weird little easter eggs as I find them. Either programming hiccups or weird software oddities that caused me to waste time. Today's Time Waster involves the PHP website itself. To participate, you will need Firefox with the Firebug plugin installed.

Visit the PHP website in Firefox.

Now, open up Firebug and you should see something like this:

Why, yes, I did notice
(Why, yes, I did notice.)

A few other people have noticed this. Looking at the source code for their site doesn't have any explanation for its existence. Someone on the PHP developer team thinks they are cute.

Friday, June 12, 2009

Bad Design: Windows Task Manager

I've decided that Windows Task Manager is ill-conceived, poorly designed, and extremely misleading. Especially the following:

Most people have seen the "Performance" tab and that memory usage chart. Charts have a more powerful influence than a bunch of numbers and statistics. Take a good look at the chart and answer one question: What is the user going to think?

Most users have no idea what a 'page file' is. But most can understand the terms 'memory' and 'CPU'. The chart is extremely misleading. The chart above this chart is 'CPU' usage. In terms of all the charts in Task Manager, that chart is the most useful.

Think in terms of the average user trying to figure out why the computer is extremely slow. Now, based on this image, what can you tell about the current system?

That is right - the average user cannot figure it out. This means Task Manager is poorly designed and is downright misleading. The user is mislead to believe that the page file chart = RAM usage. Additionally, there appears to the user to be plenty of RAM for programs (220MB), so that couldn't possibly be the problem.

In all actuality, RAM usage _IS_ the problem for why the computer is so slow. There is 1GB of physical RAM available to the computer, 1.6GB total is being used, 2.1GB was used at one point during the session, and 2.5GB was used sometime in the computer's past. The solution to this computer's woes is to chuck in more RAM. But the average user won't know that because Task Manager is not showing them useful information via the chart. Using the page file as a chart is a bad design decision. At least change colors showing critical cutoffs so the average user can decipher that RAM usage is the issue when hunting down the reason for why everything is so slow.

Monday, June 08, 2009

Maximum failure: PHP 6 deprecates short tags

I just discovered that PHP 6 is officially deprecating short tags. I'm sorry, but short tags are incredibly useful. They should be turned on for every server. They simplify coding dynamic actions within HTML. Plus, you get the added bonus of using:


Which is short for:

<?php echo $x; ?>

Compare: 7 characters vs. 17 characters. The latter is over twice the length, quite unreadable, and, from personal experience with large code bases, unmaintainable! Typing 'php echo' in every time I want to execute/display data that is hosted within the PHP engine is ridiculous. This is a step backwards going in the wrong direction.

The lame excuse for removing short tags is XML. PHP is for HTML, not XML.

I write PHP code quite regularly. Prior to PHP 5, PHP stunk. PHP 5 really changed my view of scripting languages. PHP 6 is going to ruin that view as we will return, once again, to the dark ages of software development. What really gets me is that someone made a decent recommendation and the PHP development team scoffed at the idea and one person even had the gall to suggest that syntax highlighting is all that is needed - let me point out that blind PHP programmers probably don't want to hear JAWS attempting to speak '<?php echo' over and over again and syntax highlighting is a useless recommendation to a blind programmer. I can imagine a small army of blind PHP programmers beating up the PHP developers (especially the one developer who made the recommendation to use syntax highlighting) while blaring an audio recording of JAWS speaking '<?php echo' over and over.

XML seems to be the pervasive reason. I personally dislike XML and wish it would go away (I also wish Ruby, Perl, and Python would go away too - all three are equally terrible languages - and, yes, I've used them all). I've used XML enough to know that it is a terrible storage mechanism for any data. JSON is better but still not perfect. The PHP serialize() function gets even closer but is a language-specific solution. XML is hereby a lame excuse for not coming up with an alternate short tag strategy.

If XML is sooo important, then simply recognize the sequence of characters '<?xml ' and ignore it. It is already invalid PHP code, so fix the problem transparently. Oh the horror! Three lines of code at most is all that is needed. This whole issue is over a data storage format that isn't commonly output by PHP, is a terrible storage format to begin with, and is over the two starting characters at the very beginning of the storage format. Most people DO NOT EVEN USE XML in the first place! Requiring '<?php echo ' every time output is needed from within the PHP engine in HTML is a surefire way to tick people off. Especially when they learn that the reasoning is the two measly characters at the start of a XML document.

Good grief. I can't believe I'm having to tell the PHP developers how to write software. I'm now going to start tagging posts with "maximum failure" for areas where programmers have failed spectacularly to see the simple solution to a problem. End-users (PHP programmers) want short tags in PHP, the PHP developers see a singlular issue with XML and proceed to blow the whole thing out of proportion, and there is an easy fix (see previous paragraph) that allows both camps to be happy - it is as simple as that.

I'm hoping that as soon as PHP 6 comes out of its internal development cycle and becomes the official release, there will be a significant (read: massive) backlash in the short tag department. In other words, I'm hoping the PHP developers will be forced to add short tags back in and undeprecate them. The only reason there hasn't been a huge backlash already is because: No one knows they are already deprecated, deprecated functionality is rarely enforced, and people are too lazy to rewrite code that works just fine. So, I have one question:

Can the PHP internal developers mailing list handle a million programmers dropping by and asking the same question over and over and over and over and over and over again?

Edit: To date I've rejected all comments to this post. People are attacking me personally and completely ignoring both the purpose of this post and this blog as a whole. This is my rant blog - a place to let off steam - if you don't like it, then don't comment and simply leave. Sheesh.