Skip to main content

Putting it all together

Preamble#

If you've followed the tutorial so far, you have a basic understanding fo what is terminal, a CVS, an IDE and have set up git, GitHub and VSCode. You are more than ready to link it all together and come closer to a real dev experience. What we'll do will provide you with a playground project you can use for experimentations in the future.

As of now you might never have written actual code in a file, only commands in the terminal. Let's remedy that right away.

In the next chapter we will see how to choose a programming language to start with but for now we will just code a "Hello, World!" program in some of the main programming languages out there, namely:

  • Powershell
  • Bash
  • HTML
  • Python
  • Javascript
  • C
  • C++
  • Java

If you don't want to try out some of these just skip them. There is a video for reference down below in any case.

The "Hello, World!" program

From Wikipedia :

"A 'Hello, World!' program generally is a computer program that outputs or displays the message "Hello, World!". Such a program is very simple in most programming languages, and is often used to illustrate the basic syntax of a programming language. It is often the first program written by people learning to code. It can also be used as a sanity test to make sure that computer software intended to compile or run source code is correctly installed, and that the operator understands how to use it."

Read more about it here

We'll do that in these few steps:

  1. Create a GitHub repository.
  2. Clone it locally with a git command.
  3. Create a source file in a language.
  4. Compile, run or open the file (how we do that will depend on the language).
  5. Stage the file and commit.
  6. Repeat Step 3, 4 and 5 for each language.
  7. Push our commits to the remote repository on GitHub.
  8. Celebrate!

We will all of this via the GitHub website for Step 1 and on VSCode or a terminal for the rest.

info

The point of all this is not to learn the syntax of a particular language nor understanding what you will write. Rather, the goal is to make apparent some the basic steps that constitutes coding, namely :
Setting up project โ†’ Writing code โ†’ Testing your code โ†’ Staging/Commiting/Pushing your changes

With that in mind, here we go ๐Ÿ’ƒ

Let's do it#

Setting up the git project#

  1. On GitHub, create a new repository.
  2. Clone the repository locally (on your computer). If you haven't set up SSH yet, follow this tutorial.
  3. Open the newly created folder in VSCode and you're set for the next part.

Writing and executing the code#

Scripting languages#

Powershell
hello_world.ps1
Write-Output "Hello, World!"
Bash
hello-world.sh
echo 'Hello, World!'
Python
Javascript

Markup languages#

HTML
hello-world.html
<p>Hello, World!</p>

Compiled languages#

C
Windows
MacOS
  • Check if you have the clang C/C++ compiler by executing the command clang --version; if you see a version, you have it.
  • If you don't :
  1. Download xcode from the app store
  2. Run the xcode installer.
  3. Open up xcode go to XCode >> Preferences >> Downloads >> Command Line Tools and click install.
Linux
C++
hello-world.cpp
#include <iostream>
using namespace std;
int main(){    cout << "Hello, World!" << endl;}

Interpreted languages#

Java
HelloWorld.java
class HelloWorld {  public static void main(String args[]){    System.out.println("Hello, World!");
  }}

A video for reference#

Here is a video that shows all the steps. Note that I use the Code Runner extension for VSCode, so that I don't have to write my execution commands.

Concluding remarks#

Well done, now you are ready to go learn actual programming. I hope you have noted that these languages share similarities. That is a reason why if you know one programming language it is relatively easy to learn another (all depending on how similar they are ofc).
We'll see in the next section which language you should pick as the first one.
I would like before you move on, that whatever you choose to learn, whenever you code, remember to version your work by staging/commiting/pushing your work. This way you will have automatisms for when you wish to collaborate and will never loose code. Here is a short article on when to commit.