By using this site, you agree to the Privacy Policy and Terms of Use.
Accept
World of SoftwareWorld of SoftwareWorld of Software
  • News
  • Software
  • Mobile
  • Computing
  • Gaming
  • Videos
  • More
    • Gadget
    • Web Stories
    • Trending
    • Press Release
Search
  • Privacy
  • Terms
  • Advertise
  • Contact
Copyright © All Rights Reserved. World of Software.
Reading: Programming Paradigms: All the Things We’ve Learned Not To Do | HackerNoon
Share
Sign In
Notification Show More
Font ResizerAa
World of SoftwareWorld of Software
Font ResizerAa
  • Software
  • Mobile
  • Computing
  • Gadget
  • Gaming
  • Videos
Search
  • News
  • Software
  • Mobile
  • Computing
  • Gaming
  • Videos
  • More
    • Gadget
    • Web Stories
    • Trending
    • Press Release
Have an existing account? Sign In
Follow US
  • Privacy
  • Terms
  • Advertise
  • Contact
Copyright © All Rights Reserved. World of Software.
World of Software > Computing > Programming Paradigms: All the Things We’ve Learned Not To Do | HackerNoon
Computing

Programming Paradigms: All the Things We’ve Learned Not To Do | HackerNoon

News Room
Last updated: 2025/05/18 at 6:55 PM
News Room Published 18 May 2025
Share
SHARE

I want to present a rather unusual perspective on programming paradigms.

So far, we have three major paradigms:

  1. Structured Programming,
  2. Object-Oriented Programming, and
  3. Functional Programming.

Programming Paradigms are fundamental ways of structuring code. They tell you what structures to use and, more importantly, what to avoid. Instead of giving you more power, they set limits by adding rules for how your code should be written.

Also, there will probably never be a fourth paradigm. I’ll explain why in this article, strap in!

Structured Programming

In the early days of programming, Edsger Dijkstra recognized a fundamental problem: programming is hard, and programmers don’t do it very well. Programs would grow in complexity and become a big mess, impossible to manage.

So he proposed applying the mathematical discipline of proof. This means:

  1. Start with small units that you can prove to be correct.
  2. Use these units to glue together a bigger unit. Since the small units are proven correct, the bigger unit is correct too (if done right).

His system was similar to modularizing your code, making it DRY (don’t repeat yourself). But with “mathematical proof”.

Now the key part: Dijkstra noticed that certain uses of goto statements make this decomposition very difficult. Other uses of goto, however, did not. And these latter gotos basically just map to structures like if/then/else and do/while.

So he proposed the removal the first type of goto, the bad type. Or even better: remove goto entirely and introduce if/then/else and do/while. This is structured programming.

That’s really all it is. And he was right about goto being harmful, so his proposal “won” over time. Of course, actual mathematical proofs never became a thing, but his proposal of what we now call structured programming succeeded.

In Short

Mp goto, only if/then/else and do/while = Structured Programming

So yes, structured programming does not bestow devs with new power, it removes power.

Object-Oriented Programming (OOP)

OOP basically involves moving the function call stack frame to a heap.

By doing this, local variables declared by a function can exist long after the function is returned. The function becomes a constructor for a class, the local variables become instance variables, and the nested functions become methods.

This is OOP.

Now, OOP is often associated with “modeling the real world” or the trio of encapsulation, inheritance, and polymorphism, but all of that was possible before. The biggest power of OOP is arguably polymorphism. It allows dependency version, plugin architecture, and more. However, OOP did not invent this, as we will see in a second.

Polymorphism in C

As promised, here is an example of how polymorphism was achieved before OOP was a thing. C programmers used techniques like function pointers to achieve similar results. See a simplified example below.

Scenario: We want to process different kinds of data packets received over a network. Each packet type requires a specific processing function, but we want a generic way to handle any incoming packet.

// Define the function pointer type for processing any packet
typedef void (_process_func_ptr)(void_ packet_data);
// Generic header includes a pointer to the specific processor
typedef struct {
    int packet_type;
    int packet_length;
    process_func_ptr process; // Pointer to the specific function
    void* data; // Pointer to the actual packet data
} GenericPacket;

When we receive and identify a specific packet type, say an AuthPacket, we would create a GenericPacket instance and set its process pointer to the address of the process_auth function, and data to point to the actual AuthPacket data:

// Specific packet data structure
typedef struct { ... authentication fields... } AuthPacketData;

// Specific processing function
void process_auth(void* packet_data) {
    AuthPacketData* auth_data = (AuthPacketData*)packet_data;
    // ... process authentication data ...
    printf("Processing Auth Packetn");
}

// ... elsewhere, when an auth packet arrives ...
AuthPacketData specific_auth_data; // Assume this is filled
GenericPacket incoming_packet;
incoming_packet.packet_type = AUTH_TYPE;
incoming_packet.packet_length = sizeof(AuthPacketData);
incoming_packet.process = process_auth; // Point to the correct function
incoming_packet.data = &specific_auth_data;

Now, a generic handling loop could simply call the function pointer stored within the GenericPacket:

void handle_incoming(GenericPacket* packet) {
    // Polymorphic call: executes the function pointed to by 'process'
    packet->process(packet->data);
}

// ... calling the generic handler ...
handle_incoming(&incoming_packet); // This will call process_auth

If the next packet were a DataPacket, we’d initialize a GenericPacket with its process pointer set to process_data, and handle_incoming would execute process_data instead, despite the call looking identical (packet->process(packet->data)). The behavior changes based on the function pointer assigned, which depends on the type of packet being handled.

This way of achieving polymorphic behavior is also used for IO device independence and many other things.

Why is OO still Beneficial?

While C, for example, can achieve polymorphism, it requires careful manual setup, and you need to adhere to conventions. It’s error-prone.

OOP languages like Java or C# didn’t invent polymorphism, but they formalized and automated this pattern. Features like virtual functions, inheritance, and interfaces handle the underlying function pointer management (like vtables) automatically. So all the aforementioned negatives are gone. You even get type safety.

In Short

OOP did not invent polymorphism (or inheritance or encapsulation). It just created an easy and safe way for us to do it and restricts devs to use that way. So again, devs did not gain new power by OOP. Their power was restricted by OOP.

Functional Programming (FP)

FP is all about immutability. You can not change the value of a variable. Ever. So the state isn’t modified; a new state is created.

Think about it: What causes most concurrency bugs? Race conditions, deadlocks, concurrent update issues? They all stem from multiple threads trying to change the same piece of data at the same time.

If data never changes, those problems vanish. And this is what FP is about.

Is Pure Immutability Practical?

There are some purely functional languages like Haskell and Lisp, but most languages now are not purely functional. They just incorporate FP ideas, for example:

  • Java has final variables and immutable record types,
  • TypeScript: readonly modifiers, strict null checks,
  • Rust: Variables are immutable by default (let), requires mut for mutability,
  • Kotlin has val (immutable) vs. var (mutable) and immutable collections by default.

Architectural Impact

Immutability makes the state much easier for the reasons mentioned. Patterns like Event Sourcing, where you store a sequence of events (immutable facts) rather than mutable state, are directly inspired by FP principles.

In Short

In FP, you cannot change the value of a variable. Again, the developer is being restricted.

Summary

The pattern is clear. Programming paradigms restrict devs:

  • Structured: Took away goto.
  • OOP: Took away raw function pointers.
  • Functional: Took away unrestricted assignment.

Paradigms tell us what not to do. Or, differently put, we’ve learned over the last 50 years that programming freedom can be dangerous. Constraints make us build better systems.

So, back to my original claim that there will be no fourth paradigm. What more than goto, function pointers and assignments do you want to take away…? Also, all these paradigms were discovered between 1950 and 1970, strengthening my theory that we’ll probably not see a fourth one.

Sign Up For Daily Newsletter

Be keep up! Get the latest breaking news delivered straight to your inbox.
By signing up, you agree to our Terms of Use and acknowledge the data practices in our Privacy Policy. You may unsubscribe at any time.
Share This Article
Facebook Twitter Email Print
Share
What do you think?
Love0
Sad0
Happy0
Sleepy0
Angry0
Dead0
Wink0
Previous Article ‘Yaaaaaay!’ Google’s latest accessibility tweaks include stretching out captions for emphasis
Next Article The M4 MacBook Air is *still* chilling at its lowest price ever — but for how long?
Leave a comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Stay Connected

248.1k Like
69.1k Follow
134k Pin
54.3k Follow

Latest News

Xiaomi Redmi Turbo 4 Pro reaches one million units sold in under a month · TechNode
Computing
Inside ‘world’s largest cinema’ the ‘Big King’ with 2,700-seater hall
News
Indian space agency’s satellite mission fails over technical issue in launch vehicle
News
Can Nigerian courts handle AI-generated evidence?
Computing

You Might also Like

Computing

Xiaomi Redmi Turbo 4 Pro reaches one million units sold in under a month · TechNode

1 Min Read
Computing

Can Nigerian courts handle AI-generated evidence?

10 Min Read
Computing

Device Memory TCP TX Support Queued Ahead Of Linux 6.16

2 Min Read
Computing

Xiaomi unveils self-developed Xuanjie O1 chip using 3nm process · TechNode

1 Min Read
//

World of Software is your one-stop website for the latest tech news and updates, follow us now to get the news that matters to you.

Quick Link

  • Privacy Policy
  • Terms of use
  • Advertise
  • Contact

Topics

  • Computing
  • Software
  • Press Release
  • Trending

Sign Up for Our Newsletter

Subscribe to our newsletter to get our newest articles instantly!

World of SoftwareWorld of Software
Follow US
Copyright © All Rights Reserved. World of Software.
Welcome Back!

Sign in to your account

Lost your password?