Immortal Code
ziani writes ""... Sometimes a piece of code is so elegant, so evolved, that it outlasts everything else." Nice article at Wired wondering how much great (and lousy) code is lost due to business failures."
← Back to Stories (view on slashdot.org)
It's nice to see some elegant code in this world of bloated redundant code... Is it me or does it seem that open source is written much more elegantly? Is this just because we can actually see the source :) I'd sit in a corner rocking back and forth if I was forced to read Micro$oft code...
#! /bin/bash
while true; do
sleep 1
done
Refreshing, like the "In modern-day France..." ones.
int main()
{
printf("Hello world\n");
return 0;
}
Seems like the most well known piece of code in programming history.
July 23rd, 1999
The speed of time is one second per second.
The system cannot find the path specified.
C:\>
... in COBOL nonetheless!
000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID. HELLOWORLD.
000300 DATE-WRITTEN. 02/05/96 21:04.
000400* AUTHOR BRIAN COLLINS
000500 ENVIRONMENT DIVISION.
000600 CONFIGURATION SECTION.
000700 SOURCE-COMPUTER. RM-COBOL.
000800 OBJECT-COMPUTER. RM-COBOL.
000900
001000 DATA DIVISION.
001100 FILE SECTION.
001200
100000 PROCEDURE DIVISION.
100100
100200 MAIN-LOGIC SECTION.
100300 BEGIN.
100400 DISPLAY " " LINE 1 POSITION 1 ERASE EOS.
100500 DISPLAY "HELLO, WORLD." LINE 15 POSITION 10.
100600 STOP RUN.
100700 MAIN-LOGIC-EXIT.
100800 EXIT.
*nix.org - Featuring BSD, Linux, OS X, Solaris, & More!
Reply or e-mail; don't vaguely moderate. Ex-O'Reilly/MIT employee, now a full-time Google employee.
To write a program, it takes knowledge of the programming language, an understanding of logic, the discipline to pay strict attention to detail, and creativity. Programmers marvel as they sit back and watch the computer program "come to life" as it runs before their eyes. In the process of brainstorming, debugging, and thinking critically, they also gain a great respect for those who program on a regular basis.
In fact, those who do program for a living or for their passion may wonder who the greatest programmer is. After all, programming is a science and art that requires time and skill. Who has the "bragging rights" to be the greatest programmer of all?
To recognize the greatest programmer, we must first identify the greatest program. Is it Microsoft Word®? Is it Windows®? Is it Linux? Maybe it is the GCC compiler or Emacs. Maybe it is some top-secret program being written at the NSA. Maybe the greatest program is the one created to operate the greatest computer.
So, what is the greatest computer? This may not seem to be an easy question as super-computer technology continues to improve at a swift pace. However, there is one computer that remains far more advanced than all the rest. We call it the human brain.
Scientists will quickly agree with me that the brain is far more advanced than any computer we have to date. When you are reading this text, your brain is accomplishing a task that programmers can only dream about - true language comprehension. When you walk out to get a snack or drive your car to the store to refill the refrigerator, you outperform the most advanced computers money can buy. Therefore, is it safe to say that the "program" that operates your brain is the greatest program of all?
What is this program that operates the brain? DNA. The amino-acid chains that form the DNA molecule store the "blueprints" and the "operating system" not only for the brain, but every cell and organ in your body. This incredible "program" is responsible for the formation and operation of the greatest computer in existence. So, who is the programmer?
According to some of our great computer programmers, nobody. That's right, the program just happened. It was the random jumbling of atoms and molecules over millions of years that finally resulted in the greatest program and the greatest computer of all kind. We call this evolution.
Computer programs evolve - we see it all the time. Each time a new version is released, it has hopefully evolved to include new features and bug-fixes since the last version. We are thankful for the intelligent programmers who work hard to improve their programs and add new features. However, how many programs evolve by the random shifting of bytes of data? In all my experience, these program "mutations" either result in either a dysfunctional program or a computer crash.
In fact, we've been performing an experiment in evolution for years using computers. It is natural for data to randomly be scrambled due to everything from power surges to cosmic radiation. At the rate at which data is transmitted over our world-wide Internet, surely we should have seen some form of natural program evolution, if even on a small scale. According to those who support evolution, man evolved from ape which evolved from lower mammals which long ago originally evolved from single-cell organisms in the sea. Following this theory (and that's all evolution is), simple programs like text editors should someday evolve into operating systems or even some form of computer intelligence. Why don't we see this?
A great programmer by the name of Richard Stallman wants the world to call Linux by the name of GNU/Linux. He wants the world to know that Linus Torvalds only created a small (but important) part of the overall Linux operating system. Much of what we call "Linux" is based on supporting GNU tools. He wants the credit due him for the intelligent, purposeful design behind the programs used to make Linux a complete operating system. In fact, most programmers would probably not take too kindly to not receiving some form of recognition for their work. Yet both Stallman and Torvalds (and many others) deny recognition to the greatest programmer of all, God.
If I were to tell you that nobody wrote Microsoft Windows®, or Linux for that matter, but instead it just "happened" due to the random shifting of bytes in my computer's memory, you would wonder if I was attempting some form of dry humor. However, many people so easily accept the notion that both the greatest computer and the greatest program originated in just such a way. Logic dictates that if the simplest of programs requires intelligent, purposeful design, then so does the most advanced and complex program in existence. To say otherwise is foolishness.
The answer to the question, "Who is the greatest programmer of all?" is quite simple - it is God. It baffles me how programming and atheism often goes hand-in-hand when the programmer shares the very character of God in his creativity and purposeful design. Therefore, it is God whom I honor above all other programmers, because God's "program", His creation, was perfect (not anymore, thanks to sin) and to this day has no equal.
RMS talks about "Free as in Freedom." True freedom is knowing the creator. As a programmer takes pride in their work, so does God take pride in and love His creation. You are very special to God, and He waits for you to seek Him and find Him. If you don't know God but you would like to, I invite you to visit the Billy Graham website. Billy Graham is one of the most respected evangelists of our century and speaks the straight truth. I also encourage you to talk with the pastor at a local church, or a friend who knows God. Most importantly, talk to God - He's listening.
"But if serving the LORD seems undesirable to you, then choose for yourselves this day whom you will serve, whether the gods your forefathers served beyond the River, or the gods of the Amorites, in whose land you are living. But as for me and my household, we will serve the LORD." Joshua 24:15
is BAD code, as bad code never dies... right?
This is the third recent posting to Slashdot from the current issue of Wired Magazine: the 'Year the Music Dies' cover piece, the 'Civil War Within Sony' piece, and now this. Sure, they're all interesting, but do we really need the editors to hold our hand and lead us to the biggest and most famous computer/culture magazine? Aren't we geeks? Let me summarize for the slow: READ WIRED!
If you do need guidance in finding cool Wired articles, check out this 1996 gem on hacker tourism and the laying of fiber optic inter-continental cables by SF god Neal Stephenson, Mother Earth, Mother Board
Left with nothing, Jim and Janet Baker turned to the courts. In a failed attempt to retrieve Dragon from among the L&H assets that were now locked up by bankruptcy laws, they hired the powerhouse law firm run by David Boies.
David Boies?
MAN, is that code GONE.
Blearf. Blearf, I say.
Ia! Ia! COBOL Ftaghn!
THIS CODE IS YOUR CODE - you know what tune to sing it to
This code is your code, this code is my code,
To California from the south of Finland,
From the GNU compiler, to the ELF binaries,
This code was made for you and me.
As I was trolling the threads on Slashdot,
In Unreal Tournament, I need an aimbot,
I saw before me the new KDE,
This code was made for you and me.
This code is your code, this code is my code,
To California from the south of Finland,
From the GNU compiler, to the ELF binaries,
This code was made for you and me.
Downloaded sourcecode, unzipped the tarballs,
Dot slash configure, then make-installs,
And all around me, my systems showed me,
This code was made for you and me.
This code is your code, this code is my code,
To California from the south of Finland,
From the GNU compiler, to the ELF binaries,
This code was made for you and me.
My eyes! MY EYES!!
Forget the whales - save the babies.
Are we speaking of "immortal" in the sense of vampiric, blood- and money-sucking immortal code(Windows), zombie code(DOS) or of angelic/divine code(my database applications)?
I think the breadth and depth of Eastereggs in a project is directly proportional to the inelegance of said project. Microsoft excels in this area exceedingly.
Lodragan Draoidh
The more you explain it, the more I don't understand it. - Mark Twain
"This song is Copyrighted in U.S., under Seal of Copyright # 154085, for a period of 28 years, and anybody caught singin' it without our permission, will be mighty good friends of ourn, cause we don't give a dern. Publish it. Write it. Sing it. Swing to it. Yodel it. We wrote it, that's all we wanted to do."
1000 SlashDot sigs
The heck with black leather couches - this HAS to be the new gold standard in flameout prediction.
That beautiful piece of elegant code you wrote will be lost in a system crash as soon as you move on, if not sooner. That horrid inefficient kludge you wrote early in your career will be retained forever, and when through the vagaries of the world, you end up at the company which owns that code, you will end up responsible for maintaining it.
Unfortunatley, void main() has never been valid ANSI/ISO C. The standard states that main() shall return an int. Also note that the latest standard (C99) requires the type specifier to be present; you can no longer rely on main() defaulting to int.
Output is not guaranteed to be displayed until either a newline is encountered, or a call is made to fflush(). So it is perfectly possible that the user will never see anything.
For maximum portability, it is recommended that you return EXIT_SUCCESS or EXIT_FAILURE from main(). So, here is the correct version:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
if (printf("Hello, World!\n") < 0))
return EXIT_FAILURE;
else
return EXIT_SUCCESS;
}
As evidenced by your post to a web discussion board, your implementation is pretty decent; congrats :)