Ask Slashdot: Which Web Platform Would You Use?
New submitter datavirtue writes "I'm about to embark on developing active content (database driven, and web services) for the first time for my website and I have grown to love PHP. Knowing that there are other web development platforms available, and noticing some disdain for PHP in some circles, I'm curious to know which platforms slashdotters prefer along with the reasons why. Before I get started into heavy development I would like to get some opinions and more facts. Why shouldn't I use PHP?"
I've been using Django for a while now on my web app, having moved away from home-brewed PHP. Very easy to use, and encourages well-written and elegant code.
Ydco co
Idiots like this guy here are exactly why there is so much hate for PHP. Here is a classic example of someone comparing PHP - a language - to a full blown web development framework. Ruby on Rails people do exactly the same.
You can argue about the differences and benefits of ASP.NET vs RoR vs Zend Framework vs Yii vs [insert another web framework here] - but comparing a language to a framework is outright idiotic.
Out of genuine interest, what makes a well written (emphasis on WELL WRITTEN) PHP app so much harder to maintain than an equally well written *.NET app?
You have to actually read and write code, you can't just click checkboxes until it works.
It is really hard.
Wt is the best one I have tried. I use the C++ version, although there is also a Java version (JWt).
What makes Wt unique is its approach: widgets. You develop web applications like you were developing desktop applications. Also, the API is Qt-like (but using Boost).
I gave up on Rails after I used Wt.
Want a virtualization console? Take Wt, libvirt and an HTML5 VNC client and you are done.
Need Active Directory authentication? Wt, Samba (or Windows APIs if you are on Windows), done.
Streaming? Wt, ffmpeg libraries, done.
Forgetting about bindings and being able to use the millions of C/C++ libraries out there was a huge relief.
Also, size: Rails, Django (and even PHP) just do not fit in an embedded environment. Wt does.
I... would not use ASP, I'd use PHP before ASP, and Python before that.
One of the advantages of python, is that, with mod_wsgi, it's very fast.
Actually, what I'm working on is, a mod_wsgi handler in apache, that sends the request to a back-end server, originally written in python, but now I'm switching to C# (still no ASP). Although there are ASP Modules for Apache/mono, I belive mod_wsgi has much more thorough testing, and will therefore be a better-cross-platform solution.
In the end, answer these three questions:
1) What platforms are you most comfortable with? Rank them.
2) What platforms have the best modules/libraries for what you want to do? Rank them.
3) What platforms have the best performance? Rank them.
Now, given the rankings on 1-3, which platform is best for you? Nobody can answer this but you. Without knowing the details of what you want, we really can provide advice on #2 and #3.
Self proclaimed typo king, and inventor of the bear destroying coffee table (patent not pending).
I've been doing a lot of web programming, and I evolved from PERL to PHP to Python. I happen to prefer Python these days, but there's nothing wrong with PHP. I wrote my company's PTO system using PHP (LAMP) and it works great. I would also suggest JQuery or similar for richer content.
Most "disdain" for any given language is mostly elitism and people self-validating their own choices. It's true PHP can be messy, but I recall having a Ruby developer look at my PERL code and be surprised at how readable it actually was... in other words, it's up to the programmer. I can make some pretty ugly programs in any language.
Stupid sexy Flanders.
Because people are looking for actual opinions from developers, not market-speak from commercial marketers. I mean, mod_mono?? Really???? LOL!
"Somebody has to do something. It's just incredibly pathetic it has to be us."
--- Jerry Garcia
A while back now I had to do a project in ASP.Net, after being a long time PHP developer and I have to say I found it incredibly unpleasant. PHP's problem is that you have to write everything from scratch, however ASP provides you with a tonne of controls that allow you to get up and going really quickly. The problem though, is as soon as you try to do something a bit more complex with ASP.Net controls, it all falls in a heap.
I remember having to print a list of products, and there would be sub headings mixed in amongst the rows to divide product families....
Product Family 1
Product 1 - $Price
Product 2 - $Price
Product 3 - $Price
Product Family 2
Product 4 - $Price
Now I was pulling these products from a database as one giant table, and then binding the data set to the Repeater control. The problem is that ASP.Net only has templates for a Row and alternating rows, so I couldn't easily insert the separators for the different Product Familys. All of the sudden I'm having to create my own custom controls that inherited from repeaters and needed to have a detailed understanding of how ASP.Net worked and all sorts of scary things. Needless to say, it was incredibly frustrating.
On the other hand, the same solution in PHP is solved with, //New Family row code goes here.
if($PreviousProduct.Family != $CurrentProduct.Family))
{
}
1 Line vs alot + stress. To me, that kinda summed up ASP.Net, great if you don't really know how to program, but for professionals, not so great.
That said I love C#, and I definitely wish that PHP was more like it, PHP is a terrible mess, but its fast, simple and you can build things fairly rapidly. Combine it with a framework, and you're in pretty good hands. Although I'd really love for them to make it harder for noobs to create security issues. :\
Here's a little secret for you: Anyone that uses the word "enterprise" is full of shit. It is used by mediocre developers who work at relatively big corporations and have been forced through the years to work with a bunch of bureaucracy. This people can't release a fucking shell script without 10 formal test cases, 50 meetings, 10 flowcharts, and it's own repository.
Serious huge projects are written in C++. Serious huge projects that need incredible performance are written in C with assembly optimizations. When somebody tells you that you can't write anything if it's not done in Java, that guy is a corporate droid. If somebody tells you the same for Perl, he's an old monk. If somone tells you that for Ruby/Python/Brainfuck, he's a snob and a fan of that particular language, ignore him too.
Truth is, leaving aside the obvious differences, when it comes to features that help organize huge projects, C has nothing that PHP doesn't implement on some way. Don't get me wrong, I'm not comparing the base of all modern computing with a modern and not very well designed interpreted language, I'm talking about features that some idiots would call "corporate". And yet, there are incredibly HUGE projects written entirely in C. And yes, there are also huge projects written in PHP.
Truth is, if you are a good coder, you'll do a good job even if you have to use Basic. And if you are not, you'll write spaghetti code even in C++.
PHP is a simple, straight to the point language, with a very clear syntax, that is great for web development. It's syntax is very much C-like, just like Javascript, and that certainly helps when you are writting web apps. It's easy to find PHP coders, and that certainly helps too.
The problem with PHP's reputation is that it's incredibly easy to just write some script or modify an existing one, and call yourself a coder. So the amount of bad PHP code out there is incredibly huge and incredibly public. Of course, if you reviewed each of those Corporate-enterprise-mega-super-jumbo java apps, you would find as many WTFs as you could in your average PHP project, the only difference is that the assholes rooting for Java won't show you their code, and they'll act very dignified.
Also, avoid the motherfucking frameworks. You don't need them, at all.
WTF am I doing replying to an AC at 5 A.M on a Friday night?
They all suck, which one sucks the least depends on the circumstances of your project (time, budget, techincal aspects, what you already know, what you would like to learn, performance requirements, scalability requirements).
OK; because for some strange reason nobody has raised this criticism, I will:
Going down the Microsoft (ASP.net/C#/Visual Studio/SQL Server/etc.) route is EXPENSIVE. You will have to pay ongoing licensing fees for EVERYTHING. It simply isn't an option for a small-time developer without much cash; you need to be a small-to-medium sized business at least, I'd say.
That's a significant consideration, and is the primary reason I tend to avoid it for my personal projects.
== Jez ==
Do you miss Firefox? Try Pale Moon.
To throw my personal thoughts in to the fray. It really depends on what you are trying to do. For slimmed down front end, I prefer PHP. If you came from a PHP background, I would expect ASP.Net's UI to be infuriating to get used to. (I also come from a very strong PHP background and the shift to ASP.NET webforms for a project at work has been a major headache.) That said, ASP.Net MVC functions much more in the PHP style that you are used to. Overall though, unless you need to have the same front end and back end, I would recommend working the front end in whatever you are the most comfortable with. If that is PHP, I don't see any reason it should cause you trouble.
As for the backend, it could be done in PHP and I've done back ends in PHP before, but you will need to either use a third party framework or write a lot from the ground up. My preference has been to build from the ground up, but I've also typically worked on very specialized solutions. This is where ASP.Net really shines though. In terms of data handling and providing web services to back your site. C# and .Net offer a lot of very powerful tools and nice enterprise compatibility. The debugging tools are also excellent. If you are using MSSQL to back the project, then it is almost a no brainer, but my understanding is that MySQL and Postgres support isn't bad either. ASP will also let you easily switch the type of web service you are using by simply swapping out the interface or in some cases, simply updating a config file.
If it is just your personal site though, then again, PHP will probably serve you just fine, particularly if your hosting provider doesn't support ASP.Net.
AJ Henderson
I'm a .Net developer, and I find a lot of what you say is true about .Net especially with respect to the standard controls. However, there's nothing stopping you from writing PHP style code in .Net. That exact line (if statement) you wrote out in PHP could easily have been done exactly the same in C#. Personally, after using .Net for 10 years, I have never actually used the standard controls, but rather just went about using the language to generate HTML because that's what seemed to cause the least friction. You end up generating your own libraries for the standard interface elements your applications uses. I've found this true of just about every programming language I've ever used. The standard stuff is sufficient for getting a prototype out the door quickly, but if you have a big project, you end up having to write a lot of custom code, because the included stuff never dose what it's needed to. The PHP style code ends up being the best starting point, because you don't waste a lot of time trying to bend the included stuff to do things it was never meant to do.
Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
Sorry man. I deal with ruby, php, perl, .net, asp.net and bar none, .net and asp.net are not even close to being as reliable as php or ruby. I would never recommend .net to a client, ever.
This is hugely convincing, I'll bring your valid points to my clients in the future. I think the "bar none" is the big selling point here.
lucm, indeed.
Maybe. But not all of it.
I have been using PHP, for both business and personal stuff, since it was called "PHP/FI" ("personal home page / forms interface"). My old startup company would never have been successful without stuff we did in PHP. I've written and contributed C-based PHP extension code which was distributed with the core for years (until the underlying libraries fell so far out of use that there was no point including it anymore).
I still use PHP sometimes. But I prefer not to use it for important stuff that needs to stick around for a long time if it has any complexity.
Here's why: in my own personal experience (YMMV, of course), PHP has not been terrific about separating security fixes and bug fixes from feature evolution. It was far too easy to write code that would break with a version upgrade (eg. because an API or behavior changed), and to be forced into that version upgrade because security hole fixes were only available for the newest versions.
It's certainly the case that if you were very careful, you could avoid the problems. But, you had to be careful, and I saw a lot of novice programmers who weren't. (Our startup company provided PHP APIs for our product -- as well as Perl, Python, Java, and even TCL, this being the mid-to-late 1990s -- so I got to interact with a lot of novice PHP programmers.)
It's also certainly the case that for home/hobbyist use, you can mitigate some of the trouble by getting your PHP as part of a Debian distribution instead of getting it directly from upstream sources. The Debian folks are kinda insane about backporting security fixes to regarded-as-obsolete versions of software, and I love 'em for it. This is what I do on my household servers. (Yes, I still run my servers myself, not via a hosting provider -- have since about 1988, when they were Sun and VAX systems instead of the Linux I use today.)
It's certainly possible that PHP has gotten significantly better about this than it used to be. I haven't had reason to go check.
But anyhow, that's where my own ... hatred is too strong a word, let's say maybe "concern"? ... for PHP came from.
Actually PHP is pretty bad as a language. Like Perl it does nothing to encourage proper design or even readability.
What people don't understand is that a good programer can write a good, stable, and scaleable program in just about any language. The best can do it in Assembly language.
Bad programers can write crap in any language.
The problem is that most programers fall in the middle. A good language will help them write good code.
So what is good about PHP? That is simple, it is popular, everywhere, and has a lot of support. IMHO it is the Microsoft Basic of the web. I have not played with Yii, Cake, or Zend but they all sound very interesting.
One may want to go one step higher and possibly look at something like Drupal or Joomla instead of a framework. What the original poster wants to do may already be available in one of those CMSs or could be added to it as a module.
See my blog http://ilovecookes.blogspot.com/ for light hearted technical information.