TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 01-06-2008, 09:48 PM   #1 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Wink 10 PHP Myths Dispelled

I found this on Alan's blog, to which he then linked through to the original post. So I thought I would bring it over here for anybody who wants to contribute their thoughts. I posted a comment on the original post, and so I've brought it over to TalkPHP as well because it's my take on the article.

The 10 myths which he decided to tackle are as follows:
  1. PHP is not a truly Object-Oriented Language
  2. PHP Encourages Sloppy Code
  3. PHP doesn’t follow MVC
  4. PHP is slow because it’s interpreted
  5. PHP doesn’t have a good IDE or Debugger
  6. PHP apps all look the same
  7. PHP isn’t really for “serious” developers
  8. PHP is only good for web applications
  9. PHP code is a mess of “include” and “require” statements that break easily
  10. PHP Code is rife with in-line SQL statements

My comment:

Quote:
Originally Posted by Wildhoney
I also admit that PHP has its problems. Its naming conventions for functions to name one issue. But that’s not to say it’s not a decent language, after all, I wouldn’t be running the TalkPHP community if I thought it was a bad language. It’s just I like to keep at least a little distance from everything until I can honestly say it deserves to be backed by utter certainty in my convictions. At the moment, PHP merely deserves a chance to prove itself, and that’s what it’s going to get from me.

Evidently, PHP has a way to come yet on the OOP side of things, but just like Maxon Cinema 4D in the 3D world, it’s slowly creeping up the ladder and will be ahead before you know it. Perhaps overtaking Java is an improbable, if not impossible task, I admit. But that doesn’t mean it cannot be equal.

I feel PHP 5.3 will bring us a lot more in terms of the namespaces and the alternate ternary operator, as well as all the abundance of features, both big and small, that it’s going to bring to the table.
What do we all think...?
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 01-06-2008, 11:13 PM   #2 (permalink)
The Frequenter
Newcomer 
 
xenon's Avatar
 
Join Date: Dec 2007
Location: Bucharest, Romania
Posts: 438
Thanks: 3
xenon is on a distinguished road
Default

Well, I'd have something to say...

1. PHP 5 is very close to it (although I don't know much about C++/Java way of "object oriented", but I suppose there's not a big difference from what I've seen).
2. every programming language "encourages sloppy code". That depends and differs from one programmer to another.
4. I would say a 10.000 line PHP application runs much more faster (that is parsed, compiled and ran) than an equally long C++ application is compiled (only compiled, not ran).
5. Perhaps Eclipse and Zend are just common text editors, then, and XDebug is their child.
6. not always true. an object-oriented php application doesn't look at all like a procedural php application.
7. perhaps or perhaps not. PHP, although, does require a lot of concentration and will to learn and then work with it, because of the multitude of the additional languages it can work with (like SQL, HTML, JavaScript and such).
8. that I agree with. But then again, that's what it was created for.
9. check (2)
10. no, it is not, if you think a bit (just a bit) before writing an application.

Probably the one who wrote this article has something against PHP or hasn't worked with it, otherwise I can't explain why COMMON programming issues are presented here.
__________________
I have optimistic thoughts, even though sometimes (if not always) life's a bitch.
xenon is offline  
Reply With Quote
Old 01-07-2008, 11:49 AM   #3 (permalink)
The Reckoner
Advanced Programmer Top Contributor 
 
Karl's Avatar
 
Join Date: Sep 2007
Posts: 437
Thanks: 22
Karl is on a distinguished road
Default

I have to agree with Xenon here, he's said pretty much everything that I would have. The guy who originally posted that list probably just doesn't like PHP. Don't get me wrong, some of his points do hold weight, but most of them seem to be based on his personal opinion rather than any real facts.
__________________
Any fool can write code that a computer can understand. Good programmers write code that humans can understand.
Karl is offline  
Reply With Quote
Old 01-08-2008, 01:20 PM   #4 (permalink)
The Addict
Top Contributor Good Samaritan 
 
Join Date: Jan 2008
Location: USA
Posts: 217
Thanks: 16
RobertK is on a distinguished road
Default

I must agree with Xenon and Karl, the arguments are mostly ones that have come before with many languages. And I have a few of my own comments, sorry for the verbosity.

3. PHP doesn’t follow MVC
To answer this could be long, but I'll be short. For PHP MVC is a choice, not a requirement. Unlike some other languages where things can be unnecessarily complex in a mere error page. The MVC model, Model <-> View <-> Controller, is little more than a concept that has been object oriented. The base concept is abstraction between the data, specifically large amounts of data, and the view.

Procedural PHP either follows, or doesn't follow, the MVC concept. It either has code/functions that control the varying data followed by the view creation code/functions, or it has the view creation strewn throughout the data aggregation. Event incorporated view handling with the data has separation, as this, by and large, comes from a database or the filesystem.

Object Oriented PHP follows the two options above in manner but is far more encapsulated. The objects would contain all the code for the data, view, and controller--and many libraries already provide this exact MVC framework. Even when the view and data are handled procedurally, bit by bit for page generation, the processes are still separate.

Arguably, I would say PHP is one of the few languages that is natively MVC compliant--even if only in concept, rather than strict definition. But in the end, the strictness of the MVC relationship is up to the programmer.

4. PHP is slow because it’s interpreted
Absolutely correct. But we're also talking in relative terms. Interpreted languages are slower by definition because they aren't compiled and must be interpreted. That said, I see a great many bloated walruses in many languages, especially C++ (compiled) and Java (interpreted). However, Zend makes a better toaster. It CAN be bytecode compiled from what I understand. And its efficiency competes directly with LUA.

Another argument that makes this point null-and-void is abstraction. If I give a C/C++ application and input it doesn't expect it will crash immediately--it was an error. If it doesn't crash this input was expected, and prepared against. Lets pretend you have a hard-coded CGI binary. You just lost your whole interface that touches that input. With the abstraction of PHP I can change one, maybe two, lines per function or object and make it handle any problems like this gracefully. This makes recovery less of an arcane art, and more of an impressive feature.

So, bytecode-uberspeed or interpreted-stability? I like the latter.

5. PHP doesn’t have a good IDE or Debugger
News to me. phpDesigner 2008 is a good place to start; it is a PHP IDE. It even pops up as I pause in typing to tell me when and where I've got an error, without clicking debug or starting Apache. As a hobby I use Visual Studio 2008 (with Chrome, an Object Pascal extension language) and even those errors need arcane interpretation--PHP errors are pretty obvious, even when arcane sounding.

7. PHP isn’t really for “serious” developers
It's a good thing I'm not serious then. I make plenty of jokes. Or, is that why my .NET-ASP loving uncle is so angry any time I bring up why I disagree with him?

I'm glad "it's not for serious developers"... it'd give me ulcers otherwise. I've SEEN those serious folks, and they need to lighten up. Seriously.

(Anything C can do, PHP can do better!)

8. PHP is only good for web applications
A language being good at its purpose is a bad thing? Correct me if I'm wrong, but not even Java is good at its purpose, whatever that may be. Java programmers are the first to admit to Java's many problems. But, PHP being good at what it is supposed to do is bad....

I think someone needs to see the psychiatrist.

2. PHP Encourages Sloppy Code / 9. PHP code is a mess of “include” and “require” statements that break easily / 10. PHP Code is rife with in-line SQL statements
Sure, if you write it that way. But even sloppy PHP can be understood, and isn't nearly so mind-warping as the C-Macro paradigms. And, believe it or not, even this sloppy, "bad", PHP is typically fast, efficient, and understandable!
__________________
Programmers are in a race with the Universe to create bigger and better idiot-proof programs, while the Universe is trying to create bigger and better idiots. So far the Universe is winning. - Rich Cook
RobertK is offline  
Reply With Quote
Old 06-14-2009, 01:18 AM   #5 (permalink)
The Contributor
 
Join Date: Jun 2009
Location: Seattle, WA
Posts: 76
Thanks: 1
rguy84 is on a distinguished road
Default

Quote:
Originally Posted by RobertK View Post
7. PHP isn’t really for “serious” developers
Hope this guy does not want to work for Yahoo and other big companies that use PHP...

Quote:
Originally Posted by RobertK View Post
8. PHP is only good for web applications
A language being good at its purpose is a bad thing? Correct me if I'm wrong, but not even Java is good at its purpose, whatever that may be. Java programmers are the first to admit to Java's many problems. But, PHP being good at what it is supposed to do is bad....
I totally agree..
__________________
Ryan | Blog | Twitter
Send a message via AIM to rguy84 Send a message via MSN to rguy84 Send a message via Yahoo to rguy84 Send a message via Skype™ to rguy84
rguy84 is offline  
Reply With Quote
Old 06-14-2009, 01:55 AM   #6 (permalink)
how quixotic are you?
 
ETbyrne's Avatar
 
Join Date: Dec 2007
Location: Lapeer, MI
Posts: 445
Thanks: 37
ETbyrne is on a distinguished road
Default

Actually, you can use PHP for standalone desktop applications. It only really works well for console apps and it's pretty hacky, but I've done it.

And yeah whoever wrote that article just hates PHP.
__________________
Dingo Web Systems > http://www.dingocode.com
My Website > http://www.evanbot.com
ETbyrne is offline  
Reply With Quote
Old 06-14-2009, 09:38 AM   #7 (permalink)
The Contributor
 
dschreck's Avatar
 
Join Date: Nov 2007
Location: California
Posts: 82
Thanks: 0
dschreck is on a distinguished road
Default

1. PHP is not a truly Object-Oriented Language

Is any language a true OOP language - sure, in some languages, everything is an object. But is that Object Oriented Programming?

PHP has become a matured language, and has a full range of OO, including reflection.

2. PHP Encourages Sloppy Code

PHP encourages flexibility. If you're sloppy dev, you'll write sloppy code no matter what language. I've seen it, in Java, C, Python. It comes down to the developer.

3. PHP doesn’t follow MVC

Of course not, PHP isn't a framework. I'm assuming the author of this question is a RoR follower.

Frameworks follow MVC, if you count Ruby on Rails as a programming language, you are sadly misinformed. RoR is a Ruby framework.

PHP has countless MVC frameworks. You _CAN_ do true MVC in PHP. Is it suggested? Not really, MVC frameworks are generally slow and have problems scaling. This is an issue inherited by the pattern, not the language.

4. PHP is slow because it’s interpreted
Incorrect, PHP can often out perform in execution of like logic in other comparable languages.

5. PHP doesn’t have a good IDE or Debugger
Misinformed.
Try some good IDE's, like Zend. and as it's been said, xdebug.org - one of the best debuggers out there in the industry. PHP also has quiet a few native debugging tools, including performance functions built into the language.


6. PHP apps all look the same
... uh.. what? That's like saying all cars look the same because they all have 4 tires and at least 2 doors.

7. PHP isn’t really for “serious” developers
That would be an insult the the developers I work with, that come from companies like: EA, Google, Yahoo, Lucas Arts


8. PHP is only good for web applications
PHP excels at web applications, but can just as easily be used for CLI, and extended to the desktop with GTK+.
I've written kiosk software entirely with WAMP stacks simply because it was affordable, scaled, and straight out worked.


9. PHP code is a mess of “include” and “require” statements that break easily

If you mean they break because as a developer you're not aware of what 'include' and 'require' are intended to do, then sure, yeah. It's the same process a dev has to go through to get their compile include paths set up in any C/Java project.


10. PHP Code is rife with in-line SQL statements

Only if you want it to be.
__________________
Where I Ramble: http://www.iwilldomybest.com/
What I do: Zynga Game Network
Senior Software Engineer at CityVille
dschreck is offline  
Reply With Quote
Old 06-14-2009, 09:44 AM   #8 (permalink)
The Contributor
 
dschreck's Avatar
 
Join Date: Nov 2007
Location: California
Posts: 82
Thanks: 0
dschreck is on a distinguished road
Default

Quote:
Originally Posted by knight13 View Post
I have not been into php for long, but i know for a fact that a lot of really big websites are built from php and i really doubt if php was a bad language these website would not use them, and yea php may have problems but every problem has a solution.

On this topic...


I have this funny feeling that PHP is in this state where people are trying to wrap their heads around the idea that PHP can scale to handle more than 1k hits per day.

A LAMP stack, complimented by Memcache, with proper hardware scaling (which any language would need) can handle millions of unique daily users.
__________________
Where I Ramble: http://www.iwilldomybest.com/
What I do: Zynga Game Network
Senior Software Engineer at CityVille
dschreck is offline  
Reply With Quote
Old 06-14-2009, 10:01 AM   #9 (permalink)
The Addict
 
CoryMathews's Avatar
 
Join Date: Nov 2007
Location: USA
Posts: 256
Thanks: 7
CoryMathews is on a distinguished road
Default

1. PHP is not a truly Object-Oriented Language
2. PHP Encourages Sloppy Code
4. PHP is slow because it’s interpreted
6. PHP apps all look the same
7. PHP isn’t really for “serious” developers
8. PHP is only good for web applications
9. PHP code is a mess of “include” and “require” statements that break easily
10. PHP Code is rife with in-line SQL statements

1. No its not an OO language. Buts thats why I like it. Its easy to use objects, but I don't always have to.

2. So true, have you read other peoples code? complete shit. People are taught the wrong way to program php and thus there are a ton of crap tutorials and projects all over the place.

4. Ye but its negligible for most all projects.

5. Sometimes the truth hurts.

6. Eh?!

7. What do they use then? Ruby.. lol right...

8. What? Simple sites.. really does it matter what language?

9. In some projects yes. But in others no.

10. Mainly up to the developer. I could write an ASP.NET site, Coldfusion or whatever language with as many inline sql statements, and it would be common place.
CoryMathews is offline  
Reply With Quote
Old 06-15-2009, 06:55 AM   #10 (permalink)
The Contributor
 
Join Date: Jun 2009
Location: Seattle, WA
Posts: 76
Thanks: 1
rguy84 is on a distinguished road
Default

Quote:
Originally Posted by CoryMathews View Post
2. So true, have you read other peoples code? complete shit. People are taught the wrong way to program php and thus there are a ton of crap tutorials and projects all over the place.
You don't even have to go as far as php for this, there are html tutorials that are crap
__________________
Ryan | Blog | Twitter
Send a message via AIM to rguy84 Send a message via MSN to rguy84 Send a message via Yahoo to rguy84 Send a message via Skype™ to rguy84
rguy84 is offline  
Reply With Quote
Reply



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

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 07:41 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design