How To Kill a Dragon With Various Programming Languages


There's a beautiful princess, prisoner in the highest tower of a castle, guarded by a mighty dragon, and a fearless knight must rescue her. This is how each language would manage to rescue the princess from the hands of the dragon

Java - Gets there, finds the dragon, develops a framework for dragon anihilation with multiple layers, writes several articles about the framework… But doesn't kill the dragon.

.NET - Gets there, sees the idea of the Java developer and copies it. Tries to kill the dragon, but the monster eats him.

C - Arrives, looks down at the dragon, pulls out his sword, beheads the dragon, finds the princess, and ignores her to see the last checkins of linux kernel cvs.

C++ - Creates a basic needle, and gathers functionality until he has a complex sword that he can barely understand… He kills the dragon, but gets stuck crossing the bridge because of memory leaks.

COBOL - Arrives, sees the dragon and thinks that he is too old to kill a monster that big and rescuing the princess, so he leaves.

Pascal - He prepares for 10 years to create a dragon annihilation system… When the moment comes, he discovers the program can only take lizards as an entry.

VB - Builds a dragon destruction weapon based on several components, jumps to the back of the dragon and in the most critical time he discovers that the sword works only on rainy nights…

PL/SQL - Gets data from other dragon slayers, creates tables with n ternary complexity relations, tridimensional data, OLAP, takes a lot of years to process the information and by the time the princess became old.

Ruby - Arrives with massive fame, saying he is the best at anything and when he faces the dragon, he shows a lame motion picture of himself killing a dragon… The dragon eats him out of boredom.

Smalltalk - Arrives, analyzes the dragon and princess, turns around and leaves, they are way too inferior.

shell - Creates a very powerful dragon slaying weapon… But in the moment of truth, he can't remember how to use it.

shell(2) - The guy approaches the dragon with a two line script that kills, cuts, disembowels, impales, chops to pieces and packs the beast, but when he runs it the script grows, it fattens, irritates and puts alcohol in the fire of the dragon…

Assembler - He thinks he's doing the right and most efficient things… But he writes an A instead of a D and kills the princess instead of killing the dragon.

Fortran - Arrives and develops a 45-thousand-code-line-solution, kills the dragon, meets the princess… But she calls him a weakling and runs after the Java programmer who was elegant, and also rich.

FOX PRO - Develops a dragon killing system. It's gorgeous and works on the outside, but it's really patched inside, so when he runs the dragon anihilator, he realizes he forgot to index the DBFs.

PROCESS ANALYST - Approaches the dragon with two tons of documentation, develops the unified dragon-killing process, he develops a DFD to free the princess and marry her, convinces the dragon that it's the best for him and it won't hurt. When he executes the process, he estimates the effort and the damage he will cause with a plan signed by the Pope, Buddha and Michael Jackson. Then he buys a couple of nukes, 45 cannons, an aircraft carrier and hires 300 heavily armed men… When all he needed was the sword he was holding in his hand in the beginning…

CLIPPER: Sets up a routine that loads a codeblock array to insult the dragon, serenade the princess, load the sword in memory, beat the crap out of the dragon, clean the mess, prepare a raspberry milkshake for the princess, make love to her, take a bath, start the car, put it some gas and come back home. When he runs it, he gets a "Bound Error: Array Access" and the dragon eats him with fries.

Lisp: where the famous knight-errant, after speaking with numerous experts in dragon-killing, and modeling the knowledge they possess, he programs the system, and when he runs it he realizes he forgot a bracket (bender the offender).

HTML: Mounts a web on famous swords used to kill dragons, but he ignores the W3C standards. When he meets the dragon, he finds out the code isn't compatible with his browser, so he's left swordless. The dragon eats him as an appetizer.

Prolog: Thinks he needs a weapon to kill the dragon. Searches in a catalog for 182014 weapons. By the time the princess dies of her age, he's achieved to know how to make every weapon starting with A: Atomic Bombs, Anti-Air Weapons, Arches, Ammunition, Axes...

PHP: Creates a web page that when he executes it would eliminate the $dragon selecting from a weapons database in MySQL over an Apache server. Nevertheless he forgot the WHERE in the DELETE query and kills the princess, the dragon, the peasants, the witch, the sorcerer and the programmer himself.

JavaScript: The programmer tries to kill the great green dragon that spits fire through his mouth. He creates a script that will delete the dragon when he loads a webpage, to create seconds after, some damsels to throw him flowers and make clapping sounds. Unfortunately he didn't take into account the DOM structure of the lizard, also known as Mozilla, and the only thing he gets is to fill his console of errors and that the Book of Mozilla tells how he was devoured.

ActiveX: The programmers create a tunnel to enter the dragon's lair from the castle and run a program that will kill the dragon from a safe and prudential distance. The dragon discovers the tunnel, eats the workers who dug, the dragon slayers, and enslaves every servant in the castle. The castle becomes a dragon-breeding place, full of little dragons that the dragon sends in pop-ups to other castles. The untasty remains of the knights are put in cans of Spam and sent to other castles as well as a warning. (aquelquesiente)

Basic. He creates a weapon able to kill paper dragons, but no matter how they improve it, they discover it's not good enough to kill any dragon bigger than a baby poodle.

Matlab: They create a loop that calculates the trajectories to shoot a giant arrow at the dragon. The program works flawlessly. What they need now are the voluntaries capable to launch the arrow with the necessary strength and accuracy.

Videogame Programmer : Spends two years programming a state-of-the-art sword with shaders and all. When the time comes to kill the dragon, he finds that half the knights aren't strong enough to raise the sword.


Reblog this post [with Zemanta]

Battle Of The Brains : ACM-ICPC Asia Regionals @ Amrita University – Kerala


Its that time of the year again when brains from all over theAsia meet each other face2face, compete with all their programming and problem solving skills in C , C++ and Java.. Yes..!! You guessed it right.. its ICPC time again atAmrita University..!!

Welcome to ACM International Collegiate Programming Contest 2009 Asia Regionals, the multitier, team-based, programming competition operating under the auspices of ACM and headquartered at Baylor University.

ACM ICPC 2009 Asia Regionals - Online Contest over internet will be held at Amrita University,Kerala.

Each team will consist of 3 members, all undergraduate, and they will be asked to solve a set of 8-10 programming challenge problems - mostly based on algorithms, within a period of 4 hours.!! The choice of programming language between Java, C++ and C is upto the team.

How to register????

A team can only compete in ACM ICPC 2009 Asia Regionals, if-n-only-if they've registered for the same. So, register here

Registration is for one team, consisting of 3 contestants and one coach. The “coach” refers to any full time faculty member of the university or institution, where the contestants pursue their studies.

The contest rules can be found here: Rules_ACM_ICPC09

Hurry up!!! Last date for registration is: 9 September 2009.

Contestant Feedback of the previous contests:

http://sathyaphoenix.wordpress.com/2008/12/09/acm-icpc-asia-regionals-amrita-university-kerala/

http://amritaicpc.wordpress.com/

For more info, visit http://icpc.amrita.ac.in/site/

The Ten Commandments of C Style

1. Woe be to those errant scribes who ignore capitalization in the writing of the C program, and a plague of frogs on those who turn off the switch of capitalization.

2. Thou shalt not capitalize statements such as the "if" or the "for".

3. CONSTANTS shall be shouted to the multitudes in all caps, from every rooftop and steeple, as they are the unchanging firmament and change not through all time, and woe be to those that confuse them with variables.

4. Those Types and Structures which are user defined shall be presented with the first letter capitalized, as they are the high born, lest they be confused with the lesser variables, nor with the shouted CONSTANTS.

5. Variables shall be lower case, even as they start a sentence, for they are the low and common peasant workers doing the everyday drudgery of programming work, and must not be confused with the high-born Structures, nor with the ever-stable firmament of CONSTANTS.

6. Brothers have come to blows o'er the use of long variable names, with many favoring the internal capitalization, thus the use of

long int numberOfPeopleInHell;

whereas others have countered with heated words that the proper way would be

long int number_of_people_in_hell;

Woe be to those who use either name, for it is likely not unique in the first six to eight letters, making some compilers gnash their teeth, while the true scope of the number of people in hell would vastly exceed the capacity of the long int, causing the dreaded plague which infecteth, locketh-up and rebooteth all computers from the lowly PIC to the mighty Cray.

7. While much blood has been shed over the issue of the curly brace, and many are the programmers that have argued that opening curly braces should go on their own line, while others have protested with sword-in-hand that they must go on the same line as the statement, and many have come to blows over this, the closing curly brace shall be indented to the same level as the opening function.

8. Thou shalt not comment the obvious. Those rapscallions and heathens who penned the line:

i++; /* Add one to i */

shall be forever banned from the inner circle of C, though their resume grow long and their accomplishments and finished code stretch out before them like a lake of ASCII text. Likewise, any code which is not obvious, or obfuscates and bebothers the user, shall be extensively commented so as to make clear the intent of the programmer.

9. Thou shalt comment the author, date, and revision of each C program, and lo, other comments shall be brief, descriptive, to the point, yet clear as the purest mountain spring water in their explanation and clarification of the code. Each function shall have as its companion a description of its function, its inputs and outputs, as each dog has its day and each actor his moment on the stage. Thou shalt document the purpose of each and every I/O pin in an embedded processor, and for each variable, data member or Structure there shall be a comment which shall illuminate and enlighten the reader of the program as to its use.

10. Thou shalt properly indent programs, each subservient function being indented one level more than its master.

courtesy: Suhas Kurup M
Lecturer, Dept. of Information Technology
Amrita Vishwa Vidyapeetham
Amritapuri Campus.
Kollam-690525
homepage: SuhasKurupM
Reblog this post [with Zemanta]