[Pdx-pm] Hiding Perlish Churlishness from App users

Ovid publiustemp-pdxpm at yahoo.com
Thu Feb 3 12:43:21 PST 2005


The key to this is to figure out how your users are really going to use
your software and try to make it fit their expectations.  For example,
some of the software that I am working on allows people to search a
database and the syntax looks like similar to this:

      ok my $iterator = $store->search(
          $class,
          name => NOT 'foo',
          OR(description => NOT undef),
      );

The WHERE clause would be "WHERE name = ? OR description IS NOT NULL".

A lot of effort went into making that syntax "just work."  The
following are all equivalent and generate the same code:

  name => NE 'foo',
  name => NOT 'foo',
  name => NOT EQ 'foo',

It took me a lot of time to nail that down, but the benefit is clear: 
the programmers using this code have an application that is very easy
to use and doesn't force them to constantly consult the manual.  This
is very important.

Contrast that with the following annoyance in HTML.  Guess which works:

   1. <input type="text" />
   2. <input type="text" disabled="disabled" />
   3. <input type="text" disabled="enabled" />
   4. <input type="text" disabled="true" />
   5. <input type="text" disabled="false" />
   6. <input type="text" disabled="bloody stupid language design" />

Cheers,
Ovid

=====
If this message is a response to a question on a mailing list, please send
follow up questions to the list.

Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/


More information about the Pdx-pm-list mailing list