Languages Humour
Quick Reference
God is a Structured Programmer?
For many years molecular biologists have been mystified by the fact that very
little of an organism's DNA seems to serve any useful function.
I have solved the mystery.
The reason why only 30% of human DNA performs any useful function is that the
rest of it is comments.
Once we decode a typical human genome, we see that the contents begin as
follows:
/* HUMAN_DNA.H
*
* Human Genome
* Version 2.1
*
* (C) God
*/
/* Revision history:
*
* 0000-00-01 00:00 1.0 Adam.
* 0000-00-02 01:00 1.1 Eve.
* 0000-00-03 02:11 1.2 Added penis code to male version. A bit messy --
* will require a rewrite later on to make it neater.
* 0017-03-12 03:14 1.3 Added extra sex drive to male.h; took code from
* elephant-dna.c
* 0145-10-03 01:33 1.4 Removed tail.
* 1115-00-31 23:20 1.5 Shortened forearms, expanded brain case.
* 2091-08-20 14:56 1.6 Opposable thumbs added to hand() routine.
* 2501-04-09 19:04 1.7 Minor cosmetic improvements -- skin colour made
* darker to match my own image.
* 2909-07-12 02:21 1.8 Dentition inadequate; added extra 'wisdom' teeth.
* Must remember to make mouth bigger to compensate.
* 4501-12-31 12:18 1.9 Increase average height.
* 5533-02-12 13:09 2.0 Added gay option, triggered by high population
* density, to try and slow the overpopulation problem.
* 6004-11-04 19:11 2.1 Made forefinger narrower to fit hole in centre of
* CD.
*/
/* Standard definitions
*/
#define SEX male
#define HEIGHT 1.84
#define MASS 68
#define RACE caucasian
/* Include inherited traits from parent DNA files.
*
* Files must be pre-processed with MENDEL program to provide proper
* inheritance features.
*/
#include "mother.h"
#include "father.h"
#infndef FATHER
#warn("Father unknown -- guessing\n")
#include "bastard.h"
#endif
/* Set up sex-specific functions and variables
*/
#include "sex.h"
/* Kludged code -- I'll re-design this lot and re-write it as a proper
* library sometime soon.
*/
struct genitals{
#ifdef MALE
Penis *jt;
#endif
/* G_spot *g; Removed for debugging purposes */
#ifdef FEMALE
Vagina *p;
#endif
}
/* Initialization bootstrap routine -- called before DNA duplication.
* Allocates buffers and sets up protein file pointers
*/
DNA *zygote_initialize(Sperm *, Ovum *);
/* MAIN INITIALIZATION CODE
*
* Returns structures containing pre-processed phenotypes for the organism
* to display at birth.
*
* Will be improved later to make output less ugly.
*/
Characteristic *lookup_phenotype(Identifier *i);
How to Determine Which Programming Language You're Using
The proliferation of modern programming languages which seem to have stolen
countless features from each other sometimes makes it difficult to remember
which language you're using. This guide is offered as a public service to help
programmers in such dilemmas.
- C: You shoot yourself in the foot.
- Assembly: You crash the OS and overwrite the root disk. The system
administrator arrives and shoots you in the foot. After a moment of
contemplation, the administrator shoots himself in the foot and then
hops around the room rabidly shooting at everyone in sight.
or: You shoot yourself in the foot with a laser, but only after
bouncing it off a nearby satellite.
- APL: You hear a gunshot, and there's a hole in your foot, but you don't
remember enough linear algebra to understand what the hell happened.
or: You shoot yourself in the foot, then spend all day figuring out how
to do it in fewer characters.
- C++: You accidently create a dozen instances of yourself and shoot them
all in the foot. Providing emergency medical care is impossible
since you can't tell which are bitwise copies and which are just
pointing at others and saying, "that's me, over there."
- Ada: If you are dumb enough to actually use this language, the United
States Department of Defense will kidnap you, stand you up in front
of a firing squad, and tell the soldiers, "Shoot at his feet."
or: Sorry, this gun is the wrong type for your foot. Please put your
foot in front of this cannon instead. Thank you.
- Modula/2: After realizing that you can't actually accomplish anything in the
language, you shoot yourself in the head.
- sh, csh: You can't remember the syntax for anything, so you spend five hours
reading man pages before giving up. You then shoot the computer and
switch to C.
- Smalltalk: You spend so much time playing with the graphics and windowing system
that your boss shoots you in the foot, takes away your
workstation, and makes you develop in COBOL on a character
terminal.
or: Please come back when you've told the bullets how to fly. Ah,
thank you. BANG
- FORTRAN: You shoot yourself in each toe, iteratively, until you run out of
toes, then you read in the next foot and repeat. If you run out of
bullets, you continue anyway because you have no exception-
processing ability.
- Algol: You shoot yourself in the foot with a musket. The musket is
aesthetically fascinating, and the wound baffles the adolescent
medic in the emergency room.
- COBOL: USEing a COLT45 HANDGUN, AIM gun at LEG.FOOT, THEN place
ARM.HAND.FINGER on HANDGUN.TRIGGER, and SQUEEZE. THEN return HANDGUN
to HOLSTER. Check whether shoelace needs to be retied.
- BASIC: Shoot self in foot with water pistol. On big systems, continue until
entire lower body is waterlogged.
- PL/I: You consume all available system resources, including all the offline
bullets. The Data Processing and Payroll Department doubles its size,
triples its budget, acquires four new mainframes, and drops the
original one on your foot.
- SNOBOL: You grab your foot with your hand, then rewrite your hand to be a
bullet. The act of shooting the original foot then changes your
hand/bullet into yet another foot (a left foot).
or: If you succeed, shoot yourself in the left foot. If you fail,
shoot yourself in the right foot.
- lisp: You shoot yourself in the appendage which holds the gun with which
you shoot yourself in the appendage which holds the gun with which
you shoot yourself in the appendage which holds the gun with which
you shoot yourself in the appendage which holds...
- scheme: You shoot yourself in the appendage which holds the gun with which
you shoot yourself in the appendage which holds the gun with which
you shoot yourself in the appendage which holds the gun with which
you shoot yourself in the appendage which holds...
...but none of the other appendages are aware of this happening.
- English: You put your foot in your mouth, then bite it off.
(For those who don't know, English is a McDonnell Douglas/PICK query
language which allegedly requires 110% of system resources to run
happily.)
- INFORMIX: The first gun doesn't work. Three months later INFORMIX's support
desk send another gun which doesn't match the version number of the
bullets. INFORMIX suggest you upgrade to INFORMIX-ONLINE. You pull
the trigger and you shoe gets wet.
- ORACLE: ORACLE sell you a gun, a box of bullets, a holster, a cardboard
mock-up of a wild-west town and a stetson. You find the trigger takes
twenty seven people to pull it. ORACLE provide 26 consultants all
with holsters, cardboard mock-ups and stetsons. The bullet doesn't
leave the gun-barrel and you hire four more ORACLE consultants to
optimise. The bullet bounces off your sandals. You decide to buy
INGRES. Richard Donkin shoots you in the foot.
- INGRES: You pull the trigger, and your identical twin in San Franciso gets
shot. You then turn off distributed query optimisation.
- SYBASE: You carelessly invoke the procedure sp_insert_bullet() which fires a
trigger (neat, eh) on the table GUN. To maintain referential
integrity, the system invokes another trigger which inserts bullets
in your other foot, your shins, your thighs, pelvis and so on up to
the cranium. You are left in third normal form.
- OCCAM: You send a message to your finger, which sends a message to the
trigger, which sends a message to the firing pin, which sends a
message to the primer, which sends a message to the firing charge,
which sends a message to the bullet which sends a very unpleasant
message to your foot.
The pipeline continues to run, a hail of bullets emerging from the
output channel and drilling their way via your foot to the centre of
the earth. The high velocity arrival of such stupendous amounts of
lead creates a density shock-wave which eventually collapses beyond
its own event horizon. The black hole thus formed goes on to absorb
earth, most of the minor planets and the Sun.
The problems of your foot become increasingly insignificant during
this process.
Hyper intelligent beings from the planet Zorg nod their several heads
wisely and confide to each other:
"I always said Tony was a complete twat."
- FORTH: First you decide to leave the number of toes lost on the stack and
then implement the "foot-toes@" word which takes 3 numbers from the
stack: foot number, range and projectile mass (in slugs) and changes
the current vocabulary to 'blue'. While testing this word you get
arrested by the police for mooning (remember this is a bottom-up
language) who demonstrate the far better top-down approach to
damaging yourself.
or: Foot in yourself shoot.
- RTL: You start to really shoot yourself in the foot, but 6 slugs is too
many for an array and blows the compiler to pieces. Eventually you
realise you must rebuild the compiler to allow such huge arrays. This
is so stupid and boring that you start shoot yourself, but just in
time you are interrupted by .....
- Pascal: The compiler won't let you shoot yourself in the foot.
- Concurrent Euclid: You shoot yourself in somebody else's foot.
- HyperTalk: Put the first bullet of the gun into the left of leg of you.
Answer the result.
- Motif: You spend days writing a UIL description of your foot, the
trajectory, the bullet, and the intricate scrollwork on the ivory handles
of the gun. When you finally get around to pulling the trigger, the gun
jams.
- Paradox: Not only can you shoot yourself in the foot, your users can
too.
- Revelation: You'll be able to shoot yourself in the foot, just as soon
as you figure out what all these bullets are for.
- Visual Basic: You'll shoot yourself in the foot, but you'll have so much
fun doing it that you don't care.
- Prolog: You tell your program you want to be shot in the foot. The
program figures out how to do it, but the syntax doesn't allow it to
explain.
- PERL: You shoot yourself in the foot, but you still can't find the
gun.
- Modula-3: You can't shoot yourself in the foot, because it's BAD
PROGRAMMING PRACTICE to have a foot. So you shoot yourself in the head
instead (if someone, somewhere, has defined a method for head shooting).
- ML: You aim the gun, then supply it with a foot to shoot. If this is
impossible, supply it with a phone directory, and let it hunt you down.
Note that even if you are a centipede, it will still only need one
bullet.
- TeX: You shoot yourself in the foot, and the remains
get really neatly
arranged over the floor (even if you don't want them to be).
- LaTeX: Your foot still gets neatly arranged, and it takes you less time
to aim, but somehow that bit of bone isn't quite right...
- PVM: Okay, how many toes do we have? Okay you all ready? Sure? Okay,
okay, wait for it... BANG (The toes are shot off in parallel, but they
only hurt one at a time).
- HTML: Look at this really pretty gun. Now, if you'll just click here...
- JAVA: You can't shoot yourself in the foot. There must be a virtual
foot around here somewhere, though...
- PostScript: Hang on, there was a gun I defined a while ago, and it
looked really nice...
Of course this article does not represent my employers in any way!
--
Duncan Gibson, ESTEC/YCV, Postbus 299, 2200AG Noordwijk, The Netherlands
Preferred email: duncan@yc.estec.esa.nl or ...!sun4nl!esatst!duncan
Desperate email: dgibson@estec.esa.nl or dgibson@ESTEC.BITNET
Quiche Eaters Test
I daresay a number of you have seen or taken the 'Hackers Test': Well, in reply
we'd like to post the 'Quiche Eaters Test'. Questions by Mark Harrison, and
Pete Bevin....
Scores: Score 1 for every 'Yes': The mark is your Quiche-%
Non-deterministic questions: Resolve non-determinism ad lib.
- Have you ever programmed in Orwell?
- ... in Modula-2?
- ... in Dijkstra's Language of guarded commands?
- Have you ever specified a program?
- Have you ever proved a program correct?
- Have you ever derived a program?
- Did it work first time?
- Did it ever work?
- Have you ever used language pre-processors such as Ratfor?
- Have you ever used Emacs?
- Is it your favourite editor?
- Do you use a windows environment?
- Does it have a pretty background?
- Have you ever done a practical?
- On time?
- Have you ever set a practical?
- Do you use a font more than 10 points high?
- Have you ever written a 'Towers of Hanoi' program?
- Was it less than 5 lines long?
- Did you time it for various n?
- Did the timings match your efficiency analysis?
- Does the thought of plain TeX horrify you?
- Have you read any Knuth?
- Do you own Knuth's "The Art of Computer Programming"?
- Have you done any of the exercises?
- Have you read 'Programming from Specifications'?
- Did you enjoy it?
- Do you take 6 letters to spell 'people'?
- Do you own any 'Business software'?
- Did you pay for it?
- Does the thought of solder horrify you?
- Have you ever read a CACM paper?
- Have you ever written a CACM paper?
- Do you read 'Program Now'?
- Do you subscribe to 'Program Now'?
- Do you consider the Usenet Oracle a waste of bandwidth?
- Do you use it anyway?
- Have you ever tried to prove NP=P?
- Did you succeed?
- Would you prefer a VGA-386 to a mono SPARC?
- Do you use DWIM?
- Do you have a cheese plant?
- Is it called Dijkstra (or similar)?
- Do you name your booths numerically?
- Do you serve on any committees?
- Were you elected?
- Are you allowed to meet clients?
- Did you understand q47 first time?
- Do you prefer ground coffee to machine coffee?
- Do you sleep at nights?
- Every night?
- Can you focus on 3-d objects?
- Do you think streamers are found at parties?
- Do you sit down at parties?
- Does everyone else?
- Do you own or have use of a Fax machine?
- Do you use a DTP?
- Have you ever produced a magazine?
- Did anyone buy it?
- Have you ever programmed a neural network?
- Did you think the last question was phrased wrongly?
- Do you read Sci-Fi?
- Do you know why HAL is called HAL?
- Do you beleive Arthur C. Clarke's denial?
- Have you met Edsger, Tony or Don?
- Have you met Niklaus?
- Can you tell one of his jokes?
- Do you think it's funny?
- Do you consider GOTO's harmful?
- Do you prefer recursion to iteration?
- Does your first name sound like a girl's, e.g. Carol?
- Do you want to do research?
- Have you ever done research?
- Have you ever written a computer language?
- Did it work?
- Was it impractically slow, but educational anyway?
- Do you refer to 'How computer programming used to be done'?
- Even when it's still done that way by 90% of industry?
- Do you view computing as a branch of mathematics?
- Of pure mathematics?
- Do you consider the insistence on results to be a problem with industry?
- Do you use your system clock to tell the time?
- Do you expect it to be right?
- Do you complain to the sysadmin when it's wrong?
- Do you consider brackets to be archaic as a method for providing structure?
- Do you know what referential transparency is?
- Do you understand Lambda expressions?
- Can you 'do' Lambda Calculus?
- Do you see it as part of your 'Cultural heritage'?
- Do you feel that computer terminology is too anthropomorphic?
- Did you understand the last question right away?
- Would you prefer to reason about a rayshader than run it?
- Do you consider rayshaders a frivolous waste of time?
- Do you consider colour a frivolous waste of time?
- Is black-and-white typesetting the only valid use of paper?
- Do you keep your appointments on computer?
- In Emacs Diary/Calendar?
- Do you keep your appointments?
- Do you wish you could do computation without having to touch a computer?
- Do you like quiche?
Scores mailed to me?.........
Mark
The Perl 5 Commandments
Original by Adrian Hilton
- Thou shalt run perl with the -w switch and 'use strict', that thy typos
and cock-ups shall be caught, and thou shalt pay close
attention to what it tells thou, yea even though thy
program may appear to run normally.
- Thou shalt check the result of 'open' and do something
intelligent if it fails, for Unix is a capricious
system and thy file may not be there when you expect it.
- Thou shalt give serious consideration for doing the
same thing for 'close' as strange and terrible things
beyond the ken of man or woman may occur in the filesystem.
- Thou shalt use my() to declare thy variables in thy
subroutines, for the notion of lexical scope was given to thee
for a darn good reason.
- Thou shalt stay well clear of local() unless thou understandeth
the subtle and many consequences of dynamic scoping.
- Thou shalt not tie thy scripts to one operating system
without good cause. Remember that the world has a bounty
of good operating systems, yea even some quite dire ones,
and thy scripts may be required on some other platform
in the distant future.
- Thou shalt not use GOTO; just because it has been given
to thee does not mean that it is considered a Good Thing
to Use.
- If thou cannot work out how to do something with perl,
thou shalt consult the man(1) pages because they are
there for a reason and thou canst use the '/' command
to seek thy information.
- Thou shalt take advantage of the generosity of Wall and
Schwarz in providing long variable names, and shalt name
thy variables meaningfully that no hours will be wasted trying
to understand thy code.
- Thou shalt use associative arrays whereever possible because
they are the salt and light of perl. If thou dost not comprehend
their methods, thou shalt RTFM.
- Thou shalt comment thy code wheresoever possible, for even if
thou can understand what it does, it may not be Intuitively
Obvious to many others. This is especially true if thou
is fond of using obscure regexps.
- Thou shalt consider the m! ! alternative to //, especially
when matching Unix pathnames, for backslashing is a grievous
ugliness in perl's eyes.
- Thou shalt group thy constants in one place, easily accessible;
it is a terrible burden on one's soul to trawl through your
code looking for a constant which may be in error.
- Thou shalt provide helpful output to thy users when the
-h or -help switches are supplied to thy program, for
great is the turmoil in one's mind when one tries to
remember the correct order of arguments.
- Thou shalt mediate upon thy regexps and consider all
possible cases, that thy frustration may be minimised upon
unexpected input.
- Thou shalt anchor thy regexps wheresoever possible, that
thy regexp matching algorithm shalt not be required to count
the atoms of the Universe before returning to thou an answer.
- Thou shalt program generally with a healthy paranoia
of what the user may do.
- The comp.lang.perl.* newsgroups have been provided for thy
edification and enlightenment. Read thou and learn. Pay particular
attention to the koans of the gurus, for they have learned
their craft along a long and arduous road.
- These newsgroups are a temptation to ignore the manual and post
a question. Be thou aware that this is asking for a flaming.
Read the FAQ and be thou mindful that they will not do thy work
for you.
- Thou shalt not slurp up a file into an array by evaluating
its handle in an array context, as it is Poor Practice and
not easily distinguished from a Big Mistake.
- Thou shalt not make gratuitous use of $_ and @_ unless thou
really knoweth what thou art doing.
- Thou shalt save pattern matches immediately after regexps
as thou never knoweth when another regexp will pop up out
of the woodwork.
- Thou shalt consider the notion of encapsulation and use
subroutines wheresoever plausible. If thy subroutine is
more than a couple of blocks long, thou shalt think hard
about splitting it in two.
- Thou shalt hark back to commandment 11, for verily I
am not kidding about comments.
- Thou shall especially ensure that the main code block
reads like a book, for it is at the start of a file that
a programmer new to thy code will begin to read.
- Thou shalt use the standard bracketing to please thy
co-workers and ensure that time is not wasted re-formatting
thy code.
- Thou shalt use array and hash references to store lists of
lists, for surely an indexing scheme that useth split() and join() causeth much
nausea to thy better-informed colleagues.
- Thou shalt NOT REINVENT THE SMEGGING WHEEL, and shalt consult
CPAN to see if an older and
wiser guru hath already written a module to do the work for thou.
Perl Aphorisms
Most important, you don't have to know everything there is to know about
Perl before you can write useful programs. You can learn Perl "small end
first". You can program in Perl Baby-Talk, and we promise not to laugh. Or
more precisely, we promise not to laugh any more than we'd giggle at a
child's creative way of putting things. Many of the ideas in Perl are
borrowed from natural language, and one of the best ideas is that it's
okay to use a subset of the language as long as you get your point across.
Any level of language proficiency is acceptable in Perl culture. We won't
send the language police after you. A Perl script is "correct" if it gets
the job done before your boss fires you.
Larry Wall.
SUN MICROSYSTEMS SUES ISLAND OF JAVA*
Mountain View, CA -- Sun Microsystems today filed a trademark
infringement against the island of Java* over the use of Sun's
Java* trademark.
Responding to criticism that the island has been called Java* for
centuries, Sun lawyer Frank Cheatham said "Yeah, and in all that
time they never filed for a trademark. They deserve to lose the
name."
Rather than pay the licensing fee, the island decided to change
its name. They originally voted to change it to Visu Albasic, but
an angry telegram from Redmond, Washington convinced them otherwise.
The country finally settled on a symbol for a name -- a neatly-colored
coffee cup which still evokes the idea of java. Since most
newspapers and magazines will not be able to print the name of the
island, it will hereafter be referred to in print as "The Island
Formerly Known As Java*".
The Island Formerly Known As Java* bills itself as a cross-landmass
island, but so far has only been implemented in production on the
Malay Archipelago. Africa is been rumored to have implemented it
on Madagascar, but it is still in alpha testing.
Lawyers from Sun would also like to locate the owners of the huge
fiery ball at the center of the solar system. They have some legal
papers for them..
Return to Languages index