User Name
Password
AppleNova Forums » Programmer's Nook »

PHP vs all the others?


Register Members List Calendar Search FAQ Posting Guidelines
PHP vs all the others?
Thread Tools
nassau
Member
 
Join Date: Jul 2004
 
2006-06-27, 01:49

I'm noticing that PHP is very able and very popular among people sitting at home building everything from personal "Hello Word!" sites to huge projects like eg koll.se.

Why is it that when employers are looking for programmers, PHP is being looked down on? Almost no medium to big projects seem to be done in PHP. Why is this? Is it ignorance on their behalf or mine?
  quote
staph
Microbial member
 
Join Date: May 2004
Send a message via AIM to staph  
2006-06-27, 02:54

PHP perhaps isn't quite so well suited to really really big projects. Its object-orientation, particularly in PHP4, is seriously lacking in some respects. It's also a very "ugly" language — thousands of slightly different APIs not very well organised. And I suspect for large corporate projects, it also carries a big of a stigma because of its open-source roots.

Who can say why some things are more fashionable than others though? Java and C# (in ASP) are certainly very capable languages, so it's perhaps not surprising they they're commonly used for the really big projects.
  quote
Wyatt
Veteran Member
 
Join Date: Mar 2005
Location: Near Indianapolis
 
2006-06-27, 06:54

Yeah, PHP can be a bear for large projects. Do-it-yourselfers like myself love PHP because it's free and you don't need some terribly expensive server software (like you do with ColdFusion, for example).

It's one of the best "free" options, but corporations are usually willing to spend the money on things like ColdFusion (which I use at work) and ASP (which I'll be using soon), both of which are much more efficient and better supported than PHP.
  quote
nassau
Member
 
Join Date: Jul 2004
 
2006-06-27, 08:46

ok, so please tell me this: HOW are cold fusion, asp etc better than PHP. in what way are they more efficient? is it possible to do stuff in those languages that are impossible, or extremely cumbersome, in PHP?

and, forgive my "novice-ness", but how complicated does a website get. does it get much worse than your average size database driven multi-user website (such as this forum)...?
  quote
ghoti
owner for sale by house
 
Join Date: Apr 2005
Location: Charlotte, NC
 
2006-06-27, 09:05

I think that PHP is only looked down on if all you know is PHP - because that basically means that you have very limited experience, and very likely have no idea of software engineering methods. The same with Visual Basic, the typical hobbyist languages. If you also know Java, C++, etc., PHP can only be a plus.
  quote
Mr Beardsley
Member
 
Join Date: Jul 2004
Location: Colorado Springs
Send a message via AIM to Mr Beardsley  
2006-06-27, 11:23

PHP is inferior to some of the other web languages/technologies due to its weak OO abilities, and the fact that it's too easy to mix presentation with your business logic. I started programming for the web in PHP, it was cool at the time and I really enjoyed it. Later I bought a used copy of WebObjects off Ebay. I probably shouldn't have done that, because I'm so totally spoiled with the power of WebObjects that hacking around with PHP seems like banging my head against a wall.

WebObjects (the only one I've really used, I'm sure ColdFusion and ASP .Net are similar) does a really good job of cleanly separating your data model, business logic, and interface. WebObjects really adheres to MVC just like Cocoa. It uses code behind to make sure you don't have all your business logic in the same file as your interface. With WebObjects it is possible for a web designer to lay out the interface and put in placeholders (don't know exactly how to describe it) for the dynamic content. Then the programmers can write the code that processes and populates the dynamic content.

If you know any Java, give WO a whirl. It comes free now with Xcode. Just a warning though, after you use WebOjects you'll probably start to hate using PHP.

"Slow vehicle speeds with frequent stops would signal traffic congestion, for instance."

uh... it could also signal that my Mom is at the wheel...
  quote
nassau
Member
 
Join Date: Jul 2004
 
2006-06-27, 13:43

ok, but when you say it's too easy to mix interface with business logic - that only implies "poor" coding, not that PHP itself is a lesser language. and what does "OO" mean?
  quote
colivigan
Veteran Member
 
Join Date: Nov 2005
 
2006-06-27, 14:21

Quote:
Originally Posted by nassau
what does "OO" mean?
Interview tip of the day - don't ask that question.

Object-Oriented.
  quote
Wickers
is not a kind of basket
 
Join Date: May 2004
 
2006-06-27, 15:37

Make a defacer happy... learn PHP.
  quote
Mr Beardsley
Member
 
Join Date: Jul 2004
Location: Colorado Springs
Send a message via AIM to Mr Beardsley  
2006-06-27, 15:45

Quote:
Originally Posted by nassau
ok, but when you say it's too easy to mix interface with business logic - that only implies "poor" coding, not that PHP itself is a lesser language. and what does "OO" mean?
That's true, if you where smart you would try to separate your interface from you business code. If you plan on doing much PHP work, this would for sure be a good practice. However, when PHP was released it was not designed for this. The closest PHP comes to "code behind" functionality is grouping functions in a separate, includable file. This is helpful, but is nowhere near as powerful a system as "code behind".

Another huge difference between PHP and other web app frameworks is the way in which they are run. PHPs script based nature is much simpler and limiting. PHP is designed to parse then execute your script when requested by the client. You don't have your web app always running with PHP. Your code resides in separate script files that more or less match up with each page you want to display. When a script is requested that is when it is run. That is great for getting something up and working quickly, but is very archaic compared to the other web app frameworks. Having the app constantly running on the server means that you can easily maintain state on the server between pages, requests, and even different client sessions. With PHP you have to jump through all sorts of hoops to maintain state between scripts, and client requests. I believe they use cookies that bounce back and forth between the client and server to maintain a session.

A good read is Jon Rentzsch's intro to WebObjects. Read the section half way down called "WebObjects' Design".

http://rentzsch.com/webobjects/introTo5

"Slow vehicle speeds with frequent stops would signal traffic congestion, for instance."

uh... it could also signal that my Mom is at the wheel...
  quote
rollercoaster375
Senior Member
 
Join Date: Mar 2005
Location: UIllinois (Champaign, IL)
Send a message via AIM to rollercoaster375 Send a message via MSN to rollercoaster375 Send a message via Yahoo to rollercoaster375 Send a message via Skype™ to rollercoaster375 
2006-06-27, 21:27

Quote:
Originally Posted by Mr Beardsley
When a script is requested that is when it is run. That is great for getting something up and working quickly, but is very archaic compared to the other web app frameworks. Having the app constantly running on the server means that you can easily maintain state on the server between pages, requests, and even different client sessions. With PHP you have to jump through all sorts of hoops to maintain state between scripts, and client requests. I believe they use cookies that bounce back and forth between the client and server to maintain a session.
That's the way HTTP was designed—It wasn't meant to be an interactive application, it was meant to be a get/send transaction-based protocol.

There is a difference, however, in your comparison. You're comparing a language with a framework. That isn't fair. PHP itself doesn't have near the ease-of-use that a framework (There are numerous of PHP frameworks: Zend, Cake, Symphony, Trax...) will have. To further this point, would you attempt to write a Web Application in raw Java? [Although, I'm not sure if that's a valid comparison, as I don't know Java]

As for the questions that began this thread:

1. Ghoti made this point very clearly.
2. Medium to big projects? Perhaps phpBB? vB? WordPress? IPB?
3. The typical reasons for not using PHP involve the fact that it's simply not considered an 'enterprise' solution.

I really have nothing to put here, but I feel it's rather strange to not have one.

Last edited by rollercoaster375 : 2006-06-27 at 22:13.
  quote
colivigan
Veteran Member
 
Join Date: Nov 2005
 
2006-06-27, 21:54

PHP is a specialized "language" (using the term loosely) for building web sites. You couldn't really call it a general purpose programming language for developing complex applications. It's great for what it does, but not quite the skill set you need to impress those looking to hire serious software engineers.

Although ... has anyone else heard the rumor that the new Leopard kernel will be rewritten entirely in PHP?

Oops, wrong forum.
  quote
Mr Beardsley
Member
 
Join Date: Jul 2004
Location: Colorado Springs
Send a message via AIM to Mr Beardsley  
2006-06-27, 22:38

Quote:
Originally Posted by rollercoaster375
That's the way HTTP was designed—It wasn't meant to be an interactive application, it was meant to be a get/send transaction-based protocol.
Well then shoot tell all the folks that implement shopping carts, sessions, and other state based functions that the web wasn't designed to do those things. And, if they do implement them they should be hard to work with.

Quote:
Originally Posted by rollercoaster375
There is a difference, however, in your comparison. You're comparing a language with a framework. That isn't fair. PHP itself doesn't have near the ease-of-use that a framework (There are numerous of PHP frameworks: Zend, Cake, Symphony, Trax...) will have. To further this point, would you attempt to write a Web Application in raw Java? [Although, I'm not sure if that's a valid comparison, as I don't know Java]
Well yes and no. Like I said the PHP interpreter runs a script and quits. That is how the language is designed. It was not designed to make an app that you compile and and keep running for the life of the web app. The alternatives that I talked about do take this approach, and there are big advantages to it.

1. Better performance - A compiled language will generally outperform an intrepreted one
2. Better error checking - Compiling helps you discover errors before you run
3. Better state handling - I've already talked about this one.

The downside to those is a steeper learning curve.

None of the above has anything to do with frameworks, only server implementation. Unless someone drastically alters the implementation of PHP, you can consider it a feature of the language as PHP only works one way on a server.

Additionally you are wrong in saying that PHP does not come with a framework. Out of the box you get support for sessions, database access, collections, etc. It might not be as full featured as some of the other web app frameworks, but that is a lot more than just a language.

"Slow vehicle speeds with frequent stops would signal traffic congestion, for instance."

uh... it could also signal that my Mom is at the wheel...
  quote
rollercoaster375
Senior Member
 
Join Date: Mar 2005
Location: UIllinois (Champaign, IL)
Send a message via AIM to rollercoaster375 Send a message via MSN to rollercoaster375 Send a message via Yahoo to rollercoaster375 Send a message via Skype™ to rollercoaster375 
2006-06-27, 23:03

Quote:
Originally Posted by Mr Beardsley
Well then shoot tell all the folks that implement shopping carts, sessions, and other state based functions that the web wasn't designed to do those things. And, if they do implement them they should be hard to work with.
I never said it shouldn't be done... I simply said HTTP wasn't designed for it, and hence, state-ful web applications generally have some side effects - Take a look at the URLs in the Apple store, for instance.

Quote:
Originally Posted by Mr Beardsley
1. Better performance - A compiled language will generally outperform an intrepreted one
Through use of IonCube, and various other tools, PHP can also be compiled into Bytecode.

Quote:
Originally Posted by Mr Beardsley
2. Better error checking - Compiling helps you discover errors before you run
PHP uses a compile-then-parse methodology, so this point is moot.

Quote:
Originally Posted by Mr Beardsley
3. Better state handling - I've already talked about this one.
Define "better". The URLs to WO applications are generally horrible. Whereas, this forum, for instance, implements a very nice session system.

Quote:
Originally Posted by Mr Beardsley
The downside to those is a steeper learning curve.
As well as a less flexible application, and other various things.

Quote:
Originally Posted by Mr Beardsley
None of the above has anything to do with frameworks, only server implementation. Unless someone drastically alters the implementation of PHP, you can consider it a feature of the language as PHP only works one way on a server.

Additionally you are wrong in saying that PHP does not come with a framework. Out of the box you get support for sessions, database access, collections, etc. It might not be as full featured as some of the other web app frameworks, but that is a lot more than just a language.
It comes with APIs, yes, however, it is still a language. It doesn't force MVC onto you, nor does it force any or paradigm. It's a tool set, just as any high-level language should have. A framework is something entirely different. (Also, as of PHP5, Database Access must be enabled on compile.)

I really have nothing to put here, but I feel it's rather strange to not have one.
  quote
Mr Beardsley
Member
 
Join Date: Jul 2004
Location: Colorado Springs
Send a message via AIM to Mr Beardsley  
2006-06-27, 23:35

Quote:
Originally Posted by rollercoaster375
I never said it shouldn't be done... I simply said HTTP wasn't designed for it, and hence, state-ful web applications generally have some side effects - Take a look at the URLs in the Apple store, for instance.
What if I don't want to play with cookies, then how well will PHP stand up?

Quote:
Originally Posted by rollercoaster375
Through use of IonCube, and various other tools, PHP can also be compiled into Bytecode.
I wasn't aware of that, thanks for the heads up.

Quote:
Originally Posted by rollercoaster375
Define "better". The URLs to WO applications are generally horrible. Whereas, this forum, for instance, implements a very nice session system.
Again if I don't use cookies then this forum won't hold any state for me. If you don't want the "horrible" URLs then you can use direct actions, or cookies as well. Here the alternatives to PHP give you more options.

Quote:
Originally Posted by rollercoaster375
As well as a less flexible application, and other various things.
About the only thing I can think of here is flexibility in deployment. Sure that is a a big plus for PHP no arguments there.

Quote:
Originally Posted by rollercoaster375
It comes with APIs, yes, however, it is still a language. It doesn't force MVC onto you, nor does it force any or paradigm. It's a tool set, just as any high-level language should have. A framework is something entirely different. (Also, as of PHP5, Database Access must be enabled on compile.)
Uhh a framework is a code library, an API is how you call that code, PHP has these. So you have to enable database access, why would that not make it part of the framework that comes with PHP?

MVC is a great design pattern, and as NeXT showed it even works really well with the web. Sorry but I can't imagine any good web code that would not hold to separating display from business logic. Can you make a compelling argument for why the two should be mixed in a web app? If you can't then having the framework help you with MVC is nothing but a win.

It's obvious that you really like PHP, that's fine. PHP is good at what it is designed to do. However, there are alternative technologies for dynamic web content that do work better than PHP. I'm just trying to offer my thoughts on what those technologies are, and why they are better. There is a reason that businesses use ASP.Net, WebObjects, JBoss and the like. As someone who has used both I would say that for anything but the most trivial dynamic content I'd rather use something other than PHP. Read what Jon Rentzsch has to say about WebObjects vs other web technologies. I agree totally with him that after you wrap your head around how WO works, you can bang out much better apps in a fraction of the time compared to things like Perl CGIs and PHP.

"Slow vehicle speeds with frequent stops would signal traffic congestion, for instance."

uh... it could also signal that my Mom is at the wheel...
  quote
nassau
Member
 
Join Date: Jul 2004
 
2006-06-28, 06:47

great discussion, thanks for all the input!

what i still wonder is, if you can build phpBB etc with PHP why not corporate sites? is there a technical limitation or a limitation of the mind? i can't see what's so extremely complex about a business site compared phpBB or vBulletin (this forum..).

sorry if i'm missing the point but i still don't have the answer. why do buyers not see PHP as suitable for 'enterprise'?
  quote
Mr Beardsley
Member
 
Join Date: Jul 2004
Location: Colorado Springs
Send a message via AIM to Mr Beardsley  
2006-06-28, 09:05

Quote:
Originally Posted by nassau
great discussion, thanks for all the input!

what i still wonder is, if you can build phpBB etc with PHP why not corporate sites? is there a technical limitation or a limitation of the mind? i can't see what's so extremely complex about a business site compared phpBB or vBulletin (this forum..).

sorry if i'm missing the point but i still don't have the answer. why do buyers not see PHP as suitable for 'enterprise'?
You sure could use PHP for corporate sites, but as I've tried to show there are better alternatives. They offer better maintainability, better scalability, and are a better use of a programmers time. You can bend PHP to do a lot of these things, but it wasn't originally designed with the same goals. PHP started as a way for a guy to collect statistics on how many visitors he had to his site. It has grown quite a bit, and many more things are possible with it, but contrast this with something like ASP .NET which was written from the ground up to be a robust, industrial strength application server and you can see why businesses choose one over the other.

You seem to like PHPBBs as an example of dynamic sites. To give you an example I like to read reefcentral.com. It is a fairly high traffic site, and I'd guess they have 10,000-20,000 visitors there a day. They have some fairly frequent performance problems with that site. They have to limit searching to paid members because it would overload the site for everyone to be doing it. Also, they go offline many times because of high traffic. Can you imagine Ebay, Amazon, the Apple store, etc going offline because of high traffic? They would loose money from that, hence they pick a solution that is more robust.

"Slow vehicle speeds with frequent stops would signal traffic congestion, for instance."

uh... it could also signal that my Mom is at the wheel...
  quote
rollercoaster375
Senior Member
 
Join Date: Mar 2005
Location: UIllinois (Champaign, IL)
Send a message via AIM to rollercoaster375 Send a message via MSN to rollercoaster375 Send a message via Yahoo to rollercoaster375 Send a message via Skype™ to rollercoaster375 
2006-06-28, 09:11

Quote:
Originally Posted by Mr Beardsley
What if I don't want to play with cookies, then how well will PHP stand up?
Firstly, why wouldn't you want cookies? Secondly, PHP's session module (Which I generally don't use - I prefer a custom solution in that area) can use URL-based sessions as well. It even goes to the trouble of replacing links in the final page being sent to the client with the additional URL argument, automatically.

Quote:
Originally Posted by Mr Beardsley
Again if I don't use cookies then this forum won't hold any state for me. If you don't want the "horrible" URLs then you can use direct actions, or cookies as well. Here the alternatives to PHP give you more options.
Yes it will. Disable cookies in your browser, and log in. It'll work fine, however, your session will be lost when you leave the forum. Also, what do you mean by direct actions?

Quote:
Originally Posted by Mr Beardsley
About the only thing I can think of here is flexibility in deployment. Sure that is a a big plus for PHP no arguments there.
As well as flexiblity post-deployment. Files may be edited while the application is live, in order to fix a bug or a security hole, for example.

Quote:
Originally Posted by Mr Beardsley
Uhh a framework is a code library, an API is how you call that code, PHP has these. So you have to enable database access, why would that not make it part of the framework that comes with PHP?
I use the term API more freely than I should, now that I realize what I said. Secondly, I disagree that a framework is simply a code library. Simply having a set of functions does not provide you with the basis for the beginnings of an application. It's just that: a toolkit. As for Database access, I was simply saying that it no longer 'comes with' PHP.

Quote:
Originally Posted by Mr Beardsley
MVC is a great design pattern, and as NeXT showed it even works really well with the web. Sorry but I can't imagine any good web code that would not hold to separating display from business logic. Can you make a compelling argument for why the two should be mixed in a web app? If you can't then having the framework help you with MVC is nothing but a win.
I agree, MVC is a good design, and it works well. However, it's most certainly not the only application structure pattern. Take a look at PAC, MMVC, etc. The aforementioned paradigms are simply extentions, or modifications, to MVC, however, they are not composed in the same way, and hence, cannot use the same framework.

Quote:
Originally Posted by Mr Beardsley
It's obvious that you really like PHP, that's fine. PHP is good at what it is designed to do. However, there are alternative technologies for dynamic web content that do work better than PHP. I'm just trying to offer my thoughts on what those technologies are, and why they are better.
As am I. And yes, I do like PHP, however, I'm often frustrated by the limitations of said language, so I've often looked at alternatives.

I really have nothing to put here, but I feel it's rather strange to not have one.
  quote
nassau
Member
 
Join Date: Jul 2004
 
2006-06-29, 03:49

Quote:
Originally Posted by Mr Beardsley
PHP started as a way for a guy to collect statistics on how many visitors he had to his site. It has grown quite a bit, and many more things are possible with it, but contrast this with something like ASP .NET which was written from the ground up to be a robust, industrial strength application server and you can see why businesses choose one over the other.
i hear you.

Quote:
Originally Posted by Mr Beardsley
You seem to like PHPBBs as an example of dynamic sites. To give you an example I like to read reefcentral.com. It is a fairly high traffic site, and I'd guess they have 10,000-20,000 visitors there a day. They have some fairly frequent performance problems with that site. They have to limit searching to paid members because it would overload the site for everyone to be doing it. Also, they go offline many times because of high traffic. Can you imagine Ebay, Amazon, the Apple store, etc going offline because of high traffic? They would loose money from that, hence they pick a solution that is more robust.
are the performance problems caused by using PHP? is there an upper limit to how much traffic PHP can handle, does it lack in "computing speed" or something like that?
  quote
Posting Rules Navigation
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

Post Reply

Forum Jump
Thread Tools
Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP installation issues ThunderPoit Programmer's Nook 17 2006-03-17 11:25
PHP & Apache 2 ast3r3x Genius Bar 0 2005-03-16 20:38
Generating XML for Newsfeed (MovableType and PHP) drewprops Genius Bar 3 2005-01-22 00:32
HELP! URGENT. DOWNGRADE PHP 5.0.1 to 4.3.6 hype.it Genius Bar 2 2004-08-31 19:15


« Previous Thread | Next Thread »

All times are GMT -5. The time now is 05:31.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004 - 2024, AppleNova