How to start programming any language easy and fast
So you want to try a new programming language and don’t know how to start, what to install nor which language to choose. Worry no more. This tutorial is designed to enable you a fast and easy start for any new project or computer idea you might have.
Note: this is the basic tutorial for every other programming project in this website. Therefore, if you’d like to repeat my steps in another tutorial, this is the way to begin.
Install Docker
Install Docker on Linux
- open the linux terminal (try Ctrl + Alt + T or look for it in the search bar)
-
type the following commands:
❯ sudo apt-get update ❯ sudo apt-get install docker-ce docker-ce-cli containerd.io
- for detailed instructions, refer to the official docker engine installation guide.
Install Docker on MacOS
- download Docker Desktop (Stable) for MacOS clicking here.
- once it is downloaded, look for
Docker.dmg
file on Finder and click on it. - for detailed instructions, refer to the official documentation.
Install Docker on Windows
- download Docker Desktop (Stable) for Windows clicking here.
- once it is downloaded, run the installer
Docker Desktop Installer.exe
file. You may need to restart your PC. - for detailed instructions, refer to the official documentation.
Install Visual Studio Code
Install Visual Studio Code on Linux
- open the linux terminal (try Ctrl + Alt + T or look for it in the search bar)
-
install using snap
❯ sudo snap install --classic code # or code-insiders
- if you saw errors, make sure you have
snapd
installed- some Linux distributions don’t come with it pre-installed. If that’s your case, click here to go to the installation page and look for your distribution.
- if you find any problems, look the official Linux install guide.
Install Visual Studio Code on MacOS
- download Visual Studio Code for macOS clicking here.
- open Finder and type
Visual Studio Code
on the search bar. - drag
Visual Studio Code.app
to theApplications
folder, making it available in the macOS Launchpad. - add vscode to your Dock by right-clicking on the icon to bring up the context menu and choosing Options, Keep in Dock.
- if you find any problems, look the official MacOS install guide.
Install Visual Studio Code on Windows
- download Visual Studio Code for Windows clicking here.
- once it is downloaded, run the installer (click on the
.exe
file). - vscode is by default installed at
C:\users\{username}\AppData\Local\Programs\Microsoft vscode
- if you find any problems, look the official Windows install guide.
Install Remote Development extension pack
With Docker and Visual Studio Code installed, we just need the Remote Development vscode extension. Click on the link below to go to the download page.
link to remote development extension
Start a new python project
- click on the new symbol in the lower left corner. A dropdown list of options will appear.
- select Remote-Containers: Try a Sample… from the command list. A list of the available languages will be shown.
- choose Python. The screen will blink and start downloading the images to start your project.
- this step may take from 5 to 15 minutes. Wait for it to finish.
- after the download is over, on vscode, an workspace will be created with the project files.
- if you have any doubts, check the video below to see each step exactly.
video: title: "create vscode python project": ./videos/python.mov
Explaining the vscode-remote-try-python
files
Below you’ll find some explanations about all the project files. If you’re just beginning or new to python, focus on the .py
file and don’t worry much about the others. Any important files ones will be highlighted or emphasized.
devcontainer.json
and an optional
Dockerfile
or docker-compose.yml
to create the development containers.
devcontainer.json
. It can also modify some configurations of the Dockerfile, as for this project, the Python
version is redefined to 3.7 with the VARIANT arg. This file also contains settings
for the Visual Studio Code environment.
How to run your vscode-remote-try-python
project
- Open the vscode terminal window. Notice it is already connected to the docker container.
- In the terminal, type the command below to run the app.
python -m flask run --port 9000 --no-debugger --no-reload
- Open your browser (Safari, Edge, Firefox, Chrome, Opera, …) and go to http://localhost:9000 to see the running app.
Start a new javascript project
- Click on the new symbol in the lower left corner. A dropdown list of options will appear.
- Select Remote-Containers: Try a Sample… from the command list. A list of the available languages will be shown.
- Choose Node. The screen will blink and start downloading the images to start your project.
- This step may take from 5 to 15 minutes. Wait for it to finish.
- After the download is over, on vscode, an workspace will be created with the project files.
- If you have any doubts, check the video below to see each step exactly.
video: title: "create vscode node project": ./videos/node.mov
Explaining the vscode-remote-try-node
files
Below you’ll find some explanations about all the project files. If you’re just beginning or new to javascript, focus on the .js
file and don’t worry much about the others. Any important files ones will be highlighted or emphasized.
devcontainer.json
and an optional
Dockerfile
or docker-compose.yml
to create the development containers.
devcontainer.json
. It can also modify some configurations of the Dockerfile. This file also contains settings
for the Visual Studio Code environment.
devcontainer.json
to
assemble a docker image.
Then a container is created and started using some of the settings in devcontainer.json
.
package.json
.
How to run your vscode-remote-try-node
project
- Press F5 to launch the app in the container. The file
launch.json
has configured vscode how to start it. It will be started in debugging mode. - Open your browser (Safari, Edge, Firefox, Chrome, Opera, …) and go to http://localhost:9000 to see the running app.
Start a new C# .NET Core project
- Click on the new symbol in the lower left corner. A dropdown list of options will appear.
- Select Remote-Containers: Try a Sample… from the command list. A list of the available languages will be shown.
- Choose .NET Core. The screen will blink and start downloading the images to start your project.
- This step may take from 5 to 15 minutes. Wait for it to finish.
- After the download is over, on vscode, an workspace will be created with the project files.
- If you have any doubts, check the video below to see each step exactly.
video: title: "create vscode dotnetcore project": ./videos/dotnetcore.mov
Explaining the vscode-remote-try-dotnetcore
files
Below you’ll find some explanations about all the project files. If you’re just beginning or new to C#, focus on the .cs
file and don’t worry much about the others. Any important files will be highlighted or emphasized.
devcontainer.json
and an optional
Dockerfile
or docker-compose.yml
to create the development containers.
devcontainer.json
. It can also modify some configurations of the Dockerfile. This file also contains settings
for the Visual Studio Code environment.
devcontainer.json
to
assemble a docker image.
Then a container is created and started using some of the settings in devcontainer.json
.
launch.json
for instance. In our case, the tasks build
, publish
and watch
are defined in this file. The build
task is then referenced in launch.json
.
appsettings.json
for the Development build.
appsettings.json
and appsettings.Development.json
for the Https channel in Development build.
How to run your vscode-remote-try-dotnetcore
project
- Press F5 to launch the app in the container. The file
launch.json
has configured vscode how to start it. It will be started in debugging mode. - Open your browser (Safari, Edge, Firefox, Chrome, Opera, …) and go to http://localhost:5000 to see the running app.
Conclusions
In this tutorial, we learned how to start a new project from a variety of languages easily. For that, we installed the Docker container platform, the Visual Studio Code Editor and the Remote Development vscode extension. These tools are useful if you are starting a new project or want to start learning a new programming language. A few remarks and observations are listed below about this approach.
- Simplicity:
- simple installation previous to coding.
- we can try another language in vscode just by repeating the same steps.
- we didn’t face any of the “headaches” that beginners suffer when trying a new language.
- Security:
- Docker creates a safety layer. Therefore, you can play and try anything you want without worrying about damaging anything in your computer.
- Containerization:
- Docker: It will always work in your machine!
- No virtual environments. The Docker container works as one.
- We don’t need to download vscode extensions for each language. vscode server installs all the necessary extensions automatically based on the language you choose.
- Disadvantages:
- Startup: the first time you start your application will be slow, as vscode has to download and build the Docker images. P.S.: I know I wrote fast in the title, but I am considering the amount of time the average person would have troubleshooting everything that could go wrong with installing each language, especially beginners.
- Memory: Docker containers add some overhead to MacOS and Windows applications, but usually you won’t notice that. Look at Docker Desktop for more info about your containers.
- Absolute Beginners: If you are just starting to learn how to program, some of the steps could come as difficult, especially the Docker part. As I said before, try not to worry too much about it: you’ll see that a lot of things in programming mix different technologies and I believe it’s important to get used to it from the start.
Happy Coding! 🧑🏻‍💻
Further Reading
Microsoft has all the process of Setting the Container Development in vscode and Developing inside a Container well documented. It’s definitely worth checking it out.