Vcoderz Community
We create websites that have it all, beauty & brains
Lebanon Web Design & Development - Coddict
 

Go Back   Vcoderz Community > Computer Zone > Computers & Information Technologies > E-Learning Center

Notices

E-Learning Center E-Learning tutorials and competitions.

Reply
 
Share Thread Tools Search this Thread
Old 12-03-2008   #1
xcoder
Ma ghayro
 
xcoder's Avatar
 
Last Online: 04-19-2018
Join Date: Dec 2005
Posts: 5,592
Thanks: 1,765
Thanked 4,201 Times in 2,361 Posts
Groans: 12
Groaned at 18 Times in 11 Posts
Post 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?


__________________
http://twitter.com/danymoussa
xcoder is offline   Reply With Quote
Old 12-04-2008   #2
Sheriff Ice
info@sync.com.lb
 
Sheriff Ice's Avatar
 
Last Online: 06-05-2018
Join Date: Apr 2006
Posts: 3,827
Thanks: 1,348
Thanked 2,391 Times in 1,306 Posts
Groans: 0
Groaned at 16 Times in 15 Posts
Default 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.
__________________
http://www.gamync.com Lebanese Produced Mobiles Games by http://www.sync.com.lb
Sheriff Ice is offline   Reply With Quote
Old 12-04-2008   #3
xcoder
Ma ghayro
 
xcoder's Avatar
 
Last Online: 04-19-2018
Join Date: Dec 2005
Posts: 5,592
Thanks: 1,765
Thanked 4,201 Times in 2,361 Posts
Groans: 12
Groaned at 18 Times in 11 Posts
Default 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;
$manager->setUser($user);
$manager->setPass($pass);
if($manager->login()){
  $manager->updateLastLogin();
  $manager->createSession($manager::getSessName());
  header("location: index.php");
}else{
  $manager->updateLoginFailure();
  $manager->lastLoginAttempt();
  $manager->genError();
  login_form();
}
See how clear and clean the code is.
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.
__________________
http://twitter.com/danymoussa
xcoder is offline   Reply With Quote
Old 12-11-2008   #4
rundll32.exe
Registered Member
 
rundll32.exe's Avatar
 
Last Online: 12-12-2008
Join Date: Dec 2008
Posts: 14
Thanks: 0
Thanked 3 Times in 3 Posts
Groans: 0
Groaned at 0 Times in 0 Posts
Default 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...
rundll32.exe is offline   Reply With Quote
Old 12-12-2008   #5
Google

 
Google's Avatar
 
Last Online: 05-30-2013
Join Date: Jan 2008
Posts: 1,788
Thanks: 10,018
Thanked 1,100 Times in 651 Posts
Groans: 1
Groaned at 6 Times in 6 Posts
Default Re: PHP5 OOP or Procedural

Quote:
Originally Posted by rundll32.exe View Post
Of course, OOP is better but one won't notice the difference unless he/she is building large scale applications...
Totally agreed.........
Google is offline   Reply With Quote
Old 12-16-2008   #6
ZeRaW
Registered Member
 
ZeRaW's Avatar
 
Last Online: 04-15-2018
Join Date: Feb 2006
Posts: 624
Thanks: 2
Thanked 299 Times in 276 Posts
Groans: 0
Groaned at 1 Time in 1 Post
Default 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.
__________________
I pwn n00bs
ZeRaW is offline   Reply With Quote
The Following User Says Thank You to ZeRaW For This Useful Post:
xcoder (12-17-2008)
Old 12-17-2008   #7
xcoder
Ma ghayro
 
xcoder's Avatar
 
Last Online: 04-19-2018
Join Date: Dec 2005
Posts: 5,592
Thanks: 1,765
Thanked 4,201 Times in 2,361 Posts
Groans: 12
Groaned at 18 Times in 11 Posts
Default Re: PHP5 OOP or Procedural

Thanks for your replies guys,
Quote:
Originally Posted by rundll32.exe View Post
Of course, OOP is better but one won't notice the difference unless he/she is building large scale applications...
It's better on large applications since it's easier to debug and avoids repetition. But also it can be used for small applications as Zeraw said.
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
.
__________________
http://twitter.com/danymoussa
xcoder is offline   Reply With Quote
Old 12-18-2008   #8
jak
Registered Member
 
jak's Avatar
 
Last Online: 12-11-2011
Join Date: Dec 2006
Posts: 946
Thanks: 388
Thanked 601 Times in 294 Posts
Groans: 4
Groaned at 3 Times in 3 Posts
Default 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
jak is offline   Reply With Quote
Old 12-20-2008   #9
ZeRaW
Registered Member
 
ZeRaW's Avatar
 
Last Online: 04-15-2018
Join Date: Feb 2006
Posts: 624
Thanks: 2
Thanked 299 Times in 276 Posts
Groans: 0
Groaned at 1 Time in 1 Post
Default 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
__________________
I pwn n00bs
ZeRaW is offline   Reply With Quote
The Following User Says Thank You to ZeRaW For This Useful Post:
Sheriff Ice (12-20-2008)
Reply

  Vcoderz Community > Computer Zone > Computers & Information Technologies > E-Learning Center

Tags
oop, php5, procedural



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:59 AM.


Lebanon web design and development
Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Share