What are the programming languages in general? They are nothing more than a set of semantic and syntactic rules like normal languages. The only difference is that they describe how to build proper instructions that will produce a proper application. They are directions for both the user and the computer. The language specifies how the computer should understand certain instructions.

As there are many languages, there are many techniques for programming. How to group them into categories? You have certainly come across the term "programming paradigm". What does it mean? To take it in a simple term – it is a style of programming. More precisely, it is a set of techniques used to create a program and the definition of how a computer executes it. Paradigms are the way to categorize programming languages based on what type of techniques they support. Different languages can be based on a single or support many paradigms. Let's see what the 5 most popular paradigms are.

Imperative Programming Paradigm

It is the paradigm corresponding to the oldest programming techniques. It’s also the most basic one. According to the philosophy of this paradigm, code is just a series of instructions that change the state of the machine. For example, defining the variable changes the state of registries as well as memory and so the state of the whole computer. The machine just executes commands, nothing more. Essentially, you describe to the computer what to do, not what you want to achieve. This paradigm is strictly connected to von Neumann computer architecture. Most of the common programming languages are imperative.

You can use the languages within this paradigm for creating the logic of the app. Validation of data or execution of mathematical algorithms is only some of the tasks that are suitable for this paradigm.

Imperative Programming Language Example: JavaScript

popular programming languages - JavaScript

One of the many languages that implement this paradigm is JavaScript, as you can express the JS program as a series of instructions for the machine. The syntax is much like this known from C language, but the first big difference is automatic semicolon insertion. This feature allows omitting semicolons at the end of lines. Here you can find a sample of JS code:

function fun() {
  var thisIsVariable = 8

  var alsoAVariable = "Hi!"

  thisIsVariable = true


  if (thisIsVariable) {
    var now = new Date()

    today =  now.getDate() + "/" + (now.getMonth() + 1) + 
    "/" + now.getFullYear()


JS alongside HTML and CSS is one of the core technologies in the field of creating web apps. Mainly, because you can easily execute it in a web browser. It can also be used in some server-side tasks thanks to Node.js. In the case of web apps, it is usually responsible for page behavior, including animations and responding to user interactions. It also has several APIs that allow working with data structures, regular expression, and text. On the other hand, JS does not provide any input or output API by itself.

Besides web applications, you can also implement software for many other platforms like desktop, mobile or embedded with JavaScript. Frameworks such as Felgo SDK use JavaScript for scripting logic of your application.

In the case of basic concepts, there are several things to know. First of all, JS is weakly typed. It is also dynamically typed which allows you to use techniques like Duck Typing. Although it implements an imperative paradigm, it also supports an object-oriented programming paradigm. You will find out more about this paradigm later on this post.

Declarative Programming Paradigm

This paradigm is the opposite of imperative programming. In this case, you describe what you want to achieve and not how. The programmer does not control the flow. You express the logic by declaring the outcome. One of the strong sides of declarative programming is that it streamlines the creation of parallel apps.

There are several use cases of declarative programming. For instance, database query languages are implementing this paradigm. On the other hand, frontend is also a very good field for declarative programming to shine. 

Declarative Programming Language Example: QML

popular programming languages - QML - Hot Reload

The best example of a language that follows this paradigm is QML. In this language, the code is based on objects containing several parameters describing them – it looks similar to JSON format. Below, you can see an example:

import Felgo 3.0
import QtQuick 2.5

App {
  id: app

  NavigationStack {
    Page {
      title: "Hi!"
      AppText {
        anchors.centerIn: parent
        text: "Hello Felgo"
    } // Page
  } // NavigationStack
} // App

You can organize the items in QML in a tree structure. This parenting system allows items to communicate in both ways. As you saw in the example above, you use this mechanism in the “anchors.centerIn: parent” line, which allows you to position text in the center of the page. One of the very handy features of this language is that it allows property bindings. The properties of your objects can automatically update according to changes occurring in other parts of the application. This helps to keep your state across different components consistent. You also do not have to worry about updating different parts of the UI if some value changes. 

QML is also a great choice when it comes to fluid animations. The state's system greatly simplifies the way of handling the UI changes. It also allows you to automatically execute animations when you change the properties.

QML is internally translated to C++. Thanks to this, it’s very efficient. It also allows your code to run on various platforms, like desktop, mobile or embedded.

Any language cannot do without some way of declaring functions. That is why QML allows declaring JavaScript functions within its code to handle imperative aspects and implement some more advanced behavior. You can also write JS code in-line.

Thanks to JS, you have access to many functionalities of this mature language while using QML. All of it with the knowledge that you already have! This greatly simplifies the process of creating a responsive user interface and providing an excellent user experience.

Learn how to code with QML, Qt and Felgo. Consult with out experts today!

Object-oriented Programming Paradigm

Object-oriented programming is probably one of the most popular programming paradigms. It is based on organizing application elements around the data by defining the application as a set of objects. Each of them contains parts of necessary data as member variables and methods . Then, the object executes the data. This approach has several advantages: it helps to provide code reusability, data security, and scalability.

There are four main principles of object-oriented programming:

  • Encapsulation – Access to objects variables and methods should be restricted in a way that only necessary data is available for other objects to use. This ensures that data is secure, and the chance of data corruption is reduced.
  • Abstraction – Objects are hiding any unnecessary implementation code. The example of following this principle is creating getters and setters.
  • Inheritance – Sub-classes containing logic of parent class can be created. It greatly improves code reusability.
  • Polymorphism – Objects can be interpreted differently according to the context. 

Object-oriented programming is commonly used when creating complex applications. 

Object-Oriented Programming Language Example: C++

popular programming languages - C++

The use examples are very diverse: server-side applications, games, and even operating systems. The most known language implementing this pattern in C++. Below some sample code to refresh your knowledge:


class Board {
	string name;
	int size;
	char color;
	Board(string name);

	Dice* basicDice;	

	void info() {
		cout << name << endl;
		cout << size << endl;
		cout << color << endl;
		cout << basicDice->roll() << endl;


This language is famous for its high performance and being able to access low-level device memory. Thanks to code portability, you can also easily execute it on embedded devices. Over the years, C++ was significantly improved, by adding a lot of new functionalities like smart pointers.

You can integrate the C++ components into QML code. In this way, the application can execute any heavy computation tasks using the performance of C++. 

Functional Programming Paradigm

Functional programming is a variant of declarative programming. In this case, you interpret the application as a complex mathematical function. It takes the specified input parameters and returns the result after processing. In some languages that implement this paradigm, there is no such thing as a variable, as the state of the machine is not taken into consideration. However, this approach is not as popular. Usually, languages implement other paradigms alongside functional programming. You can use the functional programming paradigm in machine learning, modeling of speech, computer vision, etc.

Functional Programming Language Example: Python

popular programming languages  - Python

Python, one of the most popular programming languages, implements a functional paradigm. The creators of Python focused on making the code as clear as possible. The first thing that catches an eye while looking at Python code is the lack of brackets. You can see it by yourself:

def qsort(L):
    if L == []:
        return []
    return (
        qsort([x for x in L[1:] if x < L[0]])
        + L[0:1]
        + qsort([x for x in L[1:] if x >= L[0]])


As in the case of JS, python is dynamically typed. It also provides a garbage collector which is a common feature of high-level programming languages. Python is prized for its universal standard library.

Structured Programming Paradigm

A structured programming paradigm - also called modular - is an approach that has its roots in imperative programming. The main idea of this approach is to create a program as a set of separated modules. The paradigm focuses more on the process itself rather than the required data. You should create every module, which is usually a self-contained function, in a way that allows you to reuse it while maintaining them clean and readable. Just like with imperative programming, you can execute the instructions one after another. There is no support for instructions like infamous GOTO, which causes the creation of spaghetti code. Structural programming also encourages you to create code in a top-down approach. You start with the most complex block and adding details later. Structured programming is quite popular in microservices and selected embedded systems.

Structural Programming Language Example: C

popular programming languages -C

As already mentioned, many languages use multiple paradigms. Such an example is C language, which had its first release in 1972. It combines aspects of imperative and procedural approaches. You can also implement mechanisms in C and use them in modern languages including Java, JavaScript, C++, and many others. 

Nowadays languages are much more convenient to use. Also, efficiency is the key advantage of C language. Thanks to that, you can use this language for low-performance devices such as microcontrollers and other embedded systems.

What about some more code examples? Here you can find some code written in top-down implementation:

struct Rectangle
    int a;
    int b;
    int surface;

// you pass parameter either by value or by pointer
int calculateSurface(struct Rectangle *rec);
void printRectangleDetails(struct Rectangle rec);

int main()
    printf("Hello, World!\n");
    struct Rectangle rec;
    rec.a = 4;
    rec.b = 3;

    return 0;

int calculateSurface(struct Rectangle *rec) 
    const int surface = rec->a * rec->b;
    rec->surface = surface;
    return surface;

void printRectangleDetails(struct Rectangle rec)
    printf("Rectangle's surface side: %d\n", rec.surface);


Paradigms presented in this post are not the only ones you can find. There are as many flavors of programming as there are languages. By learning about the most popular paradigms, you now know that in which cases you can use them and what languages implement them.

You also learned that you can mix some of the paradigms in the case of single languages. You can achieve the same by using two different languages in one program – like with QML and JavaScript. Using them together is a great way to provide every functionality that you need in the app. You can also utilize the knowledge that you already have very well. You can try to do it with Felgo, as the apps using this framework are based on QML code so the JS functions are also supported. 

If you want to build your first mobile and cross-platform app, Felgo is a way to go. It is not only a framework for adding some objects but is also a whole set of tools. You can reload code instantly with QML Hot Reload or test your app wirelessly with Live Server. Just download the SDK with the button below!

If you want to learn more from the experts simply sign up for our training session or watch own of our webinars. Felgo offers tailored Qt training and workshops, so you get the most value and customized experience. You can also hire one of our experts if you are looking for an experienced team that uses the latest technologies to develop beautiful and performant apps.

Download Felgo



Related Articles:

QML Tutorial for Beginners

3 Practical App Development Video Tutorials

Best Practices of Cross-Platform App Development on Mobile


More Posts Like This

Flutter, React Native & Felgo: The App Framework Comparison

Continuous Integration and Delivery (CI/CD) for Qt and Felgo

qml-hot-reload-with-felgo-live-for-qt (1)

QML Hot Reload for Qt - Felgo