![]() |
PHP5 OOP or Procedural
I don't know how many PHP developers we got in VC community, i just thought about opening this thread for who it may concerns.
As you may know PHP5 best feature is the big improvement done in object modeling (interfaces, access modifiers...) while php4 has very limited OOP capability. But still some people believe that procedural has a better performance and no need for OOP in PHP since PHP was not made to be OOPed such as java and c++ Personally, i switched lately (1 month ago) to OOP and still very excited about the idea, i created some large and complex classes and doing just fine. It's way easier to modify extend using inheritance and of course debug since your page code will be way smaller than a procedural. Yet, i see many online on-fire debates about this matter. The question comes here, do you prefer Procedural Programming or Object Oriented Programming in PHP and why? |
Re: PHP5 OOP or Procedural
well xcoder, akid u know that i am a fan of classic programming aka procedural, even when using C, C++, but as i was discussing this with you, The OOP makes life easier, even though, in its first stages may appear a little bit harder, but later on you will realise that OOP, is a great improvement in the development of programming, it help modifing and diagnosing errors ways faster than classical programming. and decrease the number of code and pages writin => decrease the compiling time = fast interpretation.
finally i think this depend on each programmer, and how he feels comfortable. |
Re: PHP5 OOP or Procedural
Thanks for your reply icemaker,
Indeed, that's what i think 2. For example i am working on a BIG project currently and i have 2 tables for users the first one for managers who work in the control panel and the second one for public users who register on the website to have access to some utilities. In the procedural way you will have to write the code twice for user registration once in the control panel and the second one on the public page which is not the case in OOP. I simply created a rich featured users class and use it whenever i need. In case i had more fields in the managers table let's say i can simply extend the class to inherit all (public,protected) methods and data members in the parent class and add the new ones. a small basic example: Code:
$manager=new User;I am so excited about OOP, i m spending long hours coding daily. Seeing the difference between php4 and php5 makes me wonder what would php6 be hiding. |
Re: PHP5 OOP or Procedural
Of course, OOP is better but one won't notice the difference unless he/she is building large scale applications...
|
Re: PHP5 OOP or Procedural
Quote:
|
Re: PHP5 OOP or Procedural
doesnt php lack some important oop featureslike function overloading and operator overloading. the workarounds make life harder.
as for large or small scale well basicly having a class that manages ur sql connections is an example of everyday php uses that manages a small scale project and makes life easier. |
Re: PHP5 OOP or Procedural
Thanks for your replies guys,
Quote:
However, all-time-OOP-programmers say that the goal of making everything OOP is harder at the beginning but on the long run you will have your own sweet private library that will make your future applications easier to make and faster to launch. However OOP requires more hardware resources but it certainly worth it. |
Re: PHP5 OOP or Procedural
Hey! I dont use PHP and i dont code using C++ nor C# but instead i use VB.NET and while coding for a website we use the ASP.NET technology. As you all know, VB.NET is totally OOP and i find it very interesting... It can help you in a lot of procedures like dropping some stuff from the toolbox and not havin to define it programmatically! and you can use classes to inherit from and use in many forms(while coding a windows application) or in many website pages, and you can later store those classes in a library that can be used whenever you want in any other project :)
|
Re: PHP5 OOP or Procedural
I am not sure why Msft is keeping so much technologies C#, VB.Net, ...
Maybe because they have some communities or something. What you can do in VB.Net you can do in a better way in C#. Simply because writing VB is very much like writing a script not a code. you have to Dim a variable and stuff. I used to like it but C# is better if you have a C++ experience. But in the end it is just a matter of what you like, as they all achieve the same result. Personally I just liked php cuz function names r pretty close to c :P and I hated ASP cuz it is close to VB.net :D |
| All times are GMT +1. The time now is 06:01 PM. |
Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger