This post is an answer I gave to a student on my Udemy course: Build your own Backend using Django REST Framework.
A summary of the question was: What is the difference between single page and traditional websites, and which language should I learn for each one.
Here is my answer below:
That is a great question and unfortunately there is no straightforward answer because there are so many languages to learn and pros/cons to consider.
However, I’ll do my best to answer your question to help guide you to a decision.
Before you decide which language to learn, you need to understand the difference between Traditional and Single Page Application websites.
These websites refresh each time you click a link to navigate around them. Any custom logic (like retrieving data from a database, validating credentials, processing input) is done on the server and a response is returned using HTML which is then displayed to the user in the browser. They are ideal for sites like blogs as they offer better SEO and provide a more familiar layout for users (although this is starting to change).
An example of a traditional website is our blog: http://www.londonappdeveloper.com/
To create traditional websites, you can use languages such as PHP, Python or Ruby (not an exhaustive list). PHP is primarily designed for making websites and Python/Ruby are both scripting languages that typically run on a back-end server and can be used to build anything from data processing scripts to complex websites using various framework (such as Django for Python).
Personally, I have used both PHP and Python (with Django) to build websites. Some of the reasons I prefer Python are as follows:
- I find the code easier to read.
- I find it easier to debug.
- I like the that it’s easy to install and use third party packages.
- I can use it for multiple back-end server tasks.
Single Page Applications
These are more modern applications and are sometimes referred to as web apps.
They provide a better user experience for certain types of app as they are faster, more efficient and even allow for offline access if setup correct (a good example of this is Google Drive web app: https://drive.google.com/).
Unlike traditional websites, Single Page Apps load in the browser and interface with a REST API in order to perform actions like retrieving data from a database, validating credentials, processing input, etc. This back-end REST API component is what is being taught in this course with the intention that it could be used as the back-end to a single page application or mobile app.
I have used both Angular and ReactJS and I prefer React mostly because it can be used to build both web apps and native mobile apps (I have a video where I explain my opinions here: https://youtu.be/isSpFbN8xkw).
Deciding What to Learn
There is no clear right or wrong answer to which language to learn. It depends primarily on your goals and what types of applications you hope to build.
In the end a lot of it comes down to personal preference and project requirements. My advice would be to experiment with different languages to build some websites/apps to get a feel for which one you enjoy working with.