tags:

views:

686

answers:

12

In response to this question, I'm sure many people would object that PHP isn't the best choice for desktop programming, and would recommend something like Ruby or Python instead. I thought it would be interesting to have a discussion on why.

Aside from arguments about whether PHP is a good language overall, what are your criteria for a good desktop programming language (as opposed to web development)?

+1  A: 

Performance is my criteria on desktop software. But I believe that desktop softwares will die someday :)

Cesar
Performance is not a big concern in desktop as Web app are. There are thousands slow application (java things) beloved IF their are good. BTW, i agree with "desktop will die someday" part.
Ismael
Sometimes performance is critical, sometimes it hardly matters. You need at least one high-performance language, although you don't need to write everything in it. Also, I think desktop software will remain for the foreseeable future. There's always going to be more processing power without communication lag there, and apps that need it.
David Thornley
+2  A: 

Is it installed by default on the target platform? Because if it is not, then there is more friction to adoption.

jldupont
+4  A: 

Because it is catered entirely toward web programming, and while it may have the necessary tools for desktop programming there are other languages which are much more capable, more efficient for the job.

Personally I don't like a lot of the language principles so I only use it when I'm forced to.

meder
+6  A: 

This sounds like a trite answer, but I think the reason most people don't use PHP as a desktop programming language is because people don't use PHP as a desktop programming language.

Meaning, there isn't a very strong community around GUI desktop applications using PHP - this will impact the tools a developer will have available, the resources he can go to for help, and for a company or commercial endeavour, the additional programmers that will have the skillsets necessary to work with a very niche set of tools.

Ryan Brunner
The second argument isn't really valid, because *any* new language is going to have that problem.
mabwi
Fair enough, but I think there's a critical mass that has to occur before a new language gets any sort of exponential growth that is necessary for an active community. It's not particular to PHP, and at one point in time it was true of every language that is actively used for desktop development, but crossing that threshold from niche language to a valid choice for a business is not a trivial one.
Ryan Brunner
+6  A: 

Does $language_under_consideration do the job I want easier than $other_language?

E.g., I've found php interfaces to mysql to be great for quickie DB work. I'd not want to write php for a GUI app on Windows though....

Paul Nathan
+17  A: 

PHP is designed specifically to create web applications. While it is technically possible to create desktop apps using it, you're really sanding off the corners to fit the square peg in the round hole.

There are so many programming languages designed with the desktop as a target, it just doesn't make sense to try and shoehorn PHP in to a world it's not meant for.

For perspective: PHP is my job

mabwi
Well put my friend :) I'm getting tired of sanding corners myself.
fuentesjr
Bingo. PHP can be a good web language with competent programmers. It's not currently (nor is it likely to become) a good desktop language, regardless of competence.
ceejayoz
+7  A: 

PHP for desktop applications:

The ease of distribution from a desktop application with the performance of a web application.

Wouter van Nifterick
A: 

I'm a huge advocate of using PHP for quick development of web applications. It's easy to learn, has a huge community of other users that have solved most problems already.

However in addition to what other users have mentioned you may also want to consider the sheer number of vulnerabilities PHP already has (http://www.securityfocus.com/vulnerabilities).

If some of these things were addressed and perhaps packaged in something similar to what we see with Adobe AIR, there might be a good basis for desktop application production.

BrandonCS
That site shows a whole 5 vulnerabilities for PHP 5.3. No indication of severity. Also, note that most security sites caution against using number of vulnerabilities as a metric.
ceejayoz
@ceejayoz: You might want to look at the security holes that were fixed in php 5.2 (my favorite is the fix of bug #44096 in PHP version 5.2.6, that caused a huge memory consumption during (!) string concatenations (!)) http://php.net/ChangeLog-5.php
soulmerge
I guess I could have also mentioned how to use the site. The first page is the issues identified today. You can span through the rest of the archive if you'd like to see all of the security issues. I've been watching the site for sometime and PHP gets vulnerabilities identified quite often.
BrandonCS
And I doubt it is because the PHP team is so security aware :)
soulmerge
A: 

PHP is the new perl if you're going to use it as a programming language outside the web environment. If I'm going to be writing apps, I want a decient environmen to work in. Without 3rd party apps, debugging php programs can be a pain.

SynackSA
Perl has another niche or two: replacing shell scripting and quickie text-related jobs. (With all due respect to Larry Wall et al., I can think of several languages I'd rather do large projects in.) PHP doesn't seem to have another niche currently.
David Thornley
+13  A: 

You say "Aside from arguments about whether PHP is a good language overall" -- but I think that is the crux of the issue. PHP became popular as a web development language because it integrates well with an existing stack of web tools (inline HTML, good Apache integration, built-in MySQL support, etc) -- not because it is well-designed language that is easy to work in. (It's not, by the way.)

If you take the web away and use PHP for desktop development, what do you have left? A weakly typed, inconsistently-featured language with no support for desktop UIs and a horrific mess of a standard library. People don't use PHP that way because it just doesn't make sense.

Daniel Pryden
+1 for the first sentence alone.
David Thornley
+1 because you explain both its popularity and its lack of suitability for this task (as opposed to JUST saying 'it sucks')
Nathan Long
are saying that if php got their act together and standardized all of their function names etc. that it would be a good language?
Ramblingwood
@Ramblingwood: If there was a version of PHP with standardized function names and a better-designed standard library, that would be a *better* language. But to be a truly *good* language (IMHO), PHP would require a lot of changes to the type coercion rules -- things like the difference between `0` and `false` need a lot more work.
Daniel Pryden
@Daniel Pryden Your definition of a "good" language is one that is strongly and statically typed?
Lotus Notes
@Byron: I would say a "good" language is not necessarily statically typed, but a good language should be "strongly typed" in the sense of having a sound type system with well-defined, consistent type coercion rules. Additionally, a "good" language should have a standard library that is well designed, with good orthogonality between different features and plenty of hooks for extensibility. I don't currently see PHP as having any of those, unfortunately.
Daniel Pryden
+1  A: 

I'm surprised nobody has said this. As a web developer, I only use PHP because that's what the clients usually ask for. They want to deploy on any hosting they can find and all web hosting share one common denominator: PHP. Also, we do a lot of rescue mission style coding where we have to fix sites already written in PHP. As an honest developer can't recommend PHP as a platform in good conscience for serious web development. I would never choose PHP for any project, web or desktop. Python is pretty great for desktop apps. It's more dynamic than PHP, more sane, and more productive.

postfuturist
A: 

I don't see any difference in using PHP for web or desktop application, just different libraries. Qt and GTK+ are both availables to PHP, and if someone took the time to write such bindings it means more than someone is using it for desktop.

In my opinion, the success of PHP in the web is because there is no valid alternative: said in other words PHP is the less worse. In the desktop world it is not so lucky and it should compete with stronger contendents... I'll personally choose tons of other languages before PHP.

ntd