Hello World.

What to write in the first entry of a new blog?

I could write what this blog is about, software development. But the first thing a software developer writes in a new language is a hello-world-program. So lets write a hello world program in not only one but many languages.

When I started programming in 1995, my first programming language was Pascal. Because I don’t have a working version of Turbo Pascal 6.0 anymore, lets use Lazarus as a Free Pascal IDE.
The program would look like the following and just write a “hello world!” to the console.

program helloworld; begin WriteLn(‘hello world’); end.

Later I moved to Delphi and the object oriented version of Pascal. The program grows a little, but you also get a nice GUI. I always see Pascal as a middle way between C/C++ and Java, because C/C++ separates in header and implementation files, Java has only public keywords and Delphi has the separation in one file with the interface and the implementation section.

unit mainunit;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;

type

  { TMainForm }

  TMainForm = class(TForm)
    CloseButton: TButton;
    HelloWorldLabel: TLabel;
    procedure CloseButtonClick(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  MainForm: TMainForm;

implementation

{$R *.lfm}

{ TMainForm }

procedure TMainForm.CloseButtonClick(Sender: TObject);
begin
  Close;
end;

end.

Screenshot from the GUI of the hello-world-program with LazarusI cannot remember the year I started with Delphi, but in 1997 I wrote my first website and short after that, started with PHP. My first PHP project was a kind of blog engine called logbook, which I used quit a while. It’s interesting to see how PHP developed from a simple script language to a full object oriented one. With PHP 7 even more static typing comes in, what I really like because for larger projects with more than one developer its much easier that way.

<?php
echo "Hello World.";

At the university I had to learn some C/C++, but I never really got to like it. So lets make this short, here is the hello-world-program.

#include "stdafx.h"

int main()
{
    printf("Hello World.");
    return 0;
}

Another language I learned while studding, was Java. One of the first projects was a contest called “The way out” (2002), where you had to write an algorithm to steer a spaceship. Back then I did not use an IDE, but notepad for editing and batch files for compiling and executing. Nowadays I just use Eclipse for that.

package de.fxworld.helloworld;

public class HelloWorldProgram {

    public static void main(String[] args) {
        System.out.println("Hello World.");
    }
}

The last language for today is C#. I wanted to have a look at C# and a Microsoft contest was a good opportunity. I did not win the contest, but liked the language. Java is still my preferred language, but this is more because of the many free libraries and tools.

using System;

namespace HelloWorldApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            System.Console.WriteLine("Hello World!");
        }
    }
}

So that are enough hello-world-programs for today. I hope you liked it and stay tuned for the next blog entry.

Leave a Reply