Skip to content

Programming paradigms: how to pick a programming language that won’t get in your way

How languages can be categorized by their major features—and what paradigms are especially good at solving different kinds of problems.

Chazona Baum
Aug 12, 202315 min read1 read

Hi, I'm Chazona!

I love to build things and grow people

Currently I'm:

  • Raising my two sons
  • Heading Engineering at Untapped
  • Building a new type of online dating platform

Image: Headshot of Chazona smiling, wearing glasses and a blue shirt with butterfly print.

Let's start with a story...

Image: Two side-by-side family photos. On the left, a woman with brown curly hair kneels on a sidewalk with two young children drawing with chalk in the driveway. On the right, the same woman in a winter coat poses for a selfie with a young child also wearing a hooded coat.

This awesome lady is my mom. And when she was pursuing a criminal justice degree at John Jay College, she fell in love with a sailor.

And she crossed the ocean to follow him

Image: Aerial photograph of a Naples showing the bay, terracotta-roofed buildings, and Mount Vesuvius rising in the background.

She followed him all the way to Italy—Naples—which is where I was born. Dropped out of school and enlisted in the Navy herself.

Image: Street-art photograph of a black speech bubble painted on a textured blue-and-yellow wall. The text inside reads “LOVE IS THE ONLY LANGUAGE I SPEAK FLUENTLY.” attributed to TrustyScr1be.

It might be a tad impulsive to move to another country where everyone speaks a different language on a whim, all to follow a boy.

Now, this isn’t a story about how “love conquers language barriers”. My Puerto Rican mother landed in Italy knowing English and Spanish—this turned out to be a fortunate thing, because she discovered…

She discovered something interesting

Image: Screenshot from a Marvel Avengers film of man out of his own time, Captain America, saying “I understood that reference.”

She understood the people around her—well enough to have extensive conversations and to do most anything she needed. Over time she picked up new words and phrases, but she didn’t need to study another foreign language to hit the ground running and be productive with it.

| Español | Italiano | | --- | --- | | Estoy leyendo un buen libro. | Sto leggendo un buon libro. |

You see, this is because Spanish and Italian are similar enough for what’s called mutual intelligibility (at least partially). My mother would often actually translate what Italian speakers were saying to my father, who spoke both French and Haitian Creole.

We have a fairly simple example here—this means “I am reading a good book” in both languages.

polyglot 1 of 2 noun

pol·​y·​glot pä-lē-ˌglät

  1. one who is polyglot
  2. capitalized : a book containing versions of the same text in several languages
    especially : the Scriptures in several languages
  3. : a mixture or confusion of languages or nomenclatures

polyglot 2 of 2 adjective

  1. a : speaking or writing several languages : MULTILINGUAL
    b : composed of numerous linguistic groups
    | a polyglot population
  2. : containing matter in several languages
    | a polyglot sign
  3. : composed of elements from different languages
  4. : widely diverse (as in ethnic or cultural origins)
    | a polyglot cuisine

The common language-picking pipeline

The total newbie

Image: Screenshot of a YouTube search results page showing video thumbnails with titles like "What Programming Language Should I Learn First?", "Top Programming Languages in 2020", and "Top 5 Programming Languages to Learn in 2020 to Get a Job Without a College Degree."

The just finished a bootcamp

Image: A black cat appears to be typing on a MacBook laptop in a kitchen, with caption “THANK GOODNESS I TOOK THAT CODING COURSE.”

The grizzled, experienced developer

Image: Meme of a man in a blue polo shirt and sunglasses seated at a poker table. He casually reviews his hand and says “Perl.”

The polyglot developer

Image: Video still of a woman in a blue blouse speaking in a manufacturing facility, saying “We've got a lot of tools in our tool box”

So what is a programming paradigm?

paradigm noun

par·​a·​digm ˈper-ə-ˌdīm ˈpa-rə-, also -ˌdim

  1. : EXAMPLE, PATTERN
    especially : an outstandingly clear or typical example or archetype
    | ...regard science as the paradigm of true knowledge.
    — G.C.J. Midgley
  2. : an example of a conjugation or declension showing a word in all its inflectional forms
  3. : a philosophical and theoretical framework of a scientific school or discipline within which theories, laws, and generalizations and the experiments performed in support of them are formulated
    | the Freudian paradigm of psychoanalysis

Zen and the art of programming

Image: Scene from The Mandalorian showing armored Mandalorians with the caption ”This is the way.”

A brief overview of programming paradigms

In the days before there were choices

Image: Scene from The Princess Bride showing an older man in a hat and overcoat speaking to his sick grandson, informing “When I was your age, television was called books.”

Nonstructured programming was our earliest paradigm

goto label
...
IF condition THEN goto label

The most limited control flow

Image: Sheet music for a piece marked “Allegro” in 2/4 time, including segno marks, “to Coda”, “D.S. al Coda”, and a “Coda” section — illustrating non-linear control flow in music notation.

goto gave us spaghetti code before it was cool

Image: GIF still from Full House of preschool-aged Michelle Tanner at a dining table looking excitedly at a forkful of spaghetti, saying “Oh boy, spaghetti!”

What is this paradigm useful for?

Image: Screenshot from Talladega Nights the Ballad of Ricky Bobby of Michael Clark Duncan’s character in a red polo shirt with finger raised, shouting “Don't you put that evil on me!”

Nothing—all languages popularized during the nonstructured era have since added benefits we'll talk about shortly, and goto can still be used sparingly.

And David Wheeler said, ‘Let there be subroutines’; and there was structured programming. And programmers saw that the structured programming was good; and programmers separated the structured programming from the rampant use of goto.

Image: The quote is overlaid on a sunset cloudscape background.

The rise of structured programming gave us a lot of new goodies

  • Functions!
  • Importing said functions from libraries
  • Loops while, repeat until, do and for)
  • switch/case statements
  • Testing

You didn't need to be able to keep a whole program in your head

Image: GIF of a crowd of people in a room cheering with arms raised.

With choices come a lot of opinions

Image: Scene of two women on a couch in conversation, one holding a coffee mug, begrudging “You're entitled to your wrong opinion, that's fine.”

New programming languages started to form around different philosophies

Most took a side between imperative or declarative programming approaches

Image: Still from Captain America Civil War showing the heroes running into conflict with their former teammates.

Imperative programming

Image: Scene from Pulp Fiction showing a stern-looking Harvey Keitel in a suit and bowtie, captioned “DO WHAT I SAY... WHEN I SAY IT...”

With imperative languages:

  • Fine control over how the problem is solved
  • Need for a thorough understanding of how to solve the problem before it can be asked of the computer
  • Possibly access to low-level concerns like memory management
  • Access to numerous ways to shoot yourself in the foot

These are usually the languages people are most familiar with as most general purpose languages are in the imperative style

Because most people's first language is imperative, it shapes their expectations

Image: Scene from The Mindy Project of Mindy in a blue and black blazer with hoop earrings, explaining ”I am not picky. I just have standards.”

Languages that don't follow imperative conventions become disappointing and frustrating

It's unreasonable to judge a fish by its ability to fly

Image: Marques Brownlee in a black t-shirt cautioning “TAME YOUR EXPECTATION.”

Procedural programming

Image: Eugene Levy as Johnny Rose in Schitt’s Creek, looking concerned, captioned “WHY DON'T WE TAKE THIS ONE STEP AT A TIME?”

The most straightforward imperative approach

  • Series of steps in a program or function
  • To keep programs manageable, focus is on:
  • Modularity
  • Scoping

Well-known procedural languages

| Era | Languages | | --- | --- | | Pre-structural | Fortran, ALGOL, COBOL, PL/I, BASIC | | The next generation | Pascal, C |

Note: most imperative languages can be written in a procedural way, even if not listed here

COBOL: the programming language never designed for programmers

Image: Illustration of Grace Hopper seated at a desk with a small terminal, beside a row of vintage mainframe computer cabinets with dials, buttons and printouts.

  • Common business-oriented language
  • Computer scientists were largely ignoring business applications, so COBOL was developed in isolation from the existing programming community
  • Made to solve 2 main issues
  • Programming costs were incredibly expensive—a common, business-like language would allow more people to be able to code
  • Translating programs to work on new machines was similarly expensive and time-consuming—a more portable language could save time and money and ease modernization
  • Emphasis on being easy to read and understand by average people, with English-like syntax

As of 2017

  • 43% of banking systems built on COBOL
  • 80% of in-person transactions used COBOL
  • 95% of ATM swipes relied on COBOL code
  • 220 B COBOL lines of code in use

The Cobol Blues | Reuters

Reuters reports that “it has fallen out of favor among coders”, but let’s be real…

Computer scientists and programmers hated COBOL

The use of COBOL* *cripples the mind; its teaching should, therefore, be regarded as a criminal offense.
— Edsger Dijkstra

What is COBOL useful for?

  • In legacy applications:
  • General purpose business applications to be built by less expensive workers
  • Finance & logistics, etc.—where volume, reliability are vital
  • Government applications
  • Harder to justify for new projects as cost of COBOL talent has skyrocketed, taking away a key benefit
  • Still in active development with new features being released

| Strengths | Weaknesses | | --- | --- | | Easy to read/self-documenting | Overly verbose | | Easy to develop and maintain | Difficult to upgrade | | Easy to learn | Difficult to master | | Able to reliably handle extremely large processing volumes | Dwindling supply of willing and able talent |

C: the influencer

Image: The “X, X Everywhere” meme from Toy Story with Buzz Lightyear gesturing as Woody looks on, top text “SEGFAULTS” and bottom text “SEGFAULTS EVERYWHERE.”

  • General purpose, multi-paradigm language
  • Most popular languages today have some influence from C
  • Gives low-level memory access with little to no safety checks

What is C useful for?

Short answer: a lot

  • Operating systems
  • Embedded systems
  • Web browsers
  • Programming languages
  • Database management systems
  • Desktop GUI applications
  • Historically (better options now):
  • Gaming
  • Web development

| Strengths | Weaknesses | | --- | --- | | Mid-way between high-level and low-level languages | Doesn’t protect you from yourself (memory leaks, segfaults, etc.) |

  • Embedded systems: think anything from arduinos to smart toasters to TVs and cars

What is procedural style useful for?

  • General purpose
  • Programs that aren't better suited to another paradigm

Object-oriented programming

Image: Judge Judy seated at the bench in front of an American flag, captioned “MY OPINION IS THE ONLY ONE THAT COUNTS.”

If you've only worked with one language, it's likely designed with this in mind

Our good friend Dijkstra had this to say:

“Object-oriented programming is an exceptionally bad idea which could only have originated in California.”

The most complicated imperative approach

  • Everything is an object
  • Classes are used as blueprints to instantiate objects
  • Classes can inherit from parents to lessen duplication
  • Objects contain state (data) and behavior (methods)
  • Messages are passed to objects, which then select the procedural code to run in response

Well-known OOP languages

| Degree of OO | Languages | | --- | --- | | Pure OO | Ruby, Scala, Smalltalk | | Mainly OO, some procedural | Java, Python, C++, C#, VB.NET | | Procedural, w/ OO features | PHP, JavaScript, Perl, MATLAB |

Java was particularly impactful in driving OOP as "the one true way"

What is OO style useful for?

  • Modeling simulations
  • Computer-Aided Design (CAD) systems
  • Problems that would most naturally be implemented with state and methods coupled
  • Maintaining a bank balance
  • Problems whose domains map well to relationships between objects as defined by OOP
  • This will often be a subjective determination
  • Historically (no longer only option):
  • Web applications

It's important to consider if OOP makes modeling your problem’s domain simpler or more complex

Declarative programming

Image: Music-video still from the Spice Girls’ “Wannabe” of Scary Spice in a green crop top pointing, singing “I’ll tell you what I want, what I really really want.”

In contrast to imperative, with declarative languages we usually:

  • Describe things
  • Ask for what we want
  • Set constraints for our results
  • We don't actually care about the order of operations, or often even how it gets done

The lack of programmer control of the how can be frustrating

Image: Scene from Star Wars: Episode II of teen Anakin Skywalker being moody with the caption “I hate them!”

But when used appropriately, they trivialize many difficult-to-solve problems

Image: Scene from Ash vs Evil Dead showing Ash speaking down toward his own hand, captioned “Little buddy, do your magic.”

So what is the most popular declarative language?

Image: Adam Sandler from The Waterboy with the caption “THAT'S WHAT I CALL HIGH-QUALITY SQL.”

Query languages are common declarative languages

1  {
2    hero {
3      name
4      friends {
5        name
6        homeWorld {
7          name
8          climate
9        }
10       species {
11         name
12         lifespan
13         origin {
14           name
15

Its greatest strength is a double-edged sword

  • Query languages are typically very accessible and expressive
  • Many who use them do not consider themselves technical
  • By not understanding how the computer will choose to solve problems, programmers can end up fighting the language

It's worth it to learn how to encourage the system to behave how you want

Image: Scene from Star Trek: The Original Series where Mr. Spock is playing 3D chess, captioned “...and you're sitting here playing chess with the computer.”

What are query languages useful for?

  • Working with databases and information systems:
  • Asking questions
  • Running searches

You're usually going to be using this and a language with some other paradigm

Functional programming

Image: Milton from Office Space in his glasses and short-sleeved shirt, captioned “I WAS TOLD THERE WOULD BE SIDE EFFECTS.”

In pursuit of purity

  • Functions and data are separate
  • Functions can take other functions as arguments or return them as results
  • Data is immutable
  • Intent is smaller, more testable functions with fewer/no side effects
  • Loops are usually through recursion

Chaining together functions in a pipeline is powerful

1   function_e(
2     function_d(
3       function_c(
4         function_b(
5           function_a(
6             input
7           )
8         )
9       )
10    )
11  )

Can be rewritten as a series of transformations on the input

1  input
2  |> function_a
3  |> function_b
4  |> function_c
5  |> function_d
6  |> function_e

Well-known functional languages

| Degree of functional | Languages | | --- | --- | | Pure functional | Haskell, Elm | | Functional | Erlang, Scala, Lisp, OCaml, Elixir | | Non-functional, supports style | JavaScript, Lua, Python, Go, PHP, C#, C++, Kotlin, Java* |

What is functional style useful for?

  • Fault-tolerance & concurrency
  • Erlang, developed by Ericsson in the 80s, was built to power the telecom industry and now includes applications at Facebook & WhatsApp
  • Financial and risk analytics
  • Aerospace engineering
  • Robot programming
  • Static analysis
  • Problems involve running a series of transformations on data
  • Web applications (Elixir, Elm, Haskell)
  • Academic use

Logic & constraint programming

Image: Scene from The Princess Bride showing Vizzini sitting next to a blindfolded Princess Buttercup and speaking to the Man in Black, asking “Are you the sort of man who would put the poison into his own goblet or his enemy’s?”

Two paradigms, better together

  • Logic programming
  • Based on formal logic
  • Facts and rules are established
  • From those facts and rules, inferences can be made
  • Constraint programming
  • Focuses on solving combinatorial problems
  • Is there a solution that satisfies a list of constraints
  • Optimization problems (schedules, routes, etc.)
  • The model example of these paradigms is Prolog

Example of difference in approach

Image: Code listing in Prolog showing comments describing a map-coloring program for South America with four colors (red, blue, green, orange), followed by different(X,Y) facts: different(red,blue)., different(red,green)., different(red,orange)., different(green,blue)., different(green,orange)., different(green,red)., different(blue,green)....

Source: Craig Graci at SUNY Oswego

Backtracking: more efficient than testing all possibilities

Image: Partially filled Sudoku grid showing some cells with orange numbers (givens) and others with blue numbers (in-progress fills). If the solve runs into a dead end, prolog can backtrack and attempt other solution paths instead of starting over.

What is logic & constraint useful for?

  • Solving NP problems like combinatorics relatively quickly, easily and with very little code
  • Artificial intelligence
  • Expert systems
  • Natural language processing
  • Machine learning
  • Combinatorics examples
  • Schedule optimization
  • Vehicle routing
  • Bin packing

Image: Morpheus meme from The Matrix with top text “WHAT IF I TOLD YOU" and bottom text "CSS IS A PROGRAMMING LANGUAGE.”

Let's step outside of the flame wars

Image: The Joker from The Dark Knight in clown makeup talking to Harvey Dent, captioned “EVERYONE LOSES THEIR MINDS.”

What my process looks like

  • “What kinds of problems do I need to be able to solve to build this product?”
  • What paradigms will help me most here?
  • If I don't already know a language in that paradigm, is there a mutually intelligible language I do know?
  • Are there other connections between languages I'm using I can take advantage of?

If you take nothing else away from this...

Image: Yoda from Star Wars with top text “USE WHATEVER MAKES YOUR PRODUCT USEFUL” and bottom text “YOU SHALL.”

You’re not being paid to be clever—you’re being paid to solve problems. Whatever will allow you to solve those problems most effectively and efficiently should be what you reach for.

Looking for additional resources?

If you prefer code to slide show software, I highly recommend Reveal.js

Image: The “Disaster Girl” meme of a young girl smirking in front of a burning house, with top text “TIME TO STEP AWAY FROM CODING” and bottom text “AND MAKE A POWERPOINT SLIDE SHOW.”

Thank you!

Did you enjoy this article?

Recommend it — Standard Reader surfaces well-loved writing to more readers across the network.

Across the AtmosphereDiscussions