05/11/2012
Shooting yourself in the foot: A programmer's guide
C
You shoot yourself in the foot.
C++
You accidentally create a dozen instances of yourself and shoot them all in the foot. Providing emergency medical assistance 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.”
C #
You stab yourself in the foot with something sharp.
Assembly language
You try to shoot yourself in the foot, only to discover you first have to invent the gun, the bullet, and your foot. If you know what you are doing, in only 7 bytes, you blow off your entire leg using a mere 2 CPU cycles. Else, when you pull the trigger, the gun beeps and crashes the system. Then the system administrator arrives and shoots you in the foot. After a moment of contemplation, he shoots himself in the foot and then hops rabidly around the lab, shooting everyone else in the head.
Java
You locate the Gun class, but discover that the Bullet class is abstract, so you extend it and write the missing part of the implementation. Then you implement the ShootAble interface for your foot, and recompile the Foot class. The interface lets the bullet call the doDamage() method on the Foot, so the Foot can damage itself in the most effective way. Now you run the program, and call the doShoot() method on the instance of the Gun class. First the Gun creates an instance of Bullet, which calls the doFire() method on the Gun. The Gun calls the hit(Bullet) method on the Foot, and the instance of Bullet is passed to the Foot. But this causes an IllegalHitByBullet exception to be thrown, and you die.
Pascal
The compiler won’t let you shoot yourself in the foot.
Python
You try to shoot yourself in the foot, only to realise that there’s no need, since Guido thoughtfully shot you in the foot years ago.
Ruby
If you can find enough documentation, your foot is ready to be shot in roughly five minutes, but you just can’t find anywhere to shoot it.
SQL
You type: select :=bullet from gun where trigger = ‘pulled’;
insert into leg (foot) values ();—and then you realise something
didn’t match a field type, and your foot was converted into a watermelon.
VisualBasic
Shoot yourself in the foot with a water pistol. On Vista, continue
until your entire lower body is waterlogged.