Object and Procedural Oriented Programming in PHP at the same time

Asked

Viewed 52 times

4

Guys I have a PHP system that I have been developing for over a year. It was written practically procedural, because I adapted better, and I find it simpler to work. My question is the following:

And bad mixing POO within a procedural system?

  • 1

    If the procedural paradigm works well for you do not know what is the need for you to change paradigm or mix with another. I would tell you to do what works best and will ensure fewer problems in the future :D rsrs.

  • 2

    Mixing you will be enjoying the best of each. Anyone who has experience does this usually when the language allows it. It just doesn’t happen a lot, because most people don’t go deep even in one, let alone two paradigms, so they get a little confused. Now, if you master procedural, OOP won’t add anything good to PHP specifically. It is only good to know to consume what already has ready, because the biggest advantages that object orientation could bring, do not make so much difference in a language that is to make a handful of scripts.

  • I understand, well let me try to explain my case better. I try to keep my code as organized as possible. Example, I have a.php box panel, where I have php doing the select and HTML. The page is all documented, toothed. Is that right? Like I don’t know how it’s done in big companies, I don’t want to develop a whole system of gambiarra.

  • 2

    If you’re curious, check out this post:PHP mixes object-oriented codes and procedural language?

  • 1

    @Hugoborges do not fall into the myth of "how it is done in large enterprises", often large enterprises do every horrendous thing. In fact, there is too big a company that loses control of the size of the soft, and hires such "architects" (there are good ones, but I do not know if most are), which deploy everything that is fashionable, then you need 5 academic programmers instead of each pragmatic programmer to get the system running.

  • hahahhahhahha understood. I’m reading the link you sent me ;)

  • @Hugoborges see if what you want to know has already been answered in the link, able that your end being duplicate that, then you can close your link to that other (both continue on the site, worth points, but point to the same result, to avoid repeated content on the site).

  • Got it, good thanks ;)

  • @Hugoborges seeing the editing history of the question, a guess of mine is that if your system is working well in the procedural, I think you have more to enjoy the advantages, and have no need to pass anything to OOP. But if you need to use an object-oriented component, it’s okay to use it. And there’s more: the fact of using classes does not necessarily mean that you are programming in OO, it is very good to use the classes already existing in PHP in procedural programming.

  • ... although it also has no need in most cases

Show 5 more comments
No answers

Browser other questions tagged

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