1) Introduction Lesson

Programming Paradigms

5 min to complete · By Martin Breuss

In Python 101, you wrote Python scripts that operated in a procedural way. This means that your code is executed from top to bottom and is a common way to write automation scripts, such as the ones you wrote before.

There are a few different ways to write programs that approach this challenge differently. Sometimes, these different ways are called programming paradigms and are often divided into the following three paradigms:

  • Procedural programming
  • Object-oriented programming
  • Functional programming

Some languages are designed to be written to primarily follow one of these paradigms. For example, Java is focused on the object-oriented paradigm, and Haskell focuses on functional programming.

Python is Different

Python makes writing code in any of these three paradigms relatively easy. This can be nice because it allows you to tackle challenges in different ways, but it can also muddy the waters and make it harder to understand what either of these paradigms is and when you would want to use one over another.

But Python is pragmatic, and this set of modules will introduce you to these paradigms and show you how to follow them using Python. This will give you a great start to learn a wide variety of other, more focused programming languages if you ever need to.

Procedural Programming Part Two

This course module will continue to focus on the procedural way of writing code. You'll write scripts with your code instructions, and Python will execute them from top to bottom.

However, it won't be a completely strict top-to-bottom. You've used loops before to run specific tasks multiple times, and you've used control flow logic to skip lines or jump to particular lines, depending on certain conditions.

Functions

In this course, you'll see additional ways that the flow of your program can be altered by introducing functions. Functions are a common and essential aspect of programming. However, just because you'll learn to write functions doesn't mean you're doing functional programming yet. You'll learn more about functional programming towards the end of the course.

Strap on your learning boots and crack your knuckles. This second module on procedural programming in Python packs a punch, and by the end, you'll have a good working understanding of Python. This module will fill your Python knowledge so you'll feel as if you've gotten to know both snakes that make up the Python logo:

alt

After finishing this module, you'll know how to tackle almost any challenge you can handle with programming in Python. Your code will be less effective and might not be the most elegant yet, but it'll work and get the job done. You will need to understand everything happening, but you'll know how to use Python to solve puzzles and build solutions.

Beyond this module, you'll dive deeper and keep pulling off more layers to better understand programming in general and the Python language specifically.

Summary: Programming Paradigms

  • Some programming languages are designed to be written following one specific paradigm.
  • Python can implement all 3 programming paradigms

Programming Paradigms

  • Procedural programming
  • Object-oriented programming
  • Functional programming