Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-21-2012, 05:19 PM   PM User | #16
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
4.0 isn't really an OO engine. It was a hacky addin to the existing 4.x procedural core. It is. . . not great to say the least, but for what they could do it turned out surprisingly well (no, I wouldn't use it either :P). 5.0 redefined the entire underlying engine for OO making it far more powerful. 4.x was more of a collection of functions and variables specific to a "group", or more close to a struct than an object.
Constructor name is often the name of the class. I haven't a clue why they redefined that in 5.x especially since the BC for 5 to 4 still dictates you can use them with the exception of namespaces matching the same classname for the ending portion of the namespace.
This is another great reason to not use PHP as your language of choice to learn OOP on.
Fou-Lu is offline   Reply With Quote
Old 11-21-2012, 06:26 PM   PM User | #17
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,496
Thanks: 44
Thanked 439 Times in 428 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
Quote:
Originally Posted by Fou-Lu View Post
This is another great reason to not use PHP as your language of choice to learn OOP on.
Heh, that says it all for me
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is offline   Reply With Quote
Old 11-21-2012, 06:29 PM   PM User | #18
angelali
Regular Coder

 
Join Date: Sep 2011
Posts: 310
Thanks: 23
Thanked 0 Times in 0 Posts
angelali is an unknown quantity at this point
When WordPress was released, it was 99% procedural! I have not downloaded the last version, I don't know if they have switched to OO.

Every crap you will do in OO can be done in Procedural except it can be more complicated or can be too long, but still you can do it!
angelali is offline   Reply With Quote
Old 11-21-2012, 06:49 PM   PM User | #19
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Not even. Most of the time procedural will be less footprint and easier to perform the same task. One of the few exceptions is the privacy control which is quite complex to do in procedural. But you do take the tradeoff of re-usability, so you have to weigh which is more important to you.
OO is a good choice for a shared system that unknown individuals could add onto. This grants me control which is difficult to implement in procedural, and if implemented improperly can result in many bugs introduced by addon code that is difficult to debug.
Fou-Lu is offline   Reply With Quote
Old 11-21-2012, 06:52 PM   PM User | #20
angelali
Regular Coder

 
Join Date: Sep 2011
Posts: 310
Thanks: 23
Thanked 0 Times in 0 Posts
angelali is an unknown quantity at this point
Who made PHP OO? Zend team or Lerdorf?
angelali is offline   Reply With Quote
Old 11-21-2012, 07:01 PM   PM User | #21
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
PHP OO is developed by Zend. AFAIK Rasmus is still on the development team, but I'm not sure if he's actively participating or just consulting.
Fou-Lu is offline   Reply With Quote
Old 11-21-2012, 07:02 PM   PM User | #22
angelali
Regular Coder

 
Join Date: Sep 2011
Posts: 310
Thanks: 23
Thanked 0 Times in 0 Posts
angelali is an unknown quantity at this point
Damn Zend!
angelali is offline   Reply With Quote
Old 11-22-2012, 07:01 AM   PM User | #23
Custard7A
Regular Coder

 
Custard7A's Avatar
 
Join Date: Jul 2010
Location: Australia
Posts: 269
Thanks: 32
Thanked 32 Times in 32 Posts
Custard7A is an unknown quantity at this point
The blithering fools!

Lol, just go use procedural and stop whining.
Custard7A is offline   Reply With Quote
Old 11-22-2012, 08:54 AM   PM User | #24
firepages
Super Moderator


 
Join Date: May 2002
Location: Perth Australia
Posts: 3,890
Thanks: 5
Thanked 79 Times in 78 Posts
firepages will become famous soon enough
OO was introduced in PHP3 though internally it was not true OO of any description just emulation of objects, Zend changed this and it grows with every version.
Lerdorf is not a gigantic fan of OO ala MVC etc
__________________
resistance is...

MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)
firepages is offline   Reply With Quote
Old 11-22-2012, 09:36 AM   PM User | #25
angelali
Regular Coder

 
Join Date: Sep 2011
Posts: 310
Thanks: 23
Thanked 0 Times in 0 Posts
angelali is an unknown quantity at this point
Quote:
Originally Posted by firepages View Post
Lerdorf is not a gigantic fan of OO ala MVC etc
Elaborate...
angelali is offline   Reply With Quote
Old 11-22-2012, 01:28 PM   PM User | #26
firepages
Super Moderator


 
Join Date: May 2002
Location: Perth Australia
Posts: 3,890
Thanks: 5
Thanked 79 Times in 78 Posts
firepages will become famous soon enough
Read my sig
__________________
resistance is...

MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)
firepages is offline   Reply With Quote
Old 11-22-2012, 02:22 PM   PM User | #27
angelali
Regular Coder

 
Join Date: Sep 2011
Posts: 310
Thanks: 23
Thanked 0 Times in 0 Posts
angelali is an unknown quantity at this point
So this guy does not like MVC? And moreover, in which year he made the statement?
angelali is offline   Reply With Quote
Old 11-22-2012, 11:23 PM   PM User | #28
firepages
Super Moderator


 
Join Date: May 2002
Location: Perth Australia
Posts: 3,890
Thanks: 5
Thanked 79 Times in 78 Posts
firepages will become famous soon enough
2006, in Zagreb , I don't know what he was wearing though
__________________
resistance is...

MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

Last edited by firepages; 11-22-2012 at 11:25 PM..
firepages is offline   Reply With Quote
Old 11-23-2012, 10:10 PM   PM User | #29
jimutt
New Coder

 
Join Date: Sep 2011
Posts: 47
Thanks: 1
Thanked 15 Times in 14 Posts
jimutt is an unknown quantity at this point
I think some of you guys have already said this with other words. But I think that when it comes to PHP and the choice of OO or Procedural you should really go with what you're most comfortable with. For example if you've for example been working a lot with C or any other procedural programming language you will probably find it more comfortable to keep using the same methods. And that's completely okay, because as many of you have already written there is not downside in performance when it comes to using procedural language. And according to me many well-commented procedural scripts are often easier to understand that mediocre OO-scripts.

Though if you're and hardcore Java programmer you might prefer the OO-way. And then that's definately the way to go as you will feel more comfortable with that. If you're a newbie; well then just go with what feels best for you. Try some OO-programming and see if you like it.

Personally I'm mainly working with procedural PHP code. Though I'm aware of some of the advantages of OO. And if I run into a problem which would be much easier to solve with OO programming, well then I'll do that.

Just don't feel like you have to choose a specific side in this ever lasting battle. Just follow your heart
jimutt is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 01:18 AM.


Advertisement
Log in to turn off these ads.