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?"
PHP is fine, but if you want to learn about a better, enterprise-ready languages I would suggest using ASP.NET. It integrates perfectly with .NET apps and libraries and comes with a comprehensive library (as it uses .NET). The great thing about ASP.NET is that you can use C# to develop for it. ASP.NET also comes with various functions to make state management easier - an important feature that is completely missing in other languages. It also has built-in cache management.
.NET. This means you can use VB.NET, C#, J#, Delphi.NET etc. And because you compile the code to bytecode, it runs significantly faster. On top of that Visual Studio is a great free (and commercial) development environment.
ASP.NET originally lacked templating engine, but Microsoft introduced it in 2.0 version. You can have master templates that have placeholders for the dynamic content, as well as all the HTML and JavaScript that is shared between all pages.
It is basically more than your off-the-shelf PHP/Python/Ruby. ASP.NET provides much larger library to use, has templating engine, error handling, controls and events (and hence is more familiar to Windows developers), caching, object-oriented design and session control which can even be saved in SQL Server. It's not just a language, it's the complete package.
One of the great things about ASP.NET is also that you can use your favorite language to develop for it, as long as it supports
Oh, and if you want to run ASP.NET under Linux servers, it's easy too. Apache has mod_mono module or you can use it via FastCGI.
Most hate towards PHP comes from elitist snobs who don't know how to use the language. PHP is perfectly fine language to use, and it is extremely powerful and flexible. If you are going to develop for web, I suggest using some framework, as it makes the process much more straightforward, faster and better. I personally use CodeIgniter, which is fast and has a good library of helpers and other essential framework stuff. CakePHP is often suggested for persons new to frameworks, but I would stay away from it. It's slower and it's more pain in the ass to learn.
There's also other good things about PHP. First of all, it works with practically every web host out there, and doesn't require you to play around with it to get it work. It has an extremely comprehensive library, amazing documentation and almost all API's have client libraries for it, if they just have some. PHP, being the #1 platform on the web, gives you that advantage.
...as Subjective and Argumentative.
Oh, wrong site.
Bitten Apples are still better than dirty Windows...
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
I use PHP for 90% of my work because it's the right tool for the job. We can also bring other developers up to speed on our own framework and projects pretty fast.
There are times when Python is a better fit. The fact that it remains running across page loads can be very handy (as opposed to every request to PHP being completely distinct, which has its own advantages). A continuously running app is often better for backend processing, especially when interacting with third party systems.
Developers: We can use your help.
Use the language of Money and buy someone to build it for you. Problem solved!
... well, not really. But there is such a thing for the web: http://www.runbasic.com/
Oh arse
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.
Wt ("witty") is a C++ toolkit that is modeled after Qt. It uses boost and STL, but you get to use familiar Qt concepts - signals & slots, Model view, etc. Basically think of Qt-based web pages. It fully supports AJAX and can handle the data server-side or on the client. It also has a C++ -> JS converter so you can just make a function for conversion to JS and have it exec on the client. Of course it runs as a module, or it comes with its own server. It fully supports CSS, DOM, etc.
I reall like this approach because my two complaints of PHP:
1. It is unstructured
2. it is ugly (both syntax, and having code embedded in pages)
are alleviated.
1. C++ object orientation encourages a structured approach.
2. The "it's 100% C++" ensures that you focus less on the presentation in PHP and just on the application logic. This helps encourage a model-view-controller approach. While you might have to write CSS, you will never have to write HTML and you won't ever have to mix the two in a CPP file.
Another reason is speed. Everything is compiled and runs natively, or compiled to JS and moved to the client.
Yet another reason is security. Wt has several protections built in. See the features link below.
If you're looking to do web pages entirely differently, this is it.
Additional features list
Slashdot's rate-of-post filter: Preventing you from posting too many great ideas at once.
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.
Perhaps a better word is 'inelegant'. A massive global name space, inconsistent function names and argument order, tacked on object model, crappy exception handling.
There's almost nothing that php does better than other modern scripting languages.
You might as well ask which religion is the best one.
There's almost nothing that php does better than other modern scripting languages.
Very true; but it's ubiquitous, very easy to get into and has great documentation. Choose your evil.
Bitten Apples are still better than dirty Windows...
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?
Yes, it's still very actively developed. Especially if you throw in Moose and Plack.
So.. it has come to this
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).
I don't think that evaluating the elegance of the code is entirely unreasonable. If nothing else, it aids maintainability, particularly as the original developers of projects move on and new people have to get up to speed with the code base.
However, it should not be a primary concern. Those would probably be performance/scalability and speed of development, the order of which varies person to person and project to project.
To the OP: PHP is a fine language overall. It is not particularly elegant, but it does scale pretty well compared to alternatives and it also is easy to get started with, and has very good documentation. The most frustrating part of it is probably that there are some annoying internal inconsistencies. The one that always ends up getting to me is stristr( $haystack, $needle ) for checking if one string is contained in another versus in_array( $needle, $haystack ) for checking if an element is contained in an array. The argument reversal is just frustrating.
So far as PHP frameworks, the one I have used the most is CodeIgniter. It is not bad, neither in features nor in learning curve, and it is reasonably fast. I have also heard some good things about Yii, but do not have personal experience with it.
I personally really enjoy Ruby and Ruby on Rails as language/framework, but I can not deny that there are scalability issues sooner than with PHP, and it is also harder to find cheap web hosts that support it well if that is a factor. It is a beautiful language though, and you can get a basic website up and running at lightning speed. In my experience it is also a very hot language with good job prospects if that is a goal. Some people worry about using it for their projects because of the comparably small number of developers for it, but those that do typically pay quite well.
Bottom line: If the only reason you are not using PHP is other peoples' disdain, screw them. It is a fine choice. If you want somebody else to pick the best choice for you and your project, we can not do it; we lack the information, if nothing else, and all you will get is a bunch of replies about peoples' pet frameworks. You seem to like PHP, so go with that. Google "best PHP frameworks" and I am sure you will turn up a chart somewhere comparing a bunch of them for you and you can make the choice from there. All I would really concern myself with is a nice bit of database abstraction (so that it can handle SQL injection issues for you) and performance; the rest is choice or gravy on top. I personally prefer ones that do not have a specific template language and instead just allow me to continue to use PHP in my views. I do not see the advantage of learning yet another "language" and abstracting further away from the code that is ultimately going to be run, but if you do that is your choice.
ASP.NET or JAVA EE are all perfectly fine and their real advantage in Enterprise development is the ability to find good Professional Software Developers.
PHP as a language is a personal preference... However many of the PHP Developers do not do too much Enterprise coding so PHP code tends to be sloppy. While ASP.NET or JAVA EE Code seems to be written in more of a professional way.
You can write good PHP Code that does everything that ASP.NET or JAVA EE does and it may even be better and faster. However the people who tend to write PHP do not code thinking of enterprise teer development
If something is so important that you feel the need to post it on the internet... It probably isn't that important.
We're going to have to agree to disagree on this one, then. I completely agree with all of your points on Java and J2EE being a great platform and community, and I share your concerns about Oracle. But think about the sheer quantity of learning you're asking this PHP guy to bite off, recognizing that his project is probably, at most, something he could hack together in about 20 hours, tops, if he used PHP.
If you look closely, I think you'll see that you're making my point for me. You say that an inexperienced developer could mess things up quite righteously using JSF/Hibernate, and I agree with you. But then you suggest that he use JSP/JDBC? And this is an improvement over Pear/PHP, how? I vomited enough vomit over JSP/JDBC code between 1999-2001 to know that JSP/JDBC is not the correct solution to any problem. In order for the OP to be effective in any Java-based web framework (J2EE, Spring, whateverYourFavoriteMightBeThisWeek), he's in for hundreds of hours of work, assuming he doesn't first give up in frustration.
After considering the matter, I'd advise OP to do his web app in one of the many PHP MVC frameworks. Cake or Symfony would be great choices. That way, he can begin to educate himself on good web design principles using a language that he's already familiar with. Good design principles are always more important than choice of language, anyway.
They don't grade fathers, but if your daughter's a stripper, you fucked up. --Chris Rock