Jorge Castro
1 min readMar 13, 2022

You are an ignorant and you are complaining against me.

Why?

Do you know what Doctrine does? No, then pick then code, analyze and and check HA-HA, this code is trash and is doing a lot of overhead code for no reason but sugar candy.

Numeric array:

$customer[1]="john";

However, it is hard to maintain.

so

$customer["user"]="john";

is sufficient.

However, we could use OOP

$customer->user="john"

Is more OOP

Also, we could use setter/getters

$customer->setUser("john");

So now it is OOP

Costs:

* Numeric 0.038 seconds

* Associative array 0.040 seconds.

* Object 0.087 seconds.

* Object using setter and getters 0.2116 seconds.

* Objects using setter/and getters magic methods 0.399 seconds.

The average programmer that uses OOP uses an associative array. Doctrine uses Object using setter and getters with magic methods and the performance is (only for the definition of the values) around 1000% slower.

Why?

PHP doesn't have a method to turn an associative array into a specific class. Java can!, C# can!, but PHP is unable, so it converts into the generic stdClass and this class must be convert (again) into another class and it costs a lot. However, since Doctrine relies on syntax sugar, then it stores internally the values and it uses magic methods for practically everything. It costs a lot too.

In a nutshell, YOU CAN'T write a fast code using doctrine.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Responses (1)

Write a response