Can anyone decode this Perl code, please?

John Machin sjmachin at lexicon.net
Thu Jan 23 00:10:03 CET 2003


holger krekel <pyth at devel.trillke.net> wrote in message news:<mailman.1043206359.6381.python-list at python.org>...
> Jane Austine wrote:
> > I am reading Object-Oriented Reengineering Patterns. I really enjoy
> > this book. On p.177, however, there is a perl code, which is all Greek
> > to me. Can anyone here translate it into a pseudo-code or a python
> > code(literal translation might do)?
>  
> > [lots of hieroglyphs deleted]

holger, the ancient Egyptians may feel insulted by the above; aren't
you afraid of the curse of the mummy?

Jane, doesn't the book have a website from which you can get an
electronic copy of the code? Apart from the usual jokes (e.g. Perl
code looks like it was written in the Klingon version of APL &&
transmitted from Dante's Inferno through an acoustically coupled modem
along a barbed-wire fence @ the height of a thunderstorm), you have at
least 2 typos (keysword, claases) ... OTOH, maybe it's not your fault:

   If book.contains_typos_in_code_examples():
      book.get_refund()

> 
>Is this code supposed to be an example
> of OO or a target for urgent reengineering? 

If the code is such a target:
   # "Re-engineering" presupposes that the code
   # was engineered in the first place.
   If the code is explained as it's being (re)engineered:
      book.read_explanation()
   Else:
      book.get_refund()
Else if the code is presented without explanation as a tool to be used
in software engineering:
      book.get_refund()
      # possible candidate for optimisation; may well be most heavily
      # used method




More information about the Python-list mailing list