Optimizing for the common case
We all use constructs every day that derive from the design objective that is the title of this post. The most commonly encountered is one that (allegedly) Ritchie of K&R discovered: that assignment occurs far more often than equivelency tests, and thus we use '=' for assignment and '==' for equivelency tests in C derived languages. In perl we see this in the departure from the norm in regexes, with metacharacters being escaped to become normal versus the more common normal characters escaped to become metacharacters (we write /(a*)/ not /\(a\*\)/ or whatever)

Which brings me to perlmonks. (See I am posting in the right place :-) In my experience when using the [pad://demerphq] link mechanism I am almost always giving a link to my own pad, rarely I end up doing it with someone else scratch pad, and even then its normally to show them how to do the link. Of course I assume that this is true for others as well.

So why is the link mechanism both in how its used and how it renders optimized for the least common case? Consider how it is rendered. [pad://demerphq] gets rendered (for me of course, your domain might differ) as <A HREF="/index.pl?node_id=108949&user=demerphq">demerphq's scratch pad</A> Which to me doesnt make sense. Normally i want to say something like "have a look at my [pad://demerphq]" but that renders as "have a look at my [demerphqs scratch pad]" which if I want it to render naturally I have to say "have a look at my [pad://demerphq|pad]".

Rendering aside (I brought it up first because IMO its probably easier to change) we get to the default behaviour of the [pad://] link. Why (assuming i have typed it in) does it not default to my own name? After all PM knows its me (I wouldnt be chattering otherwise).

So my proposal is this:

  1. Make [pad://] default to the user who entered it
  2. Make [pad://] render as "my scratch pad"
  3. Make [pad://Name]render as currently
  4. Make [pad://Name|String]render as currently

Thus the current usage wouldnt change (no suprises) but we would have it optimized for the most common usage, both on a link level and on a rendering level.

And yes I realize that in the grand scheme of PMDEV issues this a low priority. What I'm after is whether this also annoys other people and whether they think my cure is appropriate. Implementation (and related issues) can be left until a consensus is found.

Cheers all,

Yves / DeMerphq
---
Writing a good benchmark isnt as easy as it might look.

Edit kudra, 2002-04-24 Modified title, heading per author's request

Replies are listed 'Best First'.
Re: Optimizing for the common case...
by particle (Vicar) on Apr 23, 2002 at 17:10 UTC
    i don't like the implementation of the scratchpad idea. it's not much more than another homenode, albeit without clutter. it's view-only, and there is no link (conveniently placed) to edit a scratchpad, even if it's mine. it's contents are not fixed in time, so if i were to refer to it in a post, i'm not guaranteed the info will be there when another user goes looking there. also, it's functionally the same to update a scratchpad as it is to update a homenode. go_to_homenode->go_to_edit_user_information->edit_text_box(). so it doesn't make it any easier to update than a homenode is.

    therefore it's good mostly for chatterbox use. i don't chat much, and if i have a question, i'll post a node. that way, not only do i not need to be there to get an answer, but i can refer to the posted answers later, too.

    there are some favorite links listed on particle's scratchpad, (notice my workaround for the default behaviour) mostly because my personal nodelet was too cluttered, and i haven't taken the time to organize them for placement on my homenode. whenever i get around to that task, my scratchpad will again remain unused.

    that said, i agree that demerphq's usability suggestion would make posting a link to view a scratchpad easier.

    ~Particle ;Þ

      If you missed it, I think dark place addresses some of your issues with the scratch pad.

      --
      perl -pew "s/\b;([mnst])/'$1/g"