Sunday, March 4, 2012

C#

With the introduction of the .NET framework, Microsoft included a new language called C# (pronounced C Sharp). C# is designed to be a simple, modern, general-purpose, object-oriented programming language, borrowing key concepts from several other languages, most notably Java.


// A "Hello World!" program in C#
class Hello
{
   static void Main()
   {
      System.Console.WriteLine("Hello World!");
   }
}

C# programs generally use the input/output services provided by run-time library of the .NET Framework. The statement:
          System.Console.WriteLine("Hello World!");
uses the WriteLine method, one of the output methods of the Console class in the run-time library. It displays its string parameter on the standard output stream followed by a new line.

Saturday, February 25, 2012

Java

Java is one of the most popular programming languages in use today.  It was originally developed by James Gosling at Sun Microsystems (which has since merged into Oracle Corporation).  Originally called OAK, it was designed for handheld devices and set-top boxes.  Because OAK was unsuccessful, in 1995, Sun changed the name to Java, modified it to take advantage of the burgeoning World Wide Web, and released it as both a language and a platform.

The Java language is general-purpose, concurrent, class-based, and object-oriented.  It derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities. Java is network-savvy, reasonably robust, fairly secure, portable, architecture neutral, multithreaded, and generally high-performance .  Its applications are typically compiled to bytecode that is intepreted, at runtime, by a Java Virtual Machine (JVM) into machine code for the particular CPU the application is running on.   End-users commonly use a Java Runtime Environment (JRE) installed on their own machine for standalone Java applications, or a web browser for Java applets.

One variant of the "Hello World" code snippet for Java is shown below:

class HelloWorldApp {
    public static void main(String[] args) {
        System.out.println("Hello World!"); // Display the string.
    }
}

A "Hello World" Java applet might look something like:

// Hello.java
import javax.swing.JApplet;
import java.awt.Graphics;

public class Hello extends JApplet {
    public void paintComponent(final Graphics g) {
        g.drawString("Hello, world!", 65, 95);
    }
}


Tuesday, February 21, 2012

TIOBE Programming Community Index

The TIOBE Programming Community Index is an indicator of the popularity of programming languages. The ratings are based on the number of skilled engineers world-wide, courses and third party vendors. The popular search engines Google, Bing, Yahoo!, Wikipedia, Amazon, YouTube and Baidu are used to calculate the ratings.  Note that he TIOBE index is not about the best programming language or the language in which most lines of code have been written.


In order to count as a programming language for the TIOBE index, there are two criteria:
  • The language should have an own entry on Wikipedia and it should clearly state that it concerns a programming language.
  • The programming language should be Turing complete.  In practice, this is typically satisfied by having, at a minimum, conditional branching (e.g., an "if" and "goto" statement) and the ability to change arbitrary memory locations (e.g., having variables).  


The top 100 programming languages (and numerical index result for first 50) for February, 2012, are listed below:

1.   Java     (17.050%)
2.   C     (16.523%)
3.   C#     (8.653%)
4.   C++  (7.853%)
5.   Objective-C  (7.062%)
6.   PHP  (5.641%)
7. (Visual) Basic  (4.315%)
8. Python  (3.148%)
9. Perl  (2.931%)
10. JavaScript  (2.465%)
11. Delphi/Object Pascal  (1.964%)
12. Ruby  (1.558%)
13. Lisp  (0.905%)
14. Transact-SQL  (0.846%)
15. Pascal  (0.813%)
16. Visual Basic .NET  (0.796%)
17. PL/SQL  (0.792%)
18. Logo  (0.677%)
19. Ada  (0.632%)
20. R  (0.623%)
21.  Lua     (0.527%)
22.  Fortran     (0.524%)
23.  NXT-G     (0.522%)
24.  Assembly     (0.520%)
25.  C shell     (0.512%)
26.  MATLAB     (0.493%)
27.  Scheme     (0.432%)
28.  Groovy     (0.414%)
29.  RPG (OS/400)     (0.405%)
30.  Prolog     (0.391%)
31.  Erlang     (0.367%)
32.  ActionScript     (0.365%)
33.  F#     (0.359%)
34.  COBOL     (0.355%)
35.  Scratch     (0.354%)
36.  ABAP     (0.335%)
37.  Forth     (0.318%)
38.  cg     (0.316%)
39.  PL/I     (0.314%)
40.  D     (0.302%)
41.  ML     (0.297%)
42.  Haskell     (0.293%)
43.  Standard ML     (0.280%)
44.  CFML     (0.278%)
45.  Go     (0.277%)
46.  OpenEdge ABL     (0.270%)
47.  APL     (0.269%)
48.  Smalltalk     (0.267%)
49.  Q     (0.260%)
50.  Tcl     (0.254%)
51.  (Visual) FoxPro
52.  ABC
53.  Algol
54.  Alice
55.  Awk
56.  Bash
57.  bc
58.  BETA
59.  BlitzMax
60.  Boo
61.  Bourne shell
62.  C++/CLI
63.  CL (OS/400)
64.  Clean
65.  Clojure
66.  cT
67.  Dart
68.  Dylan
69.  Eiffel
70.  Euphoria
71.  Factor
72.  Icon
73.  Inform
74.  Io
75.  J
76.  JScript.NET
77.  Korn shell
78.  LabVIEW
79.  LabWindows/CVI
80.  Ladder Logic
81.  Lingo
82.  Max/MSP
83.  Modula-2
84.  MUMPS
85.  NATURAL
86.  Oberon
87.  Occam
88.  OpenCL
89.  Oz
90.  PILOT
91.  PowerShell
92.  Revolution
93.  REXX
94.  S
95.  S-PLUS
96.  SAS
97.  Scala
98.  VBScript
99.  VHDL
100. Z shell


Saturday, November 13, 2010

C++


The C++ programming language was developed by Bjarne Stroustrup, from Bell labs, in the early 1980s.  As a language, it supports object oriented programming, yet shares a lot of syntax with and is backward compatible with the popular C language developed by Dennis Ritchie.  Originally called "C with Classes," it was renamed C++ in 1983 (this name was based on the fact that ++ is the increment operator in C).  Although the language began as enhancements to C, C++ is a language with its own personality -- don't mistake it as just a newer version of C. C++ was standardized as ISO/IEC 14882 in 1998 and that standard was updated in 2003.  The next version of the C++ standard, known unofficially as C++0x (pronounced "cee plus plus oh ex"), is still under development.

The standard "Hello World" program in C++ looks something like this:

// hello world code snippet
#include <iostream>
using namespace std;
int main () {
     cout >> "Hello, World!";
     return 0;
}

The "//" preceding the first line makes it a C++ comment line.  The second line tells the C++ pre-processor to include the iostream basic standard input-output library.  All the elements of the standard C++ library are declared within what is called a namespace, the namespace with the name std. In order to access its functionality, then, on the third line, we declare that we will be using these entities.  As in C, every C++ program must contain a function named main.  Within the main function, we invoke "cout" to insert the "Hello World" stream into the C++ standard output stream.  As it is standard practice to return a value at the completion of every C++ function, we return 0 as a common return code to indicate that our main function returned without errors.

Friday, October 15, 2010

K&R: Where It All Began (C)


While small test programs existed since the development of programmable computers, the tradition of using the phrase "Hello world!" as a test message was influenced by an example program in the well-known book The C Programming Language, written by Brian Kernighan and Dennis Ritchie, and often referred to as simply K&R. The example program from that book prints "hello, world" (without capital letters or exclamation mark), and was inherited from a 1974 Bell Laboratories internal memorandum by Brian Kernighan, Programming in C: A Tutorial, which contains the first known version:

main( ) {
printf("hello, world");
}



The first known instance of the usage of the words "hello" and "world" together in computer literature occurred earlier, in Kernighan's 1972 Tutorial Introduction to the Language B, with the following code:

main( ) {
extrn a, b, c;
putchar(a); putchar(b); putchar(c); putchar('!*n');
}
a 'hell';
b 'o, w';
c 'orld';