DEV Community

Ruben
Ruben

Posted on

Hello World: Starting with programming

Hello World. The lorem ipsum of programming. The first thing people do when learning a new language. Where a new journey starts. But there is a big question with learning a new language, and that is: β€œWhere do I start?”

Answering that question can be tough, especially when you don't wanna spend a lot of money. A simple Hello World program doesn't get you too far, and it really only teaches you the very basics.

Consider this code:

#include <iostream>
int main() {
    std::cout << "Hello World" << std::endl;
    return 0;
}

This is Hello World in C++. As you might see, it's a very basic program. What you learn from this is that std::cout << "" << std::endl; prints text. However, you don't learn much more, not even what std::cout really does, nor what std::endl does, except for ending the print.

At this point, you might ask yourself: "Well, how do I learn more? Hows does stuff work?" As with everything else, you have to read or do exercises to learn more. The best method of learning varies from person to person. For me, doing interactive tutorials helps me the most, but when it comes to languages like C++, it's not that easy to find free tutorials. Personally, I really enjoy Codecademy for learning, and they have a C++ course, but it's not too in depth, making it hard to get far in the language.

If you prefer reading instead of doing interactive tutorials, I would highly recommend GoalKicker, which has a bunch of very nice programming books.

Another thing I really like doing is the "Just Do It" method, where you play around with the little you know, and Google the things you don't know, until you get the program to work. Together with the GoalKicker books, it makes for a pretty nice experience with programming.

After messing around with the language for a bit, you'll eventually learn the insides of the Hello World program:

#include <iostream> // imports the "iostream" header, which allows for input and output, hence the *io*i, literally means input/output stream

int main() { // the main function, returns an integer, which is the exit code. 0 means success, everything else means error.
    std::cout << "Hello World" << std::endl; // cout prints using the "<<" operator, "Hello World" is the output text, which could also be a variable, and std::endl is an alias for '\n', the newline operator.
    return 0; // program succeeded
}

Learning programming can be quite challenging, but like everything else, you will eventually catch the rhythm and get good. My advice to beginners to programming is to start easy, with a language like Python or Node.JS to learn the basics of programming, then moving on to a more challenging language, like C++.

Having an understanding of a programming language is key to good code. Knowing what's better to use, what does what and what works and doesn't work is key to coding. Sure, you don't necessarily need to know all of these to write functional code, but if you want it to work nice and stable, you'll need to have knowledge of this.

Starting to learn programming is exciting and can feel scary, but can be really rewarding when you do it right. Programming is an experience which can really put a light on how a lot of technology works. You can get curious about how stuff works and how stuff used to work, and you might even get curious about how people programmed in the past, and get to know about well known programmers and maybe also people who made their own programming languages and became famous for it. And who knows, maybe you will be one of those people one day.

Follow your dreams and aim high, one day you might become known for your works.

Top comments (0)