Why are object orientation codes different from structural ones?

Asked

Viewed 48 times

0

I see identical codes that do the same thing, both work on structural and in the POO (object-oriented programming), but object-oriented is different from structural programming.

For example, in my code I’m using

mysqli_fetch_row($res)

In the POO is

$res->fetch_row()

However I’m using the structural mode on POO, then the question arose. If it works in both, why are there two types of programming in the same language? They are the same, just a matter of option?

  • 1

    What would be "structural mode in the POO"?

  • https://answall.com/questions/211768/tudo-que-consigo-fazer-em-poo-eu-consigo-fazer-em-pe n https://answall.com/questions/213951/poo-%C3%A9-equal-in-all-languages/213978#213978 n https://pt.overfstacklow.com/questions/368638/d%C3%Bavidas-over-an%C3%A1lise-e-design-structured-and-object-oriented/369212#369212

  • Structural, Exp: mysqli_fetch_row($res) POO, Exp: $res->fetch_row() I want to basically know the difference between the two. I know one is used in POO and the other in structural, but what’s the difference if I can use both in both? Besides, my question is not about mixing object-oriented code with structural, I don’t understand why "This question has already been posted.."

1 answer

0

Good morning, the programming paradigm is depending on what you will do, there are times when one paradigm will be better than another. I believe that in structural we can not do the abstraction of an object from real life to code, but in a script use POO no and make necessary, is not option is actually where it fits best.

  • My question seems to have been a little ambiguous rsr I am learning POO, I can already see the need, but what I don’t understand is the difference, not between paradigms, but between codes. For example: mysqli_fetch_row($res) (Structural) E $res->fetch_row() (POO) Has difference?

  • 1

    Looking at the documentation the biggest difference between them is that in object orientation it is a statico method https://www.php.net/manual/en/language.oop5.static.php. and in procedural a function https://www.php.net/manual/en/mysqli-result.fetch-row.php

Browser other questions tagged

You are not signed in. Login or sign up in order to post.