Pages

Wednesday, November 28, 2007

Programming traditions --foll--from--the--past>

Whenever you learn a new computer language, you come across typical traditional programs and naming conventions.

Digging the etymology of them below:

1. You learn C, C++, Java, C# the first program in many books/tutorials is the print "Hello World!".

probably it is attributed to K&R who created 'C' language which is introduced a phenomenal way in which programming are done today. May be using this as baseline, all the programming languages start with the print "Hello world" program. Do not know what do they used to teach during COBOL/FORTRON days.

World's biggest Hello world program

//C code

void main()
{
printf("Hello world");
}

//Java code
public class HelloWorld
{

public static void main (String[] args)
{
System.out.println("Hello, world!\n");
}

}

//C# code
public class Program
{
static void Main(string[] args)
{
System.Console.WriteLine("Hello World");
}
}

2. Function name is foo()?
what is foo btw - click here
origin of foo()

remember this:
// C code
void foo()
{
bar();
}
void bar()
{
foo();
}
// Neither foo() nor bar() accomplish anything useful,
// and the use of either will lead to a stack overflow error

void foobar()
{
foo();
bar();
}


3. local integer variable names i, j and not a, b?
May be (I)nteger starts with 'i'?, well may be... some one started it and it continues. Or people from maths started using j, k as they were close to integers (See the link below for more) as computers are after all math based !!!
slightly different but from a math world - why is J used for set of integers

4. --More to add--

No comments: