“A "Hello World" program is a computer program which prints out "Hello, World!" on a display device. It is used in many introductory tutorials for teaching a programming language. Such a program is typically one of the simplest programs possible in most computer languages. It is often considered to be tradition among programmers for people attempting to learn a new programming language to write a "Hello World!" program as one of the first steps of learning that particular language.” Taken from: (http://en.wikipedia.org/wiki/Hello_world_program)
“Object-oriented programming (OOP) is a programming paradigm that uses "objects" – data structures consisting of datafields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction, encapsulation, modularity, polymorphism, and inheritance. Many modern programming languages now support OOP.” Taken from: (http://en.wikipedia.org/wiki/Object-oriented_programming)
If all the programming languages that target the CLR/JVM support Object Oriented Programming and the “Hello, World” program is the traditional way for start learning a new language, from today on, I will start posting an “OO Hello, World!” program using each of the languages listed in my second post. This will give you a basic taste on the language’s syntax and program structure.
It is very common to find "1 line hello world programs" in books or sites, especially if the language has dynamic support.
Python: print "Hello, World!"
Ruby: puts "Hello, World!"
F#: printfn "Hello, World!"
Of course you learn very little with such examples and that is why I decided to use the OO version.
So, what can you expect to find?
You will learn the basic structure of a console program, creating a class, defining a private data member, defining a method, creating an instance of an object and calling the method. Also if an statement is required by the language (or it won't compile) I will add it, otherwise I will omit it.
Here below the structure of the “Hello, World” program I will be using:
[Import / using / etc]
Class
Data
Constructor
Constructor
Method
Program
Instantiate Class
Call Method => OUTPUT (Hello, World!)
I will also give some info about the language and some links to more info and code samples if you are interested in the language.
Note: The code I will be using for my examples is the one in “A more sophisticated version using Object Orientation” located in Groovy’s website (http://groovy.codehaus.org/). Since it is exactly what I wanted to show, why not reusing code? :)
Bytes!
Hi there,
ReplyDeleteI'm still here, I love what are you doing with these posts of "Hello World", I guess if you preserve the intention this could be a very good library for any newcomer in the programming universe and for all us that are already in the dark side are very useful have a place with the basic features of all languajes.
@Pinkys
ReplyDeleteThat's exactly what I intent to do. To have a reference website for all the languages I mentioned on the "Most Active .NET and JVM Languages" so people can see and compare simple syntax structures between all those great languages.