Traditional vs Single Page websites
, ,

Traditional vs Single Page websites and which language to learn

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.

Traditional Websites

These are the traditional types of websites that are rendered in the browser using HTML (and optionally JavaScript).

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:

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 are written using JavaScript which runs in the browser. When the user navigates around the application, only the required parts of the interface update (the whole page does not refresh).

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:

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.

However, you could also build a back-end REST API in JavaScript using Node.JS if you only wanted to learn one language (JavaScript is the only language that can be used to build server, browser and mobile apps). However you would still need to learn a back-end and front-end framework which can sometimes be just as challenging as learning a completely different language.

Single page applications that run in the browser are always written in JavaScript, using a framework or library such as Angular, ReactJS or Vue.js (not an exhaustive list).

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:

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.

Personally, I like to use Python for the back-end as I can use it to build both traditional websites (using Django) and backend REST API’s (using Django REST Framework). I use JavaScript with the React.JS framework for the front-end as it allows me to build both browser and native mobile applications.

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.

1 reply
  1. Carlos Martinez
    Carlos Martinez says:

    Hi, nice post but (JavaScript is the only language that can be used to build server, browser and mobile apps)… Don’t agree with it, you could use only HTML with Cordova for example, or TypeScript and ReactJS, not only Javascript could by used to build server side, browser and app… Cheers from Venezuela!

    PD: Excuse my English!

Comments are closed.