ryoblog/src/scams/oop/index.md

2.1 KiB

title: OOP is a scam

OOPs, object oriented programming is a downgrade from procedural programming!

On the one hand they want us to objectify everything, because it's the hip way of "programming".
On the other hand they tell us that objectifying is sexist.

Let's pull 900 MiB of garbage in order to make a "Hello World" script

So you tell me that just

<?php
  echo "Hello World";
?>

is no longer considered doable, but

<?php

  namespace App\Http\Controllers;
  use App\Http\Controllers\Controller;

  class HelloWorldController extends Controller {
    private $text;

    public function __construct () {
      $this->text = '';
    }

    public function DoPrintText () {
      $this->PrintText("Hello World");
      print_r($this->text);
      return '';
    }

    public function PrintText ($text) {
      $this->text = $text;
      return $this->text;
    }
  }

  $hello = new HelloWorldController;
  $helloworld = $hello->DoPrintText();

?>

apparently is?

It's the modern way of doing things, so yeah...

Procedural programming is better for both human and machine

For those who don't know, procedural simply means going from top to bottom.
Consider making yourself a shopping list, would you order it so that you can enter the supermarket and grab the items you need to buy as you get closer to checkout, or would you just write everything in random order, and constantly travel back and forth like an idiot, only to then end up in a massive queue in the end?

Procedural makes sense to the human brain, because you do one thing, you complete it, you move on to the next.
Procedural makes sense to machine, because it executes instructions at the top, and works its way down to the end.

Object oriented programming on the other hand constantly travels throughout the codebase for every single instruction, which is written procedurally in the entry point anyway.
In clown world, you're not allowed to make sense.

It's the wasteful way of programming, yet there's no job opening in the entire world that doesn't want you to do OOPs.